2018-12-23 11:00:12 +02:00
|
|
|
---
|
|
|
|
|
2019-01-08 12:24:59 +02:00
|
|
|
# This is a cleanup/migration task, because of to the new way we manage cronjobs (`cron` module) and the new script name.
|
|
|
|
# This migration task can be removed some time in the future.
|
|
|
|
- name: (Migration) Remove deprecated Let's Encrypt SSL certificate management files
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: absent
|
|
|
|
with_items:
|
2020-03-24 20:27:58 +02:00
|
|
|
- "{{ matrix_local_bin_path }}/matrix-ssl-certificates-renew"
|
|
|
|
- "{{ matrix_cron_path }}/matrix-ssl-certificate-renewal"
|
|
|
|
- "{{ matrix_cron_path }}/matrix-nginx-proxy-periodic-restarter"
|
2019-01-08 12:24:59 +02:00
|
|
|
|
2018-12-23 11:00:12 +02:00
|
|
|
#
|
|
|
|
# Tasks related to setting up Let's Encrypt's management of certificates
|
|
|
|
#
|
|
|
|
|
|
|
|
- name: Ensure certbot Docker image is pulled
|
|
|
|
docker_image:
|
|
|
|
name: "{{ matrix_ssl_lets_encrypt_certbot_docker_image }}"
|
2019-05-22 12:43:33 +02:00
|
|
|
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
2019-06-10 13:23:51 +02:00
|
|
|
force_source: "{{ matrix_ssl_lets_encrypt_certbot_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
|
|
|
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_ssl_lets_encrypt_certbot_docker_image_force_pull }}"
|
2018-12-23 11:00:12 +02:00
|
|
|
when: "matrix_ssl_retrieval_method == 'lets-encrypt'"
|
|
|
|
|
2018-12-24 09:39:27 +02:00
|
|
|
- name: Obtain Let's Encrypt certificates
|
2019-01-12 17:53:00 +02:00
|
|
|
include_tasks: "{{ role_path }}/tasks/ssl/setup_ssl_lets_encrypt_obtain_for_domain.yml"
|
2019-01-16 18:05:48 +02:00
|
|
|
with_items: "{{ matrix_ssl_domains_to_obtain_certificates_for }}"
|
2018-12-23 11:00:12 +02:00
|
|
|
loop_control:
|
|
|
|
loop_var: domain_name
|
|
|
|
when: "matrix_ssl_retrieval_method == 'lets-encrypt'"
|
|
|
|
|
2019-01-08 12:24:59 +02:00
|
|
|
- name: Ensure Let's Encrypt SSL renewal script installed
|
2018-12-23 11:00:12 +02:00
|
|
|
template:
|
2019-01-08 12:24:59 +02:00
|
|
|
src: "{{ role_path }}/templates/usr-local-bin/matrix-ssl-lets-encrypt-certificates-renew.j2"
|
2020-03-24 20:27:58 +02:00
|
|
|
dest: "{{ matrix_local_bin_path }}/matrix-ssl-lets-encrypt-certificates-renew"
|
2018-12-23 11:00:12 +02:00
|
|
|
mode: 0750
|
|
|
|
when: "matrix_ssl_retrieval_method == 'lets-encrypt'"
|
|
|
|
|
2020-09-06 09:49:19 +02:00
|
|
|
- name: Ensure periodic SSL renewal cronjob configured
|
|
|
|
template:
|
|
|
|
src: "{{ role_path }}/templates/cron.d/matrix-ssl-lets-encrypt.j2"
|
|
|
|
dest: /etc/cron.d/matrix-ssl-lets-encrypt
|
|
|
|
mode: 0644
|
2018-12-23 11:00:12 +02:00
|
|
|
when: "matrix_ssl_retrieval_method == 'lets-encrypt'"
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Tasks related to getting rid of Let's Encrypt's management of certificates
|
|
|
|
#
|
|
|
|
|
2019-01-08 12:24:59 +02:00
|
|
|
- name: Ensure matrix-ssl-lets-encrypt-renew cronjob removed
|
2020-09-06 09:49:19 +02:00
|
|
|
file:
|
|
|
|
path: /etc/cron.d/matrix-ssl-lets-encrypt
|
2018-12-23 11:00:12 +02:00
|
|
|
state: absent
|
|
|
|
when: "matrix_ssl_retrieval_method != 'lets-encrypt'"
|
2019-01-08 12:24:59 +02:00
|
|
|
|
|
|
|
- name: Ensure Let's Encrypt SSL renewal script removed
|
|
|
|
file:
|
2020-03-24 20:27:58 +02:00
|
|
|
path: "{{ matrix_local_bin_path }}/matrix-ssl-lets-encrypt-certificates-renew"
|
2019-01-08 12:24:59 +02:00
|
|
|
state: absent
|
2019-02-28 11:51:09 +02:00
|
|
|
when: "matrix_ssl_retrieval_method != 'lets-encrypt'"
|