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
|
|
|
|
|
|
|
- name: Ensure acmetool Docker image is pulled
|
|
|
|
docker_image:
|
|
|
|
name: willwill/acme-docker
|
|
|
|
|
|
|
|
- name: Ensure SSL certificates path exists
|
|
|
|
file:
|
2017-09-11 20:50:14 +00:00
|
|
|
path: "{{ matrix_ssl_certs_path }}"
|
2017-07-31 20:07:30 +00:00
|
|
|
state: directory
|
|
|
|
mode: 0770
|
|
|
|
owner: "{{ matrix_user_username }}"
|
|
|
|
group: "{{ matrix_user_username }}"
|
|
|
|
|
2017-08-06 15:40:16 +00:00
|
|
|
- name: Check matrix-nginx-proxy state
|
|
|
|
service: name=matrix-nginx-proxy
|
|
|
|
register: matrix_nginx_proxy_state
|
|
|
|
|
|
|
|
- name: Ensure matrix-nginx-proxy is stopped (if previously installed & started)
|
|
|
|
service: name=matrix-nginx-proxy state=stopped
|
2017-08-08 11:31:01 +00:00
|
|
|
when: "matrix_nginx_proxy_state.status.ActiveState|default('missing') == 'active'"
|
2017-08-06 15:40:16 +00:00
|
|
|
|
2017-07-31 20:07:30 +00:00
|
|
|
- name: Ensure SSL certificates are marked as wanted in acmetool
|
|
|
|
shell: >-
|
|
|
|
/usr/bin/docker run --rm --name acmetool-host-grab -p 80:80
|
2017-09-11 20:50:14 +00:00
|
|
|
-v {{ matrix_ssl_certs_path }}:/certs
|
|
|
|
-e ACME_EMAIL={{ matrix_ssl_support_email }}
|
2017-07-31 20:07:30 +00:00
|
|
|
willwill/acme-docker
|
2017-09-11 20:50:14 +00:00
|
|
|
acmetool want {{ item }} --xlog.severity=debug
|
|
|
|
with_items:
|
|
|
|
- "{{ hostname_matrix }}"
|
|
|
|
- "{{ hostname_riot }}"
|
2017-07-31 20:07:30 +00:00
|
|
|
|
2017-08-06 15:40:16 +00:00
|
|
|
- name: Ensure matrix-nginx-proxy is started (if previously installed & started)
|
|
|
|
service: name=matrix-nginx-proxy state=started
|
2017-08-08 11:31:01 +00:00
|
|
|
when: "matrix_nginx_proxy_state.status.ActiveState|default('missing') == 'active'"
|
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
|