matrix-docker-ansible-deploy/roles/matrix-synapse/tasks/synapse/setup_uninstall.yml
Slavi Pantaleev 881fdd28f0 Add support for Synapse container image customization
This allows people to augment the Synapse image with custom tools and
addons without having to rebuild it from scratch.

If customizations are enabled, the playbook will build a new
`localhost/matrixdotorg/synapse:VERSION-customized` image
on top of the default one (`FROM matrixdotorg/synapse:VERSION`)
and with custom Dockerfile build steps.

For servers that self-build the Synapse image, the Synapse image will be
built first, before proceding to extend it the same way.

In the future, we'll also have easy to enable Dockerfile build steps
for modules that the playbook supports.
2022-10-14 16:37:54 +03:00

41 lines
1.2 KiB
YAML

---
- name: Check existence of matrix-synapse service
ansible.builtin.stat:
path: "{{ matrix_systemd_path }}/matrix-synapse.service"
register: matrix_synapse_service_stat
- name: Ensure matrix-synapse is stopped
ansible.builtin.service:
name: matrix-synapse
state: stopped
enabled: false
daemon_reload: true
register: stopping_result
when: "matrix_synapse_service_stat.stat.exists"
- name: Ensure matrix-synapse.service doesn't exist
ansible.builtin.file:
path: "{{ matrix_systemd_path }}/matrix-synapse.service"
state: absent
when: "matrix_synapse_service_stat.stat.exists"
- name: Ensure systemd reloaded after matrix-synapse.service removal
ansible.builtin.service:
daemon_reload: true
when: "matrix_synapse_service_stat.stat.exists"
- name: Ensure Synapse Docker image doesn't exist
docker_image:
name: "{{ item }}"
state: absent
with_items:
- "{{ matrix_synapse_docker_image_final }}"
- "{{ matrix_synapse_docker_image }}"
- name: Ensure sample prometheus.yml for external scraping is deleted
ansible.builtin.file:
path: "{{ matrix_synapse_base_path }}/external_prometheus.yml.example"
state: absent
when: "not matrix_synapse_metrics_proxying_enabled | bool"