matrix-docker-ansible-deploy/roles/matrix-server/tasks/setup_ssl.yml

55 lines
1.5 KiB
YAML
Raw Normal View History

2017-07-31 20:07:30 +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
when: ansible_os_family == 'RedHat'
2017-07-31 20:07:30 +00:00
- name: Ensure certbot Docker image is pulled
2017-07-31 20:07:30 +00:00
docker_image:
name: "{{ matrix_ssl_certbot_docker_image }}"
2017-07-31 20:07:30 +00:00
- name: Ensure SSL certificate paths exists
2017-07-31 20:07:30 +00:00
file:
path: "{{ item }}"
2017-07-31 20:07:30 +00:00
state: directory
mode: 0770
2017-07-31 20:07:30 +00:00
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_username }}"
with_items:
- "{{ matrix_ssl_log_dir_path }}"
- "{{ matrix_ssl_config_dir_path }}"
2017-07-31 20:07:30 +00:00
- name: Obtain initial certificates
include_tasks: "setup_ssl_for_domain.yml"
with_items: "{{ domains_to_obtain_certificate_for }}"
loop_control:
loop_var: domain_name
2017-07-31 20:07:30 +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-07-31 20:07:30 +00:00
- name: Ensure periodic SSL renewal cronjob configured
template:
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