2017-07-31 20:07:30 +00:00
|
|
|
---
|
|
|
|
|
2017-09-12 09:41:44 +00:00
|
|
|
- name: Determine domains to obtain certificates for (Matrix)
|
|
|
|
set_fact:
|
|
|
|
domains_to_obtain_certificate_for: "['{{ hostname_matrix }}']"
|
|
|
|
|
|
|
|
- name: Determine domains to obtain certificates for (Riot)
|
|
|
|
set_fact:
|
|
|
|
domains_to_obtain_certificate_for: "{{ domains_to_obtain_certificate_for + [hostname_riot] }}"
|
|
|
|
when: matrix_riot_web_enabled
|
|
|
|
|
2017-07-31 20:07:30 +00:00
|
|
|
- name: Allow access to HTTP/HTTPS in firewalld
|
|
|
|
firewalld:
|
|
|
|
service: "{{ item }}"
|
|
|
|
state: enabled
|
|
|
|
immediate: yes
|
|
|
|
permanent: yes
|
|
|
|
with_items:
|
|
|
|
- http
|
|
|
|
- https
|
2017-09-11 20:24:05 +00:00
|
|
|
when: ansible_os_family == 'RedHat'
|
2017-07-31 20:07:30 +00:00
|
|
|
|
2018-08-29 06:37:44 +00:00
|
|
|
- name: Ensure certbot Docker image is pulled
|
2017-07-31 20:07:30 +00:00
|
|
|
docker_image:
|
2018-08-29 06:37:44 +00:00
|
|
|
name: "{{ matrix_ssl_certbot_docker_image }}"
|
2017-07-31 20:07:30 +00:00
|
|
|
|
2018-08-29 06:37:44 +00:00
|
|
|
- name: Ensure SSL certificate paths exists
|
2017-07-31 20:07:30 +00:00
|
|
|
file:
|
2018-08-29 06:37:44 +00:00
|
|
|
path: "{{ item }}"
|
2017-07-31 20:07:30 +00:00
|
|
|
state: directory
|
2018-08-29 06:37:44 +00:00
|
|
|
mode: 0770
|
2017-07-31 20:07:30 +00:00
|
|
|
owner: "{{ matrix_user_username }}"
|
|
|
|
group: "{{ matrix_user_username }}"
|
2018-08-29 06:37:44 +00:00
|
|
|
with_items:
|
|
|
|
- "{{ matrix_ssl_log_dir_path }}"
|
|
|
|
- "{{ matrix_ssl_config_dir_path }}"
|
2017-07-31 20:07:30 +00:00
|
|
|
|
2018-08-29 06:37:44 +00:00
|
|
|
- name: Obtain initial certificates
|
|
|
|
include_tasks: "setup_ssl_for_domain.yml"
|
2017-09-12 09:41:44 +00:00
|
|
|
with_items: "{{ domains_to_obtain_certificate_for }}"
|
2018-08-29 06:37:44 +00:00
|
|
|
loop_control:
|
|
|
|
loop_var: domain_name
|
2017-07-31 20:07:30 +00:00
|
|
|
|
2018-08-29 06:37:44 +00:00
|
|
|
- name: Ensure SSL renewal script installed
|
|
|
|
template:
|
|
|
|
src: "{{ role_path }}/templates/usr-local-bin/matrix-ssl-certificates-renew.j2"
|
|
|
|
dest: "/usr/local/bin/matrix-ssl-certificates-renew"
|
|
|
|
mode: 0750
|
2017-08-06 15:40:16 +00:00
|
|
|
|
2017-07-31 20:07:30 +00:00
|
|
|
- name: Ensure periodic SSL renewal cronjob configured
|
|
|
|
template:
|
2017-09-11 20:50:14 +00:00
|
|
|
src: "{{ role_path }}/templates/cron.d/matrix-ssl-certificate-renewal.j2"
|
|
|
|
dest: "/etc/cron.d/matrix-ssl-certificate-renewal"
|
2017-07-31 20:07:30 +00:00
|
|
|
mode: 0600
|