Fix synapse-admin uninstallation

This commit is contained in:
Slavi Pantaleev 2020-07-26 18:09:29 +03:00
parent 3f8e5b4363
commit ae002d8ae4

View File

@ -12,7 +12,7 @@
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_synapse_admin_docker_image_force_pull }}" force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_synapse_admin_docker_image_force_pull }}"
when: matrix_synapse_admin_enabled|bool when: matrix_synapse_admin_enabled|bool
- name: Ensure matrix-matrix-synapse-admin.service installed - name: Ensure matrix-synapse-admin.service installed
template: template:
src: "{{ role_path }}/templates/systemd/matrix-synapse-admin.service.j2" src: "{{ role_path }}/templates/systemd/matrix-synapse-admin.service.j2"
dest: "{{ matrix_systemd_path }}/matrix-synapse-admin.service" dest: "{{ matrix_systemd_path }}/matrix-synapse-admin.service"
@ -20,7 +20,7 @@
register: matrix_synapse_admin_systemd_service_result register: matrix_synapse_admin_systemd_service_result
when: matrix_synapse_admin_enabled|bool when: matrix_synapse_admin_enabled|bool
- name: Ensure systemd reloaded after matrix-matrix-synapse-admin.service installation - name: Ensure systemd reloaded after matrix-synapse-admin.service installation
service: service:
daemon_reload: yes daemon_reload: yes
when: "matrix_synapse_admin_enabled|bool and matrix_synapse_admin_systemd_service_result.changed" when: "matrix_synapse_admin_enabled|bool and matrix_synapse_admin_systemd_service_result.changed"
@ -29,26 +29,26 @@
# Tasks related to getting rid of matrix-synapse-admin (if it was previously enabled) # Tasks related to getting rid of matrix-synapse-admin (if it was previously enabled)
# #
- name: Check existence of matrix-matrix-synapse-admin service - name: Check existence of matrix-synapse-admin service
stat: stat:
path: "{{ matrix_systemd_path }}/matrix-matrix-synapse-admin.service" path: "{{ matrix_systemd_path }}/matrix-synapse-admin.service"
register: matrix_synapse_admin_service_stat register: matrix_synapse_admin_service_stat
- name: Ensure matrix-matrix-synapse-admin is stopped - name: Ensure matrix-synapse-admin is stopped
service: service:
name: matrix-matrix-synapse-admin name: matrix-synapse-admin
state: stopped state: stopped
daemon_reload: yes daemon_reload: yes
register: stopping_result register: stopping_result
when: "not matrix_synapse_admin_enabled|bool and matrix_synapse_admin_service_stat.stat.exists" when: "not matrix_synapse_admin_enabled|bool and matrix_synapse_admin_service_stat.stat.exists"
- name: Ensure matrix-matrix-synapse-admin.service doesn't exist - name: Ensure matrix-synapse-admin.service doesn't exist
file: file:
path: "{{ matrix_systemd_path }}/matrix-matrix-synapse-admin.service" path: "{{ matrix_systemd_path }}/matrix-synapse-admin.service"
state: absent state: absent
when: "not matrix_synapse_admin_enabled|bool and matrix_synapse_admin_service_stat.stat.exists" when: "not matrix_synapse_admin_enabled|bool and matrix_synapse_admin_service_stat.stat.exists"
- name: Ensure systemd reloaded after matrix-matrix-synapse-admin.service removal - name: Ensure systemd reloaded after matrix-synapse-admin.service removal
service: service:
daemon_reload: yes daemon_reload: yes
when: "not matrix_synapse_admin_enabled|bool and matrix_synapse_admin_service_stat.stat.exists" when: "not matrix_synapse_admin_enabled|bool and matrix_synapse_admin_service_stat.stat.exists"