Replace most import_tasks calls with include_tasks for improved performance

This commit is contained in:
Slavi Pantaleev
2022-11-24 11:33:30 +02:00
parent 5c3df22c35
commit 7c2a7a8eb6
115 changed files with 1175 additions and 1654 deletions

View File

@ -1,38 +1,23 @@
---
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml"
when: "run_setup | bool and matrix_client_element_enabled | bool"
- block:
- when: matrix_client_element_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_config.yml"
- when: matrix_client_element_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/prepare_themes.yml"
- when: matrix_client_element_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_install.yml"
- when: not matrix_client_element_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
tags:
- setup-all
- setup-client-element
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/prepare_themes.yml"
when: run_setup | bool
tags:
- setup-all
- setup-client-element
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/migrate_riot_web.yml"
when: run_setup | bool
tags:
- setup-all
- setup-client-element
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml"
when: "run_setup | bool and matrix_client_element_enabled | bool"
tags:
- setup-all
- setup-client-element
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
when: "run_setup | bool and not matrix_client_element_enabled | bool"
tags:
- setup-all
- setup-client-element
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/self_check.yml"
delegate_to: 127.0.0.1
become: false
when: "run_self_check | bool and matrix_client_element_enabled | bool"
- block:
- when: matrix_client_element_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/self_check.yml"
tags:
- self-check

View File

@ -1,37 +0,0 @@
---
- name: Check existence of matrix-riot-web.service
ansible.builtin.stat:
path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-riot-web.service"
register: matrix_client_riot_web_service_stat
when: "matrix_client_element_enabled | bool"
- name: Ensure matrix-riot-web is stopped
ansible.builtin.service:
name: matrix-riot-web
state: stopped
enabled: false
daemon_reload: true
register: stopping_result
when: "matrix_client_element_enabled | bool and matrix_client_riot_web_service_stat.stat.exists"
- name: Ensure matrix-riot-web.service doesn't exist
ansible.builtin.file:
path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-riot-web.service"
state: absent
when: "matrix_client_element_enabled | bool and matrix_client_riot_web_service_stat.stat.exists"
- name: Ensure systemd reloaded after matrix-riot-web.service removal
ansible.builtin.service:
daemon_reload: true
when: "matrix_client_element_enabled | bool and matrix_client_riot_web_service_stat.stat.exists"
- name: Check existence of /matrix/riot-web
ansible.builtin.stat:
path: "/matrix/riot-web"
register: matrix_client_riot_web_dir_stat
when: "matrix_client_element_enabled | bool"
- name: Relocate /matrix/riot-web to /matrix/client-element
ansible.builtin.command: "mv /matrix/riot-web /matrix/client-element"
when: "matrix_client_element_enabled | bool and matrix_client_riot_web_dir_stat.stat.exists"

View File

@ -11,6 +11,8 @@
register: matrix_client_element_self_check_result
check_mode: false
ignore_errors: true
delegate_to: 127.0.0.1
become: false
- name: Fail if Element not working
ansible.builtin.fail: