- name: add nginx-docker-cert-deploy.sh
  copy: 
    src: "nginx-docker-cert-deploy.sh" 
    dest: "{{nginx_docker_cert_deploy_script}}"
  when: run_once_nginx_docker_cert_deploy is not defined
  notify: restart nginx-docker-cert-deploy.cymais.service

- name: run the nginx_docker_cert_deploy tasks once
  set_fact:
    run_once_backup_directory_validator: true
  when: run_once_nginx_docker_cert_deploy is not defined

- name: "create {{cert_mount_directory}}"
  file:
    path:     "{{cert_mount_directory}}"
    state:    directory
    mode:     0755
  notify: restart nginx-docker-cert-deploy.cymais.service

- name: configure nginx-docker-cert-deploy.cymais.service
  template: 
    src:  "nginx-docker-cert-deploy.service.j2"
    dest: "/etc/systemd/system/nginx-docker-cert-deploy.{{application_id}}.cymais.service"
  notify: restart nginx-docker-cert-deploy.cymais.service

- name: "include role for systemd-timer for {{service_name}}"
  include_role:
    name: systemd-timer
  vars:
    on_calendar:  "{{on_calendar_deploy_certificates}}"
    service_name: "nginx-docker-cert-deploy.{{application_id}}"
    persistent:   "true"