More ansible-lint fixes
This commit is contained in:
@ -156,8 +156,8 @@ matrix_ma1sd_configuration_extension_yaml: |
|
||||
# bindDn: CN=My Ma1sd User,OU=Users,DC=example,DC=org
|
||||
# bindPassword: TheUserPassword
|
||||
|
||||
matrix_ma1sd_configuration_extension: "{{ matrix_ma1sd_configuration_extension_yaml|from_yaml if matrix_ma1sd_configuration_extension_yaml|from_yaml is mapping else {} }}"
|
||||
matrix_ma1sd_configuration_extension: "{{ matrix_ma1sd_configuration_extension_yaml | from_yaml if matrix_ma1sd_configuration_extension_yaml | from_yaml is mapping else {} }}"
|
||||
|
||||
# Holds the final ma1sd configuration (a combination of the default and its extension).
|
||||
# You most likely don't need to touch this variable. Instead, see `matrix_ma1sd_configuration_yaml`.
|
||||
matrix_ma1sd_configuration: "{{ matrix_ma1sd_configuration_yaml|from_yaml|combine(matrix_ma1sd_configuration_extension, recursive=True) }}"
|
||||
matrix_ma1sd_configuration: "{{ matrix_ma1sd_configuration_yaml | from_yaml|combine(matrix_ma1sd_configuration_extension, recursive=True) }}"
|
||||
|
@ -4,8 +4,8 @@
|
||||
- name: Fail if trying to self-build on Ansible < 2.8
|
||||
ansible.builtin.fail:
|
||||
msg: "To self-build the Element image, you should use Ansible 2.8 or higher. See docs/ansible.md"
|
||||
when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_ma1sd_container_image_self_build and matrix_ma1sd_enabled|bool"
|
||||
when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_ma1sd_container_image_self_build and matrix_ma1sd_enabled | bool"
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-ma1sd.service'] }}"
|
||||
when: matrix_ma1sd_enabled|bool
|
||||
when: matrix_ma1sd_enabled | bool
|
||||
|
@ -1,30 +1,30 @@
|
||||
---
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/init.yml"
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/init.yml"
|
||||
tags:
|
||||
- always
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/validate_config.yml"
|
||||
when: "run_setup|bool and matrix_ma1sd_enabled|bool"
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml"
|
||||
when: "run_setup | bool and matrix_ma1sd_enabled | bool"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-ma1sd
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
|
||||
when: "run_setup|bool and matrix_ma1sd_enabled|bool"
|
||||
- ansible.builtin.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"
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
|
||||
when: "run_setup | bool and not matrix_ma1sd_enabled | bool"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-ma1sd
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/self_check_ma1sd.yml"
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/self_check_ma1sd.yml"
|
||||
delegate_to: 127.0.0.1
|
||||
become: false
|
||||
when: "run_self_check|bool and matrix_ma1sd_enabled|bool"
|
||||
when: "run_self_check | bool and matrix_ma1sd_enabled | bool"
|
||||
tags:
|
||||
- self-check
|
||||
|
@ -3,7 +3,7 @@
|
||||
# This task is for migrating existing mxisd data when transitioning to the ma1sd fork.
|
||||
|
||||
- name: Check for existent mxisd data
|
||||
stat:
|
||||
ansible.builtin.stat:
|
||||
path: "{{ matrix_base_data_path }}/mxisd/data"
|
||||
register: ma1sd_migrate_mxisd_data_dir_stat
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
when: "ma1sd_migrate_mxisd_data_dir_stat.stat.exists"
|
||||
|
||||
- name: Check existence of old matrix-mxisd service
|
||||
stat:
|
||||
ansible.builtin.stat:
|
||||
path: "{{ matrix_systemd_path }}/matrix-mxisd.service"
|
||||
register: matrix_mxisd_service_stat
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
when: "matrix_mxisd_service_stat.stat.exists"
|
||||
|
||||
- name: Check existence of matrix-ma1sd service
|
||||
stat:
|
||||
ansible.builtin.stat:
|
||||
path: "{{ matrix_systemd_path }}/matrix-ma1sd.service"
|
||||
register: matrix_ma1sd_service_stat
|
||||
when: "ma1sd_migrate_mxisd_data_dir_stat.stat.exists"
|
||||
@ -47,7 +47,7 @@
|
||||
ansible.builtin.command: "cp -ar {{ matrix_base_data_path }}/mxisd/data {{ matrix_ma1sd_base_path }}"
|
||||
|
||||
- name: Check existence of mxisd.db file
|
||||
stat:
|
||||
ansible.builtin.stat:
|
||||
path: "{{ matrix_ma1sd_data_path }}/mxisd.db"
|
||||
register: matrix_ma1sd_mxisd_db_stat
|
||||
|
||||
|
@ -11,9 +11,9 @@
|
||||
- {path: "{{ matrix_ma1sd_config_path }}", when: true}
|
||||
- {path: "{{ matrix_ma1sd_data_path }}", when: true}
|
||||
- {path: "{{ matrix_ma1sd_docker_src_files_path }}", when: "{{ matrix_ma1sd_container_image_self_build }}"}
|
||||
when: "item.when|bool"
|
||||
when: "item.when | bool"
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/migrate_mxisd.yml"
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/migrate_mxisd.yml"
|
||||
|
||||
|
||||
# These (SQLite -> Postgres) migration tasks are usually at the top,
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
- block:
|
||||
- name: Check if an SQLite database already exists
|
||||
stat:
|
||||
ansible.builtin.stat:
|
||||
path: "{{ matrix_ma1sd_sqlite_database_path_local }}"
|
||||
register: matrix_ma1sd_sqlite_database_path_local_stat_result
|
||||
|
||||
@ -32,17 +32,17 @@
|
||||
matrix_postgres_db_migration_request:
|
||||
src: "{{ matrix_ma1sd_sqlite_database_path_local }}"
|
||||
dst: "{{ matrix_ma1sd_database_connection_string }}"
|
||||
caller: "{{ role_path|basename }}"
|
||||
caller: "{{ role_path | basename }}"
|
||||
engine_variable_name: 'matrix_ma1sd_database_engine'
|
||||
engine_old: 'sqlite'
|
||||
systemd_services_to_stop: ['matrix-ma1sd.service']
|
||||
pgloader_options: ['--with "quote identifiers"']
|
||||
|
||||
- import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml"
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_ma1sd_requires_restart: true
|
||||
when: "matrix_ma1sd_sqlite_database_path_local_stat_result.stat.exists|bool"
|
||||
when: "matrix_ma1sd_sqlite_database_path_local_stat_result.stat.exists | bool"
|
||||
when: "matrix_ma1sd_database_engine == 'postgres'"
|
||||
|
||||
- name: Ensure ma1sd image is pulled
|
||||
@ -51,7 +51,7 @@
|
||||
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: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_ma1sd_docker_image_force_pull }}"
|
||||
when: "not matrix_ma1sd_container_image_self_build|bool"
|
||||
when: "not matrix_ma1sd_container_image_self_build | bool"
|
||||
register: result
|
||||
retries: "{{ matrix_container_retries_count }}"
|
||||
delay: "{{ matrix_container_retries_delay }}"
|
||||
@ -107,11 +107,11 @@
|
||||
repository: "{{ matrix_ma1sd_docker_image }}"
|
||||
force_tag: true
|
||||
source: local
|
||||
when: "matrix_ma1sd_container_image_self_build|bool"
|
||||
when: "matrix_ma1sd_container_image_self_build | bool"
|
||||
|
||||
- name: Ensure ma1sd config installed
|
||||
ansible.builtin.copy:
|
||||
content: "{{ matrix_ma1sd_configuration|to_nice_yaml(indent=2, width=999999) }}"
|
||||
content: "{{ matrix_ma1sd_configuration | to_nice_yaml(indent=2, width=999999) }}"
|
||||
dest: "{{ matrix_ma1sd_config_path }}/ma1sd.yaml"
|
||||
mode: 0644
|
||||
owner: "{{ matrix_user_username }}"
|
||||
@ -127,7 +127,7 @@
|
||||
with_items:
|
||||
- {value: "{{ matrix_ma1sd_view_session_custom_onTokenSubmit_success_template }}", location: 'tokenSubmitSuccess.html'}
|
||||
- {value: "{{ matrix_ma1sd_view_session_custom_onTokenSubmit_failure_template }}", location: 'tokenSubmitFailure.html'}
|
||||
when: "matrix_ma1sd_view_session_custom_templates_enabled|bool and item.value"
|
||||
when: "matrix_ma1sd_view_session_custom_templates_enabled | bool and item.value"
|
||||
|
||||
- name: Ensure custom email templates are installed, if any
|
||||
ansible.builtin.copy:
|
||||
@ -141,7 +141,7 @@
|
||||
- {value: "{{ matrix_ma1sd_threepid_medium_email_custom_session_validation_template }}", location: 'validate-template.eml'}
|
||||
- {value: "{{ matrix_ma1sd_threepid_medium_email_custom_session_unbind_notification_template }}", location: 'unbind-notification.eml'}
|
||||
- {value: "{{ matrix_ma1sd_threepid_medium_email_custom_matrixid_template }}", location: 'mxid-template.eml'}
|
||||
when: "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"
|
||||
|
||||
# Only cleaning up for people who define the respective templates
|
||||
- name: (Cleanup) Ensure custom email templates are not in data/ anymore (we've put them in config/)
|
||||
@ -153,7 +153,7 @@
|
||||
- {value: "{{ matrix_ma1sd_threepid_medium_email_custom_session_validation_template }}", location: 'validate-template.eml'}
|
||||
- {value: "{{ matrix_ma1sd_threepid_medium_email_custom_session_unbind_notification_template }}", location: 'unbind-notification.eml'}
|
||||
- {value: "{{ matrix_ma1sd_threepid_medium_email_custom_matrixid_template }}", location: 'mxid-template.eml'}
|
||||
when: "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
|
||||
ansible.builtin.template:
|
||||
@ -165,10 +165,10 @@
|
||||
- name: Ensure systemd reloaded after matrix-ma1sd.service installation
|
||||
ansible.builtin.service:
|
||||
daemon_reload: true
|
||||
when: "matrix_ma1sd_systemd_service_result.changed|bool"
|
||||
when: "matrix_ma1sd_systemd_service_result.changed | bool"
|
||||
|
||||
- name: Ensure matrix-ma1sd.service restarted, if necessary
|
||||
ansible.builtin.service:
|
||||
name: "matrix-ma1sd.service"
|
||||
state: restarted
|
||||
when: "matrix_ma1sd_requires_restart|bool"
|
||||
when: "matrix_ma1sd_requires_restart | bool"
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
|
||||
- name: Check existence of matrix-ma1sd service
|
||||
stat:
|
||||
ansible.builtin.stat:
|
||||
path: "{{ matrix_systemd_path }}/matrix-ma1sd.service"
|
||||
register: matrix_ma1sd_service_stat
|
||||
|
||||
@ -12,18 +12,18 @@
|
||||
enabled: false
|
||||
daemon_reload: true
|
||||
register: stopping_result
|
||||
when: "matrix_ma1sd_service_stat.stat.exists|bool"
|
||||
when: "matrix_ma1sd_service_stat.stat.exists | bool"
|
||||
|
||||
- name: Ensure matrix-ma1sd.service doesn't exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ matrix_systemd_path }}/matrix-ma1sd.service"
|
||||
state: absent
|
||||
when: "matrix_ma1sd_service_stat.stat.exists|bool"
|
||||
when: "matrix_ma1sd_service_stat.stat.exists | bool"
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-ma1sd.service removal
|
||||
ansible.builtin.service:
|
||||
daemon_reload: true
|
||||
when: "matrix_ma1sd_service_stat.stat.exists|bool"
|
||||
when: "matrix_ma1sd_service_stat.stat.exists | bool"
|
||||
|
||||
- name: Ensure Matrix ma1sd paths don't exist
|
||||
ansible.builtin.file:
|
||||
|
@ -2,4 +2,4 @@
|
||||
|
||||
# Doing `|from_yaml` when the extension contains nothing yields an empty string ("").
|
||||
# We need to ensure it's a dictionary or `|combine` (when building `matrix_ma1sd_configuration`) will fail later.
|
||||
matrix_ma1sd_configuration_extension: "{{ matrix_ma1sd_configuration_extension_yaml|from_yaml if matrix_ma1sd_configuration_extension_yaml|from_yaml else {} }}"
|
||||
matrix_ma1sd_configuration_extension: "{{ matrix_ma1sd_configuration_extension_yaml | from_yaml if matrix_ma1sd_configuration_extension_yaml | from_yaml else {} }}"
|
||||
|
Reference in New Issue
Block a user