mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2024-12-12 08:43:55 +02:00
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.
69 lines
1.8 KiB
YAML
69 lines
1.8 KiB
YAML
---
|
|
|
|
#
|
|
# Tasks related to setting up the mailer
|
|
#
|
|
|
|
- name: Ensure mailer base path exists
|
|
file:
|
|
path: "{{ matrix_mailer_base_path }}"
|
|
state: directory
|
|
mode: 0750
|
|
owner: "{{ matrix_user_username }}"
|
|
group: "{{ matrix_user_username }}"
|
|
when: matrix_mailer_enabled
|
|
|
|
- name: Ensure mailer environment variables file created
|
|
template:
|
|
src: "{{ role_path }}/templates/env-mailer.j2"
|
|
dest: "{{ matrix_mailer_base_path }}/env-mailer"
|
|
mode: 0640
|
|
when: matrix_mailer_enabled
|
|
|
|
- name: Ensure mailer image is pulled
|
|
docker_image:
|
|
name: "{{ matrix_mailer_docker_image }}"
|
|
when: matrix_mailer_enabled
|
|
|
|
- name: Ensure matrix-mailer.service installed
|
|
template:
|
|
src: "{{ role_path }}/templates/systemd/matrix-mailer.service.j2"
|
|
dest: "/etc/systemd/system/matrix-mailer.service"
|
|
mode: 0644
|
|
when: matrix_mailer_enabled
|
|
|
|
#
|
|
# Tasks related to getting rid of the mailer (if it was previously enabled)
|
|
#
|
|
|
|
- name: Check existence of matrix-mailer service
|
|
stat:
|
|
path: "/etc/systemd/system/matrix-mailer.service"
|
|
register: matrix_mailer_service_stat
|
|
|
|
- name: Ensure matrix-mailer is stopped
|
|
service:
|
|
name: matrix-mailer
|
|
state: stopped
|
|
daemon_reload: yes
|
|
register: stopping_result
|
|
when: "not matrix_mailer_enabled and matrix_mailer_service_stat.stat.exists"
|
|
|
|
- name: Ensure matrix-mailer.service doesn't exist
|
|
file:
|
|
path: "/etc/systemd/system/matrix-mailer.service"
|
|
state: absent
|
|
when: "not matrix_mailer_enabled and matrix_mailer_service_stat.stat.exists"
|
|
|
|
- name: Ensure Matrix mailer environment variables path doesn't exist
|
|
file:
|
|
path: "{{ matrix_mailer_base_path }}"
|
|
state: absent
|
|
when: "not matrix_mailer_enabled"
|
|
|
|
- name: Ensure mailer Docker image doesn't exist
|
|
docker_image:
|
|
name: "{{ matrix_mailer_docker_image }}"
|
|
state: absent
|
|
when: "not matrix_mailer_enabled"
|