51312b8250
As suggested in #63 (Github issue), splitting the playbook's logic into multiple roles will be beneficial for maintainability. This patch realizes this split. Still, some components affect others, so the roles are not really independent of one another. For example: - disabling mxisd (`matrix_mxisd_enabled: false`), causes Synapse and riot-web to reconfigure themselves with other (public) Identity servers. - enabling matrix-corporal (`matrix_corporal_enabled: true`) affects how reverse-proxying (by `matrix-nginx-proxy`) is done, in order to put matrix-corporal's gateway server in front of Synapse We may be able to move away from such dependencies in the future, at the expense of a more complicated manual configuration, but it's probably not worth sacrificing the convenience we have now. As part of this work, the way we do "start components" has been redone now to use a loop, as suggested in #65 (Github issue). This should make restarting faster and more reliable.
74 lines
2.1 KiB
YAML
74 lines
2.1 KiB
YAML
---
|
|
|
|
#
|
|
# Tasks related to setting up riot-web
|
|
#
|
|
|
|
- name: Ensure Matrix riot-web path exists
|
|
file:
|
|
path: "{{ matrix_riot_web_data_path }}"
|
|
state: directory
|
|
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: "{{ matrix_riot_web_docker_image }}"
|
|
when: matrix_riot_web_enabled
|
|
|
|
- name: Ensure Matrix riot-web configured
|
|
template:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ matrix_riot_web_data_path }}/{{ item.name }}"
|
|
mode: 0644
|
|
owner: "{{ matrix_user_username }}"
|
|
group: "{{ matrix_user_username }}"
|
|
with_items:
|
|
- {src: "{{ role_path }}/templates/config.json.j2", name: "config.json"}
|
|
- {src: "{{ matrix_riot_web_homepage_template }}", name: "home.html"}
|
|
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
|
|
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_riot_web_data_path }}"
|
|
state: absent
|
|
when: "not matrix_riot_web_enabled"
|
|
|
|
- name: Ensure riot-web Docker image doesn't exist
|
|
docker_image:
|
|
name: "{{ matrix_riot_web_docker_image }}"
|
|
state: absent
|
|
when: "not matrix_riot_web_enabled"
|