- block:
  - name: "create {{restart_docker_folder}}"
    file:
      path: "{{restart_docker_folder}}"
      state: directory
      mode: 0755

  - name: create {{restart_docker_script}}
    copy:
      src: restart-docker.py
      dest: "{{restart_docker_script}}"

  - name: configure restart-docker.cymais.service
    template: 
      src: restart-docker.service.j2
      dest: /etc/systemd/system/restart-docker.cymais.service
    notify: "reload restart-docker.cymais.service"

  - name: set service_name to the name of the current role
    set_fact:
      service_name: "{{ role_name }}"

  - name: "include role for systemd-timer for {{service_name}}"
    include_role:
      name: systemd-timer
    vars:
      on_calendar:  "{{on_calendar_restart_docker}}"

  - name: run the restart_docker_volumes tasks once
    set_fact:
      run_once_restart_docker: true
      
  when: run_once_restart_docker is not defined