Separate matrix-ma1sd install/uninstall tasks
This commit is contained in:
parent
7248eb3c11
commit
0ca48f3532
@ -8,7 +8,14 @@
|
|||||||
- setup-all
|
- setup-all
|
||||||
- setup-ma1sd
|
- setup-ma1sd
|
||||||
|
|
||||||
- import_tasks: "{{ role_path }}/tasks/setup_ma1sd.yml"
|
- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
|
||||||
|
when: "run_setup|bool and matrix_ma1sd_enabled|bool"
|
||||||
|
tags:
|
||||||
|
- setup-all
|
||||||
|
- setup-ma1sd
|
||||||
|
|
||||||
|
- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
|
||||||
|
when: "run_setup|bool and not matrix_ma1sd_enabled|bool"
|
||||||
tags:
|
tags:
|
||||||
- setup-all
|
- setup-all
|
||||||
- setup-ma1sd
|
- setup-ma1sd
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
#
|
|
||||||
# Tasks related to setting up ma1sd
|
|
||||||
#
|
|
||||||
|
|
||||||
- name: Ensure ma1sd paths exist
|
- name: Ensure ma1sd paths exist
|
||||||
file:
|
file:
|
||||||
path: "{{ item.path }}"
|
path: "{{ item.path }}"
|
||||||
@ -15,10 +11,9 @@
|
|||||||
- { path: "{{ matrix_ma1sd_config_path }}", when: true }
|
- { path: "{{ matrix_ma1sd_config_path }}", when: true }
|
||||||
- { path: "{{ matrix_ma1sd_data_path }}", when: true }
|
- { path: "{{ matrix_ma1sd_data_path }}", when: true }
|
||||||
- { path: "{{ matrix_ma1sd_docker_src_files_path }}", when: "{{ matrix_ma1sd_container_image_self_build }}"}
|
- { path: "{{ matrix_ma1sd_docker_src_files_path }}", when: "{{ matrix_ma1sd_container_image_self_build }}"}
|
||||||
when: matrix_ma1sd_enabled|bool and item.when
|
when: "item.when|bool"
|
||||||
|
|
||||||
- import_tasks: "{{ role_path }}/tasks/migrate_mxisd.yml"
|
- import_tasks: "{{ role_path }}/tasks/migrate_mxisd.yml"
|
||||||
when: matrix_ma1sd_enabled|bool
|
|
||||||
|
|
||||||
- name: Ensure ma1sd image is pulled
|
- name: Ensure ma1sd image is pulled
|
||||||
docker_image:
|
docker_image:
|
||||||
@ -26,7 +21,7 @@
|
|||||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||||
force_source: "{{ matrix_ma1sd_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
force_source: "{{ matrix_ma1sd_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_ma1sd_docker_image_force_pull }}"
|
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_ma1sd_docker_image_force_pull }}"
|
||||||
when: matrix_ma1sd_enabled|bool and not matrix_ma1sd_container_image_self_build
|
when: "not matrix_ma1sd_container_image_self_build|bool"
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Ensure gradle is installed for self-building (Debian)
|
- name: Ensure gradle is installed for self-building (Debian)
|
||||||
@ -72,7 +67,7 @@
|
|||||||
repository: "{{ matrix_ma1sd_docker_image }}"
|
repository: "{{ matrix_ma1sd_docker_image }}"
|
||||||
force_tag: yes
|
force_tag: yes
|
||||||
source: local
|
source: local
|
||||||
when: "matrix_ma1sd_enabled|bool and matrix_ma1sd_container_image_self_build"
|
when: "matrix_ma1sd_container_image_self_build|bool"
|
||||||
|
|
||||||
- name: Ensure ma1sd config installed
|
- name: Ensure ma1sd config installed
|
||||||
copy:
|
copy:
|
||||||
@ -81,7 +76,6 @@
|
|||||||
mode: 0644
|
mode: 0644
|
||||||
owner: "{{ matrix_user_username }}"
|
owner: "{{ matrix_user_username }}"
|
||||||
group: "{{ matrix_user_groupname }}"
|
group: "{{ matrix_user_groupname }}"
|
||||||
when: matrix_ma1sd_enabled|bool
|
|
||||||
|
|
||||||
- name: Ensure custom templates are installed if any
|
- name: Ensure custom templates are installed if any
|
||||||
copy:
|
copy:
|
||||||
@ -95,7 +89,7 @@
|
|||||||
- {value: "{{ matrix_ma1sd_threepid_medium_email_custom_session_validation_template }}", location: 'validate-template.eml'}
|
- {value: "{{ matrix_ma1sd_threepid_medium_email_custom_session_validation_template }}", location: 'validate-template.eml'}
|
||||||
- {value: "{{ matrix_ma1sd_threepid_medium_email_custom_unbind_fraudulent_template }}", location: 'unbind-fraudulent.eml'}
|
- {value: "{{ matrix_ma1sd_threepid_medium_email_custom_unbind_fraudulent_template }}", location: 'unbind-fraudulent.eml'}
|
||||||
- {value: "{{ matrix_ma1sd_threepid_medium_email_custom_matrixid_template }}", location: 'mxid-template.eml'}
|
- {value: "{{ matrix_ma1sd_threepid_medium_email_custom_matrixid_template }}", location: 'mxid-template.eml'}
|
||||||
when: "matrix_ma1sd_enabled|bool and matrix_ma1sd_threepid_medium_email_custom_templates_enabled|bool and item.value"
|
when: "matrix_ma1sd_threepid_medium_email_custom_templates_enabled|bool and item.value"
|
||||||
|
|
||||||
- name: Ensure matrix-ma1sd.service installed
|
- name: Ensure matrix-ma1sd.service installed
|
||||||
template:
|
template:
|
||||||
@ -103,49 +97,8 @@
|
|||||||
dest: "{{ matrix_systemd_path }}/matrix-ma1sd.service"
|
dest: "{{ matrix_systemd_path }}/matrix-ma1sd.service"
|
||||||
mode: 0644
|
mode: 0644
|
||||||
register: matrix_ma1sd_systemd_service_result
|
register: matrix_ma1sd_systemd_service_result
|
||||||
when: matrix_ma1sd_enabled|bool
|
|
||||||
|
|
||||||
- name: Ensure systemd reloaded after matrix-ma1sd.service installation
|
- name: Ensure systemd reloaded after matrix-ma1sd.service installation
|
||||||
service:
|
service:
|
||||||
daemon_reload: yes
|
daemon_reload: yes
|
||||||
when: "matrix_ma1sd_enabled|bool and matrix_ma1sd_systemd_service_result.changed"
|
when: "matrix_ma1sd_systemd_service_result.changed|bool"
|
||||||
|
|
||||||
#
|
|
||||||
# Tasks related to getting rid of ma1sd (if it was previously enabled)
|
|
||||||
#
|
|
||||||
|
|
||||||
- name: Check existence of matrix-ma1sd service
|
|
||||||
stat:
|
|
||||||
path: "{{ matrix_systemd_path }}/matrix-ma1sd.service"
|
|
||||||
register: matrix_ma1sd_service_stat
|
|
||||||
|
|
||||||
- name: Ensure matrix-ma1sd is stopped
|
|
||||||
service:
|
|
||||||
name: matrix-ma1sd
|
|
||||||
state: stopped
|
|
||||||
daemon_reload: yes
|
|
||||||
register: stopping_result
|
|
||||||
when: "not matrix_ma1sd_enabled|bool and matrix_ma1sd_service_stat.stat.exists"
|
|
||||||
|
|
||||||
- name: Ensure matrix-ma1sd.service doesn't exist
|
|
||||||
file:
|
|
||||||
path: "{{ matrix_systemd_path }}/matrix-ma1sd.service"
|
|
||||||
state: absent
|
|
||||||
when: "not matrix_ma1sd_enabled|bool and matrix_ma1sd_service_stat.stat.exists"
|
|
||||||
|
|
||||||
- name: Ensure systemd reloaded after matrix-ma1sd.service removal
|
|
||||||
service:
|
|
||||||
daemon_reload: yes
|
|
||||||
when: "not matrix_ma1sd_enabled|bool and matrix_ma1sd_service_stat.stat.exists"
|
|
||||||
|
|
||||||
- name: Ensure Matrix ma1sd paths don't exist
|
|
||||||
file:
|
|
||||||
path: "{{ matrix_ma1sd_base_path }}"
|
|
||||||
state: absent
|
|
||||||
when: "not matrix_ma1sd_enabled|bool"
|
|
||||||
|
|
||||||
- name: Ensure ma1sd Docker image doesn't exist
|
|
||||||
docker_image:
|
|
||||||
name: "{{ matrix_ma1sd_docker_image }}"
|
|
||||||
state: absent
|
|
||||||
when: "not matrix_ma1sd_enabled|bool"
|
|
35
roles/matrix-ma1sd/tasks/setup_uninstall.yml
Normal file
35
roles/matrix-ma1sd/tasks/setup_uninstall.yml
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: Check existence of matrix-ma1sd service
|
||||||
|
stat:
|
||||||
|
path: "{{ matrix_systemd_path }}/matrix-ma1sd.service"
|
||||||
|
register: matrix_ma1sd_service_stat
|
||||||
|
|
||||||
|
- name: Ensure matrix-ma1sd is stopped
|
||||||
|
service:
|
||||||
|
name: matrix-ma1sd
|
||||||
|
state: stopped
|
||||||
|
daemon_reload: yes
|
||||||
|
register: stopping_result
|
||||||
|
when: "matrix_ma1sd_service_stat.stat.exists|bool"
|
||||||
|
|
||||||
|
- name: Ensure matrix-ma1sd.service doesn't exist
|
||||||
|
file:
|
||||||
|
path: "{{ matrix_systemd_path }}/matrix-ma1sd.service"
|
||||||
|
state: absent
|
||||||
|
when: "matrix_ma1sd_service_stat.stat.exists|bool"
|
||||||
|
|
||||||
|
- name: Ensure systemd reloaded after matrix-ma1sd.service removal
|
||||||
|
service:
|
||||||
|
daemon_reload: yes
|
||||||
|
when: "matrix_ma1sd_service_stat.stat.exists|bool"
|
||||||
|
|
||||||
|
- name: Ensure Matrix ma1sd paths don't exist
|
||||||
|
file:
|
||||||
|
path: "{{ matrix_ma1sd_base_path }}"
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Ensure ma1sd Docker image doesn't exist
|
||||||
|
docker_image:
|
||||||
|
name: "{{ matrix_ma1sd_docker_image }}"
|
||||||
|
state: absent
|
Loading…
Reference in New Issue
Block a user