Add support for not taking over a server (no matrix-nginx-proxy) and disabling Riot
This commit is contained in:
@ -1,5 +1,15 @@
|
||||
---
|
||||
|
||||
#
|
||||
# Generic tasks that we always want to happen, regardless
|
||||
# if the user wants matrix-nginx-proxy or not.
|
||||
#
|
||||
# If the user would set up their own nginx proxy server,
|
||||
# the config files from matrix-nginx-proxy can be reused.
|
||||
#
|
||||
# It doesn't hurt to put them in place, even if they turn out
|
||||
# to be unnecessary.
|
||||
#
|
||||
- name: Ensure Matrix nginx-proxy paths exists
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
@ -11,10 +21,6 @@
|
||||
- "{{ matrix_nginx_proxy_data_path }}"
|
||||
- "{{ matrix_nginx_proxy_confd_path }}"
|
||||
|
||||
- name: Ensure nginx Docker image is pulled
|
||||
docker_image:
|
||||
name: "{{ docker_nginx_image }}"
|
||||
|
||||
- name: Ensure Matrix Synapse proxy vhost configured
|
||||
template:
|
||||
src: "{{ role_path }}/templates/nginx-conf.d/{{ item }}.j2"
|
||||
@ -24,6 +30,14 @@
|
||||
- "matrix-synapse.conf"
|
||||
- "matrix-riot-web.conf"
|
||||
|
||||
#
|
||||
# Tasks related to setting up matrix-nginx-proxy
|
||||
#
|
||||
- name: Ensure nginx Docker image is pulled
|
||||
docker_image:
|
||||
name: "{{ docker_nginx_image }}"
|
||||
when: matrix_nginx_proxy_enabled
|
||||
|
||||
- name: Allow access to nginx proxy ports in firewalld
|
||||
firewalld:
|
||||
service: "{{ item }}"
|
||||
@ -33,10 +47,30 @@
|
||||
with_items:
|
||||
- "http"
|
||||
- "https"
|
||||
when: ansible_os_family == 'RedHat'
|
||||
when: "ansible_os_family == 'RedHat' and matrix_nginx_proxy_enabled"
|
||||
|
||||
- name: Ensure matrix-nginx-proxy.service installed
|
||||
template:
|
||||
src: "{{ role_path }}/templates/systemd/matrix-nginx-proxy.service.j2"
|
||||
dest: "/etc/systemd/system/matrix-nginx-proxy.service"
|
||||
mode: 0644
|
||||
when: matrix_nginx_proxy_enabled
|
||||
|
||||
#
|
||||
# Tasks related to getting rid of matrix-nginx-proxy (if it was previously enabled)
|
||||
#
|
||||
|
||||
- name: Check existence of matrix-nginx-proxy service
|
||||
stat: path="/etc/systemd/system/matrix-nginx-proxy.service"
|
||||
register: matrix_nginx_proxy_service_stat
|
||||
|
||||
- name: Ensure matrix-nginx-proxy is stopped
|
||||
service: name=matrix-nginx-proxy state=stopped daemon_reload=yes
|
||||
register: stopping_result
|
||||
when: "not matrix_nginx_proxy_enabled and matrix_nginx_proxy_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure matrix-nginx-proxy.service doesn't exist
|
||||
file:
|
||||
path: "/etc/systemd/system/matrix-nginx-proxy.service"
|
||||
state: absent
|
||||
when: "not matrix_nginx_proxy_enabled and matrix_nginx_proxy_service_stat.stat.exists"
|
||||
|
@ -1,5 +1,9 @@
|
||||
---
|
||||
|
||||
#
|
||||
# Tasks related to setting up riot-web
|
||||
#
|
||||
|
||||
- name: Ensure Matrix riot-web paths exists
|
||||
file:
|
||||
path: "{{ matrix_nginx_riot_web_data_path }}"
|
||||
@ -7,10 +11,12 @@
|
||||
mode: 0750
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_username }}"
|
||||
when: matrix_riot_web_enabled
|
||||
|
||||
- name: Ensure riot-web Docker image is pulled
|
||||
docker_image:
|
||||
name: "{{ docker_riot_image }}"
|
||||
when: matrix_riot_web_enabled
|
||||
|
||||
- name: Ensure Matrix riot-web configured
|
||||
template:
|
||||
@ -22,9 +28,42 @@
|
||||
with_items:
|
||||
- "riot.im.conf"
|
||||
- "config.json"
|
||||
when: matrix_riot_web_enabled
|
||||
|
||||
- name: Ensure matrix-riot-web.service installed
|
||||
template:
|
||||
src: "{{ role_path }}/templates/systemd/matrix-riot-web.service.j2"
|
||||
dest: "/etc/systemd/system/matrix-riot-web.service"
|
||||
mode: 0644
|
||||
mode: 0644
|
||||
when: matrix_riot_web_enabled
|
||||
|
||||
#
|
||||
# Tasks related to getting rid of riot-web (if it was previously enabled)
|
||||
#
|
||||
|
||||
- name: Check existence of matrix-riot-web service
|
||||
stat: path="/etc/systemd/system/matrix-riot-web.service"
|
||||
register: matrix_riot_web_service_stat
|
||||
|
||||
- name: Ensure matrix-riot-web is stopped
|
||||
service: name=matrix-riot-web state=stopped daemon_reload=yes
|
||||
register: stopping_result
|
||||
when: "not matrix_riot_web_enabled and matrix_riot_web_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure matrix-riot-web.service doesn't exist
|
||||
file:
|
||||
path: "/etc/systemd/system/matrix-riot-web.service"
|
||||
state: absent
|
||||
when: "not matrix_riot_web_enabled and matrix_riot_web_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure Matrix riot-web paths doesn't exist
|
||||
file:
|
||||
path: "{{ matrix_nginx_riot_web_data_path }}"
|
||||
state: absent
|
||||
when: "not matrix_riot_web_enabled"
|
||||
|
||||
- name: Ensure riot-web Docker image doesn't exist
|
||||
docker_image:
|
||||
name: "{{ docker_riot_image }}"
|
||||
state: absent
|
||||
when: "not matrix_riot_web_enabled"
|
||||
|
@ -1,5 +1,14 @@
|
||||
---
|
||||
|
||||
- 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
|
||||
|
||||
- name: Allow access to HTTP/HTTPS in firewalld
|
||||
firewalld:
|
||||
service: "{{ item }}"
|
||||
@ -38,9 +47,7 @@
|
||||
-e ACME_EMAIL={{ matrix_ssl_support_email }}
|
||||
willwill/acme-docker
|
||||
acmetool want {{ item }} --xlog.severity=debug
|
||||
with_items:
|
||||
- "{{ hostname_matrix }}"
|
||||
- "{{ hostname_riot }}"
|
||||
with_items: "{{ domains_to_obtain_certificate_for }}"
|
||||
|
||||
- name: Ensure matrix-nginx-proxy is started (if previously installed & started)
|
||||
service: name=matrix-nginx-proxy state=started
|
||||
|
@ -13,6 +13,8 @@
|
||||
|
||||
- name: Ensure matrix-riot-web autoruns and is restarted
|
||||
service: name=matrix-riot-web enabled=yes state=restarted daemon_reload=yes
|
||||
when: matrix_riot_web_enabled
|
||||
|
||||
- name: Ensure matrix-nginx-proxy autoruns and is restarted
|
||||
service: name=matrix-nginx-proxy enabled=yes state=restarted daemon_reload=yes
|
||||
when: matrix_nginx_proxy_enabled
|
||||
|
Reference in New Issue
Block a user