Matrix Docker Ansible eploy
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 

65 righe
2.8 KiB

  1. ---
  2. # This is a cleanup/migration task, because of to the new way we manage cronjobs (`cron` module) and the new script name.
  3. # This migration task can be removed some time in the future.
  4. - name: (Migration) Remove deprecated Let's Encrypt SSL certificate management files
  5. ansible.builtin.file:
  6. path: "{{ item }}"
  7. state: absent
  8. with_items:
  9. - "{{ matrix_local_bin_path }}/matrix-ssl-certificates-renew"
  10. - "{{ matrix_cron_path }}/matrix-ssl-certificate-renewal"
  11. - "{{ matrix_cron_path }}/matrix-nginx-proxy-periodic-restarter"
  12. - "/etc/cron.d/matrix-ssl-lets-encrypt"
  13. #
  14. # Tasks related to setting up Let's Encrypt's management of certificates
  15. #
  16. - when: "matrix_ssl_retrieval_method == 'lets-encrypt'"
  17. block:
  18. - name: Ensure certbot Docker image is pulled
  19. docker_image:
  20. name: "{{ matrix_ssl_lets_encrypt_certbot_docker_image }}"
  21. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  22. force_source: "{{ matrix_ssl_lets_encrypt_certbot_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  23. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_ssl_lets_encrypt_certbot_docker_image_force_pull }}"
  24. - name: Obtain Let's Encrypt certificates
  25. ansible.builtin.include_tasks: "{{ role_path }}/tasks/ssl/setup_ssl_lets_encrypt_obtain_for_domain.yml"
  26. with_items: "{{ matrix_ssl_domains_to_obtain_certificates_for | unique }}"
  27. loop_control:
  28. loop_var: domain_name
  29. - name: Ensure Let's Encrypt SSL renewal script installed
  30. ansible.builtin.template:
  31. src: "{{ role_path }}/templates/usr-local-bin/matrix-ssl-lets-encrypt-certificates-renew.j2"
  32. dest: "{{ matrix_local_bin_path }}/matrix-ssl-lets-encrypt-certificates-renew"
  33. mode: 0755
  34. - name: Ensure SSL renewal systemd units installed
  35. ansible.builtin.template:
  36. src: "{{ role_path }}/templates/systemd/{{ item.name }}.j2"
  37. dest: "{{ matrix_systemd_path }}/{{ item.name }}"
  38. mode: 0644
  39. when: "item.applicable | bool"
  40. with_items: "{{ matrix_ssl_renewal_systemd_units_list }}"
  41. #
  42. # Tasks related to getting rid of Let's Encrypt's management of certificates
  43. #
  44. - when: "matrix_ssl_retrieval_method != 'lets-encrypt'"
  45. block:
  46. - name: Ensure matrix-ssl-lets-encrypt-renew cronjob removed
  47. ansible.builtin.file:
  48. path: "{{ matrix_systemd_path }}/{{ item.name }}"
  49. state: absent
  50. when: "not item.applicable | bool"
  51. with_items: "{{ matrix_ssl_renewal_systemd_units_list }}"
  52. - name: Ensure Let's Encrypt SSL renewal script removed
  53. ansible.builtin.file:
  54. path: "{{ matrix_local_bin_path }}/matrix-ssl-lets-encrypt-certificates-renew"
  55. state: absent