From ddf18eadc7e60dcdc11080612714230358421cc5 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Mon, 18 Jul 2022 11:22:05 +0300 Subject: [PATCH] More ansible-lint fixes --- roles/matrix-aux/tasks/main.yml | 4 +- roles/matrix-aux/tasks/setup.yml | 12 +-- roles/matrix-backup-borg/defaults/main.yml | 6 +- roles/matrix-backup-borg/tasks/init.yml | 2 +- roles/matrix-backup-borg/tasks/main.yml | 14 +-- .../tasks/setup_install.yml | 16 ++-- .../tasks/setup_uninstall.yml | 10 +-- roles/matrix-base/tasks/main.yml | 22 ++--- roles/matrix-base/tasks/sanity_check.yml | 10 +-- roles/matrix-base/tasks/server_base/setup.yml | 12 +-- .../tasks/server_base/setup_archlinux.yml | 2 +- .../tasks/server_base/setup_debian.yml | 6 +- .../tasks/server_base/setup_fedora.yml | 8 +- .../tasks/server_base/setup_raspbian.yml | 6 +- .../tasks/server_base/setup_redhat.yml | 6 +- .../tasks/server_base/setup_redhat8.yml | 8 +- roles/matrix-base/tasks/setup_matrix_base.yml | 2 +- roles/matrix-base/tasks/setup_well_known.yml | 8 +- roles/matrix-bot-buscarron/tasks/init.yml | 2 +- roles/matrix-bot-buscarron/tasks/main.yml | 14 +-- .../tasks/setup_install.yml | 20 ++--- .../tasks/setup_uninstall.yml | 8 +- roles/matrix-bot-go-neb/defaults/main.yml | 4 +- roles/matrix-bot-go-neb/tasks/init.yml | 2 +- roles/matrix-bot-go-neb/tasks/main.yml | 14 +-- .../matrix-bot-go-neb/tasks/setup_install.yml | 8 +- .../tasks/setup_uninstall.yml | 8 +- roles/matrix-bot-honoroit/tasks/init.yml | 2 +- roles/matrix-bot-honoroit/tasks/main.yml | 14 +-- .../tasks/setup_install.yml | 20 ++--- .../tasks/setup_uninstall.yml | 8 +- .../tasks/init.yml | 2 +- .../tasks/main.yml | 14 +-- .../tasks/setup_install.yml | 10 +-- .../tasks/setup_uninstall.yml | 8 +- .../defaults/main.yml | 4 +- .../tasks/init.yml | 2 +- .../tasks/main.yml | 14 +-- .../tasks/setup_install.yml | 22 ++--- .../tasks/setup_uninstall.yml | 8 +- roles/matrix-bot-mjolnir/defaults/main.yml | 4 +- roles/matrix-bot-mjolnir/tasks/init.yml | 2 +- roles/matrix-bot-mjolnir/tasks/main.yml | 14 +-- .../tasks/setup_install.yml | 14 +-- .../tasks/setup_uninstall.yml | 8 +- .../defaults/main.yml | 6 +- .../tasks/init.yml | 10 +-- .../tasks/main.yml | 14 +-- .../tasks/setup_install.yml | 16 ++-- .../tasks/setup_uninstall.yml | 2 +- .../defaults/main.yml | 6 +- .../tasks/init.yml | 10 +-- .../tasks/main.yml | 14 +-- .../tasks/migrate_nedb_to_postgres.yml | 12 +-- .../tasks/setup_install.yml | 26 +++--- .../tasks/setup_uninstall.yml | 2 +- .../defaults/main.yml | 6 +- .../tasks/init.yml | 22 ++--- .../tasks/main.yml | 14 +-- .../tasks/migrate_nedb_to_postgres.yml | 10 +-- .../tasks/setup_install.yml | 20 ++--- .../tasks/setup_uninstall.yml | 2 +- .../defaults/main.yml | 6 +- .../tasks/init.yml | 22 ++--- .../tasks/main.yml | 14 +-- .../tasks/setup_install.yml | 10 +-- .../tasks/setup_uninstall.yml | 2 +- .../defaults/main.yml | 6 +- .../tasks/init.yml | 8 +- .../tasks/main.yml | 10 +-- .../tasks/setup_install.yml | 12 +-- .../tasks/setup_uninstall.yml | 2 +- .../defaults/main.yml | 6 +- .../tasks/init.yml | 8 +- .../tasks/main.yml | 14 +-- .../tasks/setup_install.yml | 26 +++--- .../tasks/setup_uninstall.yml | 2 +- .../defaults/main.yml | 2 +- .../matrix-bridge-heisenbridge/tasks/init.yml | 10 +-- .../matrix-bridge-heisenbridge/tasks/main.yml | 10 +-- .../tasks/setup_install.yml | 2 +- .../tasks/setup_uninstall.yml | 2 +- .../matrix-bridge-hookshot/defaults/main.yml | 8 +- roles/matrix-bridge-hookshot/tasks/init.yml | 34 +++---- roles/matrix-bridge-hookshot/tasks/main.yml | 14 +-- .../tasks/setup_install.yml | 16 ++-- .../tasks/setup_uninstall.yml | 2 +- .../defaults/main.yml | 6 +- .../tasks/init.yml | 18 ++-- .../tasks/main.yml | 14 +-- .../tasks/setup_install.yml | 24 ++--- .../tasks/setup_uninstall.yml | 2 +- .../tasks/validate_config.yml | 2 +- .../defaults/main.yml | 6 +- .../tasks/init.yml | 18 ++-- .../tasks/main.yml | 14 +-- .../tasks/setup_install.yml | 24 ++--- .../tasks/setup_uninstall.yml | 2 +- .../defaults/main.yml | 6 +- .../tasks/init.yml | 18 ++-- .../tasks/main.yml | 14 +-- .../tasks/setup_install.yml | 24 ++--- .../tasks/setup_uninstall.yml | 2 +- .../defaults/main.yml | 6 +- .../tasks/init.yml | 8 +- .../tasks/main.yml | 14 +-- .../tasks/setup_install.yml | 12 +-- .../tasks/setup_uninstall.yml | 2 +- .../defaults/main.yml | 6 +- .../tasks/init.yml | 8 +- .../tasks/main.yml | 14 +-- .../tasks/setup_install.yml | 18 ++-- .../tasks/setup_uninstall.yml | 4 +- .../defaults/main.yml | 6 +- .../tasks/init.yml | 18 ++-- .../tasks/main.yml | 14 +-- .../tasks/setup_install.yml | 32 +++---- .../tasks/setup_uninstall.yml | 2 +- .../defaults/main.yml | 6 +- .../tasks/init.yml | 8 +- .../tasks/main.yml | 14 +-- .../tasks/setup_install.yml | 16 ++-- .../tasks/setup_uninstall.yml | 2 +- .../defaults/main.yml | 6 +- .../tasks/init.yml | 8 +- .../tasks/main.yml | 10 +-- .../tasks/setup_install.yml | 26 +++--- .../tasks/setup_uninstall.yml | 2 +- .../defaults/main.yml | 6 +- .../tasks/init.yml | 8 +- .../tasks/main.yml | 14 +-- .../tasks/setup_install.yml | 26 +++--- .../tasks/setup_uninstall.yml | 2 +- .../defaults/main.yml | 6 +- .../tasks/init.yml | 8 +- .../tasks/main.yml | 14 +-- .../tasks/setup_install.yml | 26 +++--- .../tasks/setup_uninstall.yml | 2 +- .../defaults/main.yml | 6 +- .../tasks/init.yml | 8 +- .../tasks/main.yml | 14 +-- .../tasks/setup_install.yml | 24 ++--- .../tasks/setup_uninstall.yml | 2 +- .../defaults/main.yml | 6 +- .../tasks/init.yml | 18 ++-- .../tasks/main.yml | 14 +-- .../tasks/setup_install.yml | 26 +++--- .../tasks/setup_uninstall.yml | 2 +- .../defaults/main.yml | 6 +- .../tasks/init.yml | 8 +- .../tasks/main.yml | 14 +-- .../tasks/setup_install.yml | 26 +++--- .../tasks/setup_uninstall.yml | 2 +- .../defaults/main.yml | 6 +- .../tasks/init.yml | 18 ++-- .../tasks/main.yml | 14 +-- .../tasks/setup_install.yml | 26 +++--- .../tasks/setup_uninstall.yml | 2 +- roles/matrix-bridge-sms/defaults/main.yml | 6 +- roles/matrix-bridge-sms/tasks/init.yml | 10 +-- roles/matrix-bridge-sms/tasks/main.yml | 14 +-- .../matrix-bridge-sms/tasks/setup_install.yml | 4 +- .../tasks/setup_uninstall.yml | 2 +- roles/matrix-client-cinny/tasks/init.yml | 2 +- roles/matrix-client-cinny/tasks/main.yml | 18 ++-- .../tasks/setup_install.yml | 10 +-- .../tasks/setup_uninstall.yml | 8 +- roles/matrix-client-element/tasks/init.yml | 2 +- roles/matrix-client-element/tasks/main.yml | 26 +++--- .../tasks/migrate_riot_web.yml | 16 ++-- .../tasks/prepare_themes.yml | 6 +- .../tasks/setup_install.yml | 12 +-- .../tasks/setup_uninstall.yml | 8 +- roles/matrix-client-hydrogen/tasks/init.yml | 2 +- roles/matrix-client-hydrogen/tasks/main.yml | 18 ++-- .../tasks/setup_install.yml | 12 +-- .../tasks/setup_uninstall.yml | 8 +- .../tasks/validate_config.yml | 2 +- roles/matrix-common-after/tasks/main.yml | 12 +-- roles/matrix-common-after/tasks/start.yml | 6 +- roles/matrix-corporal/tasks/init.yml | 2 +- roles/matrix-corporal/tasks/main.yml | 14 +-- .../matrix-corporal/tasks/setup_corporal.yml | 28 +++--- .../matrix-corporal/tasks/validate_config.yml | 2 +- roles/matrix-coturn/tasks/init.yml | 4 +- roles/matrix-coturn/tasks/main.yml | 14 +-- roles/matrix-coturn/tasks/setup_install.yml | 10 +-- roles/matrix-coturn/tasks/setup_uninstall.yml | 10 +-- roles/matrix-dendrite/defaults/main.yml | 4 +- .../matrix-dendrite/tasks/dendrite/setup.yml | 8 +- .../tasks/dendrite/setup_install.yml | 8 +- .../tasks/dendrite/setup_uninstall.yml | 2 +- roles/matrix-dendrite/tasks/init.yml | 2 +- roles/matrix-dendrite/tasks/main.yml | 22 ++--- roles/matrix-dendrite/tasks/register_user.yml | 2 +- .../tasks/self_check_federation_api.yml | 6 +- .../matrix-dendrite/tasks/setup_dendrite.yml | 4 +- roles/matrix-dendrite/vars/main.yml | 4 +- roles/matrix-dimension/defaults/main.yml | 4 +- roles/matrix-dimension/tasks/init.yml | 2 +- roles/matrix-dimension/tasks/main.yml | 14 +-- .../matrix-dimension/tasks/setup_install.yml | 20 ++--- .../tasks/setup_uninstall.yml | 8 +- roles/matrix-dimension/vars/main.yml | 2 +- roles/matrix-dynamic-dns/tasks/init.yml | 2 +- roles/matrix-dynamic-dns/tasks/install.yml | 8 +- roles/matrix-dynamic-dns/tasks/main.yml | 14 +-- roles/matrix-dynamic-dns/tasks/uninstall.yml | 2 +- roles/matrix-email2matrix/tasks/init.yml | 2 +- roles/matrix-email2matrix/tasks/main.yml | 14 +-- .../tasks/setup_install.yml | 10 +-- .../tasks/setup_uninstall.yml | 8 +- roles/matrix-etherpad/tasks/init.yml | 12 +-- roles/matrix-etherpad/tasks/main.yml | 14 +-- roles/matrix-etherpad/tasks/setup_install.yml | 2 +- .../matrix-etherpad/tasks/setup_uninstall.yml | 8 +- .../matrix-etherpad/tasks/validate_config.yml | 2 +- roles/matrix-grafana/tasks/init.yml | 2 +- roles/matrix-grafana/tasks/main.yml | 8 +- roles/matrix-grafana/tasks/setup.yml | 24 ++--- roles/matrix-jitsi/tasks/init.yml | 4 +- roles/matrix-jitsi/tasks/main.yml | 26 +++--- roles/matrix-jitsi/tasks/setup_jitsi_base.yml | 4 +- .../matrix-jitsi/tasks/setup_jitsi_jicofo.yml | 22 ++--- roles/matrix-jitsi/tasks/setup_jitsi_jvb.yml | 22 ++--- .../tasks/setup_jitsi_prosody.yml | 26 +++--- roles/matrix-jitsi/tasks/setup_jitsi_web.yml | 22 ++--- .../tasks/util/setup_jitsi_auth.yml | 2 +- roles/matrix-jitsi/tasks/validate_config.yml | 2 +- roles/matrix-ma1sd/defaults/main.yml | 4 +- roles/matrix-ma1sd/tasks/init.yml | 4 +- roles/matrix-ma1sd/tasks/main.yml | 18 ++-- roles/matrix-ma1sd/tasks/migrate_mxisd.yml | 8 +- roles/matrix-ma1sd/tasks/setup_install.yml | 28 +++--- roles/matrix-ma1sd/tasks/setup_uninstall.yml | 8 +- roles/matrix-ma1sd/vars/main.yml | 2 +- roles/matrix-mailer/tasks/init.yml | 2 +- roles/matrix-mailer/tasks/main.yml | 6 +- roles/matrix-mailer/tasks/setup_mailer.yml | 28 +++--- roles/matrix-nginx-proxy/tasks/init.yml | 4 +- roles/matrix-nginx-proxy/tasks/main.yml | 18 ++-- .../tasks/self_check_well_known.yml | 4 +- .../tasks/setup_nginx_proxy.yml | 90 +++++++++---------- roles/matrix-nginx-proxy/tasks/ssl/main.yml | 6 +- .../tasks/ssl/setup_ssl_lets_encrypt.yml | 6 +- ...tup_ssl_lets_encrypt_obtain_for_domain.yml | 10 +-- .../tasks/ssl/setup_ssl_manually_managed.yml | 2 +- ...ssl_manually_managed_verify_for_domain.yml | 4 +- .../tasks/ssl/setup_ssl_self_signed.yml | 4 +- ...etup_ssl_self_signed_obtain_for_domain.yml | 2 +- .../tasks/validate_config.yml | 2 +- roles/matrix-nginx-proxy/vars/main.yml | 4 +- roles/matrix-ntfy/defaults/main.yml | 4 +- roles/matrix-ntfy/tasks/init.yml | 2 +- roles/matrix-ntfy/tasks/main.yml | 14 +-- roles/matrix-ntfy/tasks/setup_install.yml | 2 +- roles/matrix-ntfy/tasks/setup_uninstall.yml | 2 +- roles/matrix-postgres-backup/tasks/init.yml | 2 +- roles/matrix-postgres-backup/tasks/main.yml | 10 +-- .../tasks/setup_postgres_backup.yml | 36 ++++---- .../util/detect_existing_postgres_version.yml | 6 +- roles/matrix-postgres/defaults/main.yml | 4 +- .../tasks/import_generic_sqlite_db.yml | 12 +-- .../matrix-postgres/tasks/import_postgres.yml | 20 ++--- .../tasks/import_synapse_sqlite_db.yml | 12 +-- roles/matrix-postgres/tasks/init.yml | 2 +- roles/matrix-postgres/tasks/main.yml | 30 +++---- .../tasks/migrate_postgres_data_directory.yml | 6 +- roles/matrix-postgres/tasks/run_vacuum.yml | 16 ++-- .../matrix-postgres/tasks/setup_postgres.yml | 70 +++++++-------- .../tasks/upgrade_postgres.yml | 24 ++--- .../util/create_additional_databases.yml | 6 +- .../util/detect_existing_postgres_version.yml | 6 +- .../tasks/util/migrate_db_to_postgres.yml | 20 ++--- .../tasks/init.yml | 10 +-- .../tasks/main.yml | 4 +- .../tasks/setup.yml | 14 +-- .../tasks/init.yml | 10 +-- .../tasks/main.yml | 4 +- .../tasks/setup.yml | 14 +-- roles/matrix-prometheus/defaults/main.yml | 4 +- roles/matrix-prometheus/tasks/init.yml | 2 +- roles/matrix-prometheus/tasks/main.yml | 14 +-- .../matrix-prometheus/tasks/setup_install.yml | 6 +- .../tasks/setup_uninstall.yml | 8 +- roles/matrix-redis/tasks/init.yml | 2 +- roles/matrix-redis/tasks/main.yml | 6 +- roles/matrix-redis/tasks/setup_redis.yml | 28 +++--- roles/matrix-registration/defaults/main.yml | 4 +- .../tasks/generate_token.yml | 4 +- roles/matrix-registration/tasks/init.yml | 12 +-- .../matrix-registration/tasks/list_tokens.yml | 2 +- roles/matrix-registration/tasks/main.yml | 22 ++--- .../tasks/setup_install.yml | 24 ++--- .../tasks/setup_uninstall.yml | 8 +- roles/matrix-sygnal/defaults/main.yml | 4 +- roles/matrix-sygnal/tasks/init.yml | 2 +- roles/matrix-sygnal/tasks/main.yml | 14 +-- roles/matrix-sygnal/tasks/setup_install.yml | 4 +- roles/matrix-sygnal/tasks/setup_uninstall.yml | 8 +- roles/matrix-synapse-admin/tasks/init.yml | 12 +-- roles/matrix-synapse-admin/tasks/main.yml | 8 +- roles/matrix-synapse-admin/tasks/setup.yml | 20 ++--- roles/matrix-synapse/defaults/main.yml | 20 ++--- .../tasks/ext/encryption-disabler/setup.yml | 8 +- .../ext/encryption-disabler/setup_install.yml | 4 +- .../tasks/ext/ldap-auth/setup.yml | 2 +- .../tasks/ext/mjolnir-antispam/setup.yml | 8 +- .../ext/mjolnir-antispam/setup_install.yml | 2 +- .../tasks/ext/rest-auth/setup.yml | 8 +- .../tasks/ext/rest-auth/setup_install.yml | 2 +- roles/matrix-synapse/tasks/ext/setup.yml | 12 +-- .../tasks/ext/shared-secret-auth/setup.yml | 8 +- .../ext/shared-secret-auth/setup_install.yml | 4 +- .../ext/synapse-simple-antispam/setup.yml | 8 +- .../synapse-simple-antispam/setup_install.yml | 2 +- roles/matrix-synapse/tasks/goofys/setup.yml | 8 +- .../tasks/goofys/setup_install.yml | 4 +- .../tasks/goofys/setup_uninstall.yml | 2 +- .../tasks/import_media_store.yml | 10 +-- roles/matrix-synapse/tasks/init.yml | 20 ++--- roles/matrix-synapse/tasks/main.yml | 34 +++---- roles/matrix-synapse/tasks/register_user.yml | 2 +- .../rust-synapse-compress-state/main.yml | 12 +-- .../tasks/self_check_client_api.yml | 6 +- .../tasks/self_check_federation_api.yml | 8 +- roles/matrix-synapse/tasks/setup_synapse.yml | 10 +-- roles/matrix-synapse/tasks/synapse/setup.yml | 8 +- .../tasks/synapse/setup_install.yml | 12 +-- .../tasks/synapse/setup_uninstall.yml | 4 +- .../tasks/synapse/workers/init.yml | 14 +-- .../tasks/synapse/workers/setup.yml | 8 +- .../tasks/synapse/workers/setup_install.yml | 10 +-- .../tasks/synapse/workers/setup_uninstall.yml | 8 +- .../inject_systemd_services_for_worker.yml | 2 +- .../tasks/update_user_password.yml | 4 +- roles/matrix-synapse/vars/main.yml | 6 +- 337 files changed, 1720 insertions(+), 1720 deletions(-) diff --git a/roles/matrix-aux/tasks/main.yml b/roles/matrix-aux/tasks/main.yml index 2585715b..df7c77d0 100644 --- a/roles/matrix-aux/tasks/main.yml +++ b/roles/matrix-aux/tasks/main.yml @@ -1,7 +1,7 @@ --- -- import_tasks: "{{ role_path }}/tasks/setup.yml" - when: run_stop|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup.yml" + when: run_stop | bool tags: - setup-all - setup-aux-files diff --git a/roles/matrix-aux/tasks/setup.yml b/roles/matrix-aux/tasks/setup.yml index 87c67d6d..ccb0bdcb 100644 --- a/roles/matrix-aux/tasks/setup.yml +++ b/roles/matrix-aux/tasks/setup.yml @@ -4,16 +4,16 @@ ansible.builtin.file: dest: "{{ item.dest }}" state: directory - owner: "{{ item.owner|default(matrix_user_username) }}" - group: "{{ item.group|default(matrix_user_groupname) }}" - mode: "{{ item.mode|default(matrix_aux_directory_default_mode) }}" + owner: "{{ item.owner | default(matrix_user_username) }}" + group: "{{ item.group | default(matrix_user_groupname) }}" + mode: "{{ item.mode | default(matrix_aux_directory_default_mode) }}" with_items: "{{ matrix_aux_directory_definitions }}" - name: Ensure AUX files are created ansible.builtin.copy: dest: "{{ item.dest }}" content: "{{ item.content }}" - owner: "{{ item.owner|default(matrix_user_username) }}" - group: "{{ item.group|default(matrix_user_groupname) }}" - mode: "{{ item.mode|default(matrix_aux_file_default_mode) }}" + owner: "{{ item.owner | default(matrix_user_username) }}" + group: "{{ item.group | default(matrix_user_groupname) }}" + mode: "{{ item.mode | default(matrix_aux_file_default_mode) }}" with_items: "{{ matrix_aux_file_definitions }}" diff --git a/roles/matrix-backup-borg/defaults/main.yml b/roles/matrix-backup-borg/defaults/main.yml index 5003c26c..ed2ffb72 100644 --- a/roles/matrix-backup-borg/defaults/main.yml +++ b/roles/matrix-backup-borg/defaults/main.yml @@ -14,7 +14,7 @@ matrix_backup_borg_docker_src_files_path: "{{ matrix_backup_borg_base_path }}/do matrix_backup_borg_version: "" matrix_backup_borg_docker_image: "{{ matrix_backup_borg_docker_image_name_prefix }}etke.cc/borgmatic:{{ matrix_backup_borg_version }}" matrix_backup_borg_docker_image_name_prefix: "{{ 'localhost/' if matrix_backup_borg_container_image_self_build else 'registry.gitlab.com/' }}" -matrix_backup_borg_docker_image_force_pull: "{{ matrix_backup_borg_docker_image.endswith(':latest') or matrix_backup_borg_version|default('') == '' }}" +matrix_backup_borg_docker_image_force_pull: "{{ matrix_backup_borg_docker_image.endswith(':latest') or matrix_backup_borg_version | default('') == '' }}" # A list of extra arguments to pass to the container matrix_backup_borg_container_extra_arguments: [] @@ -93,8 +93,8 @@ matrix_backup_borg_configuration_extension_yaml: | # If you need something more special, you can take full control by # completely redefining `matrix_backup_borg_configuration_yaml`. -matrix_backup_borg_configuration_extension: "{{ matrix_backup_borg_configuration_extension_yaml|from_yaml if matrix_backup_borg_configuration_extension_yaml|from_yaml is mapping else {} }}" +matrix_backup_borg_configuration_extension: "{{ matrix_backup_borg_configuration_extension_yaml | from_yaml if matrix_backup_borg_configuration_extension_yaml | from_yaml is mapping else {} }}" # Holds the final borgmatic configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_backup_borg_configuration_yaml`. -matrix_backup_borg_configuration: "{{ matrix_backup_borg_configuration_yaml|from_yaml|combine(matrix_backup_borg_configuration_extension, recursive=True) }}" +matrix_backup_borg_configuration: "{{ matrix_backup_borg_configuration_yaml | from_yaml|combine(matrix_backup_borg_configuration_extension, recursive=True) }}" diff --git a/roles/matrix-backup-borg/tasks/init.yml b/roles/matrix-backup-borg/tasks/init.yml index 4d853a82..d57f1249 100644 --- a/roles/matrix-backup-borg/tasks/init.yml +++ b/roles/matrix-backup-borg/tasks/init.yml @@ -1,4 +1,4 @@ --- - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-backup-borg.timer'] }}" - when: matrix_backup_borg_enabled|bool + when: matrix_backup_borg_enabled | bool diff --git a/roles/matrix-backup-borg/tasks/main.yml b/roles/matrix-backup-borg/tasks/main.yml index 0dbf54e1..5de4559c 100644 --- a/roles/matrix-backup-borg/tasks/main.yml +++ b/roles/matrix-backup-borg/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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_backup_borg_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_backup_borg_enabled | bool" tags: - setup-all - setup-backup-borg -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_backup_borg_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_backup_borg_enabled | bool" tags: - setup-all - setup-backup-borg -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_backup_borg_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_backup_borg_enabled | bool" tags: - setup-all - setup-backup-borg diff --git a/roles/matrix-backup-borg/tasks/setup_install.yml b/roles/matrix-backup-borg/tasks/setup_install.yml index c8cf7f24..686313a2 100644 --- a/roles/matrix-backup-borg/tasks/setup_install.yml +++ b/roles/matrix-backup-borg/tasks/setup_install.yml @@ -1,6 +1,6 @@ --- - block: - - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/detect_existing_postgres_version.yml" + - ansible.builtin.import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/detect_existing_postgres_version.yml" - name: Fail if detected Postgres version is unsupported ansible.builtin.fail: @@ -10,7 +10,7 @@ - name: Set the correct borg backup version to use ansible.builtin.set_fact: matrix_backup_borg_version: "{{ matrix_postgres_detected_version }}" - when: matrix_backup_borg_postgresql_enabled|bool and matrix_backup_borg_version == '' + when: matrix_backup_borg_postgresql_enabled | bool and matrix_backup_borg_version == '' - name: Ensure borg paths exist ansible.builtin.file: @@ -22,11 +22,11 @@ with_items: - {path: "{{ matrix_backup_borg_config_path }}", when: true} - {path: "{{ matrix_backup_borg_docker_src_files_path }}", when: true} - when: "item.when|bool" + when: "item.when | bool" - name: Ensure borgmatic config is created ansible.builtin.copy: - content: "{{ matrix_backup_borg_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_backup_borg_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_backup_borg_config_path }}/config.yaml" owner: "{{ matrix_user_username }}" group: "{{ matrix_user_groupname }}" @@ -54,7 +54,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_backup_borg_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_backup_borg_docker_image_force_pull }}" - when: "not matrix_backup_borg_container_image_self_build|bool" + when: "not matrix_backup_borg_container_image_self_build | bool" register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -68,7 +68,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_backup_borg_git_pull_results - when: "matrix_backup_borg_container_image_self_build|bool" + when: "matrix_backup_borg_container_image_self_build | bool" - name: Ensure borg image is built docker_image: @@ -80,7 +80,7 @@ dockerfile: Dockerfile path: "{{ matrix_backup_borg_docker_src_files_path }}" pull: true - when: "matrix_backup_borg_container_image_self_build|bool" + when: "matrix_backup_borg_container_image_self_build | bool" - name: Ensure matrix-backup-borg.service installed ansible.builtin.template: @@ -99,7 +99,7 @@ - name: Ensure systemd reloaded after matrix-backup-borg.service installation ansible.builtin.service: daemon_reload: true - when: "matrix_backup_borg_systemd_service_result.changed|bool" + when: "matrix_backup_borg_systemd_service_result.changed | bool" - name: Ensure matrix-backup-borg.service enabled ansible.builtin.service: diff --git a/roles/matrix-backup-borg/tasks/setup_uninstall.yml b/roles/matrix-backup-borg/tasks/setup_uninstall.yml index faed21f8..fb583f57 100644 --- a/roles/matrix-backup-borg/tasks/setup_uninstall.yml +++ b/roles/matrix-backup-borg/tasks/setup_uninstall.yml @@ -1,6 +1,6 @@ --- - name: Check existence of matrix-backup-borg service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-backup-borg.service" register: matrix_backup_borg_service_stat @@ -11,24 +11,24 @@ enabled: false daemon_reload: true register: stopping_result - when: "matrix_backup_borg_service_stat.stat.exists|bool" + when: "matrix_backup_borg_service_stat.stat.exists | bool" - name: Ensure matrix-backup-borg.service doesn't exist ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-backup-borg.service" state: absent - when: "matrix_backup_borg_service_stat.stat.exists|bool" + when: "matrix_backup_borg_service_stat.stat.exists | bool" - name: Ensure matrix-backup-borg.timer doesn't exist ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-backup-borg.timer" state: absent - when: "matrix_backup_borg_service_stat.stat.exists|bool" + when: "matrix_backup_borg_service_stat.stat.exists | bool" - name: Ensure systemd reloaded after matrix-backup-borg.service removal ansible.builtin.service: daemon_reload: true - when: "matrix_backup_borg_service_stat.stat.exists|bool" + when: "matrix_backup_borg_service_stat.stat.exists | bool" - name: Ensure Matrix borg paths don't exist ansible.builtin.file: diff --git a/roles/matrix-base/tasks/main.yml b/roles/matrix-base/tasks/main.yml index 1cdc0432..2205056d 100644 --- a/roles/matrix-base/tasks/main.yml +++ b/roles/matrix-base/tasks/main.yml @@ -1,34 +1,34 @@ --- -- import_tasks: "{{ role_path }}/tasks/sanity_check.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/sanity_check.yml" tags: - always -- import_tasks: "{{ role_path }}/tasks/clean_up_old_files.yml" - when: run_setup|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/clean_up_old_files.yml" + when: run_setup | bool tags: - setup-all -- import_tasks: "{{ role_path }}/tasks/server_base/setup.yml" - when: run_setup|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/server_base/setup.yml" + when: run_setup | bool tags: - setup-all # This needs to always run, because it populates `matrix_user_uid` and `matrix_user_gid`, # which are required by many other roles. -- import_tasks: "{{ role_path }}/tasks/setup_matrix_user.yml" - when: run_setup|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_matrix_user.yml" + when: run_setup | bool tags: - always - setup-system-user -- import_tasks: "{{ role_path }}/tasks/setup_matrix_base.yml" - when: run_setup|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_matrix_base.yml" + when: run_setup | bool tags: - setup-all -- import_tasks: "{{ role_path }}/tasks/setup_well_known.yml" - when: run_setup|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_well_known.yml" + when: run_setup | bool tags: - setup-all - setup-ma1sd diff --git a/roles/matrix-base/tasks/sanity_check.yml b/roles/matrix-base/tasks/sanity_check.yml index 29ae8419..03ff0afb 100644 --- a/roles/matrix-base/tasks/sanity_check.yml +++ b/roles/matrix-base/tasks/sanity_check.yml @@ -50,11 +50,11 @@ ansible.builtin.fail: msg: "The `{{ item.var }}` variable must be defined and have a non-null and non-empty value" with_items: - - {'var': matrix_domain, 'value': "{{ matrix_domain|default('') }}"} - - {'var': matrix_server_fqn_matrix, 'value': "{{ matrix_server_fqn_matrix|default('') }}"} - - {'var': matrix_server_fqn_element, 'value': "{{ matrix_server_fqn_element|default('') }}"} - - {'var': matrix_homeserver_container_url, 'value': "{{ matrix_homeserver_container_url|default('') }}"} - - {'var': matrix_homeserver_container_federation_url, 'value': "{{ matrix_homeserver_container_federation_url|default('') }}"} + - {'var': matrix_domain, 'value': "{{ matrix_domain | default('') }}"} + - {'var': matrix_server_fqn_matrix, 'value': "{{ matrix_server_fqn_matrix | default('') }}"} + - {'var': matrix_server_fqn_element, 'value': "{{ matrix_server_fqn_element | default('') }}"} + - {'var': matrix_homeserver_container_url, 'value': "{{ matrix_homeserver_container_url | default('') }}"} + - {'var': matrix_homeserver_container_federation_url, 'value': "{{ matrix_homeserver_container_federation_url | default('') }}"} when: "item.value is none or item.value == ''" - name: Fail if uppercase domain used diff --git a/roles/matrix-base/tasks/server_base/setup.yml b/roles/matrix-base/tasks/server_base/setup.yml index c5145e55..cec74590 100644 --- a/roles/matrix-base/tasks/server_base/setup.yml +++ b/roles/matrix-base/tasks/server_base/setup.yml @@ -1,12 +1,12 @@ --- -- include_tasks: "{{ role_path }}/tasks/server_base/setup_redhat.yml" +- ansible.builtin.include_tasks: "{{ role_path }}/tasks/server_base/setup_redhat.yml" when: ansible_os_family == 'RedHat' and ansible_distribution_major_version|int < 8 -- include_tasks: "{{ role_path }}/tasks/server_base/setup_redhat8.yml" +- ansible.builtin.include_tasks: "{{ role_path }}/tasks/server_base/setup_redhat8.yml" when: ansible_os_family == 'RedHat' and ansible_distribution_major_version|int > 7 and ansible_distribution_major_version|int < 30 -- include_tasks: "{{ role_path }}/tasks/server_base/setup_fedora.yml" +- ansible.builtin.include_tasks: "{{ role_path }}/tasks/server_base/setup_fedora.yml" when: ansible_os_family == 'RedHat' and ansible_distribution_major_version|int > 30 - block: @@ -23,14 +23,14 @@ setup: filter=ansible_lsb* when: lsb_release_installation_result.changed - - include_tasks: "{{ role_path }}/tasks/server_base/setup_debian.yml" + - ansible.builtin.include_tasks: "{{ role_path }}/tasks/server_base/setup_debian.yml" when: (ansible_os_family == 'Debian') and (ansible_lsb.id != 'Raspbian') - - include_tasks: "{{ role_path }}/tasks/server_base/setup_raspbian.yml" + - ansible.builtin.include_tasks: "{{ role_path }}/tasks/server_base/setup_raspbian.yml" when: (ansible_os_family == 'Debian') and (ansible_lsb.id == 'Raspbian') when: ansible_os_family == 'Debian' -- include_tasks: "{{ role_path }}/tasks/server_base/setup_archlinux.yml" +- ansible.builtin.include_tasks: "{{ role_path }}/tasks/server_base/setup_archlinux.yml" when: ansible_distribution == 'Archlinux' - name: Ensure Docker is started and autoruns diff --git a/roles/matrix-base/tasks/server_base/setup_archlinux.yml b/roles/matrix-base/tasks/server_base/setup_archlinux.yml index a4912a5d..73c18cee 100644 --- a/roles/matrix-base/tasks/server_base/setup_archlinux.yml +++ b/roles/matrix-base/tasks/server_base/setup_archlinux.yml @@ -13,4 +13,4 @@ name: - docker state: latest - when: matrix_docker_installation_enabled|bool + when: matrix_docker_installation_enabled | bool diff --git a/roles/matrix-base/tasks/server_base/setup_debian.yml b/roles/matrix-base/tasks/server_base/setup_debian.yml index a45cd377..c463738b 100644 --- a/roles/matrix-base/tasks/server_base/setup_debian.yml +++ b/roles/matrix-base/tasks/server_base/setup_debian.yml @@ -16,14 +16,14 @@ state: present register: add_repository_key ignore_errors: true - when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce' + when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce' - name: Ensure Docker repository is enabled apt_repository: repo: "deb [arch={{ matrix_debian_arch }}] https://download.docker.com/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable" state: present update_cache: true - when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce' + when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce' - name: Ensure APT packages are installed ansible.builtin.apt: @@ -38,4 +38,4 @@ - "{{ matrix_docker_package_name }}" - "python{{'3' if ansible_python.version.major == 3 else ''}}-docker" state: latest - when: matrix_docker_installation_enabled|bool + when: matrix_docker_installation_enabled | bool diff --git a/roles/matrix-base/tasks/server_base/setup_fedora.yml b/roles/matrix-base/tasks/server_base/setup_fedora.yml index c83d8844..e9ddf54b 100644 --- a/roles/matrix-base/tasks/server_base/setup_fedora.yml +++ b/roles/matrix-base/tasks/server_base/setup_fedora.yml @@ -9,13 +9,13 @@ mode: 0644 with_items: - docker-ce-fedora.repo - when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce' + when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce' - name: Ensure Docker's RPM key is trusted rpm_key: state: present key: https://download.docker.com/linux/fedora/gpg - when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce' + when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce' - name: Ensure yum packages are installed ansible.builtin.yum: @@ -30,10 +30,10 @@ - "{{ matrix_docker_package_name }}" - python3-pip state: latest - when: matrix_docker_installation_enabled|bool + when: matrix_docker_installation_enabled | bool - name: Ensure Docker-Py is installed pip: name: docker-py state: latest - when: matrix_docker_installation_enabled|bool + when: matrix_docker_installation_enabled | bool diff --git a/roles/matrix-base/tasks/server_base/setup_raspbian.yml b/roles/matrix-base/tasks/server_base/setup_raspbian.yml index e3406ed5..6f0b1467 100644 --- a/roles/matrix-base/tasks/server_base/setup_raspbian.yml +++ b/roles/matrix-base/tasks/server_base/setup_raspbian.yml @@ -16,14 +16,14 @@ state: present register: add_repository_key ignore_errors: true - when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce' + when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce' - name: Ensure Docker repository is enabled apt_repository: repo: "deb [arch={{ matrix_debian_arch }}] https://download.docker.com/linux/raspbian {{ ansible_distribution_release }} stable" state: present update_cache: true - when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce' + when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce' - name: Ensure APT packages are installed ansible.builtin.apt: @@ -38,4 +38,4 @@ - "{{ matrix_docker_package_name }}" - "python{{'3' if ansible_python.version.major == 3 else ''}}-docker" state: latest - when: matrix_docker_installation_enabled|bool + when: matrix_docker_installation_enabled | bool diff --git a/roles/matrix-base/tasks/server_base/setup_redhat.yml b/roles/matrix-base/tasks/server_base/setup_redhat.yml index 88061c71..92615ac7 100644 --- a/roles/matrix-base/tasks/server_base/setup_redhat.yml +++ b/roles/matrix-base/tasks/server_base/setup_redhat.yml @@ -7,13 +7,13 @@ owner: "root" group: "root" mode: 0644 - when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce' + when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce' - name: Ensure Docker's RPM key is trusted rpm_key: state: present key: https://download.docker.com/linux/centos/gpg - when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce' + when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce' - name: Ensure yum packages are installed ansible.builtin.yum: @@ -28,4 +28,4 @@ - "{{ matrix_docker_package_name }}" - docker-python state: latest - when: matrix_docker_installation_enabled|bool + when: matrix_docker_installation_enabled | bool diff --git a/roles/matrix-base/tasks/server_base/setup_redhat8.yml b/roles/matrix-base/tasks/server_base/setup_redhat8.yml index d2eca681..7b50160d 100644 --- a/roles/matrix-base/tasks/server_base/setup_redhat8.yml +++ b/roles/matrix-base/tasks/server_base/setup_redhat8.yml @@ -7,13 +7,13 @@ owner: "root" group: "root" mode: 0644 - when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce' + when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce' - name: Ensure Docker's RPM key is trusted rpm_key: state: present key: https://download.docker.com/linux/centos/gpg - when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce' + when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce' - name: Ensure EPEL is installed ansible.builtin.yum: @@ -35,10 +35,10 @@ - "{{ matrix_docker_package_name }}" - python3-pip state: latest - when: matrix_docker_installation_enabled|bool + when: matrix_docker_installation_enabled | bool - name: Ensure Docker-Py is installed pip: name: docker-py state: latest - when: matrix_docker_installation_enabled|bool + when: matrix_docker_installation_enabled | bool diff --git a/roles/matrix-base/tasks/setup_matrix_base.yml b/roles/matrix-base/tasks/setup_matrix_base.yml index 100b7e7c..2e860987 100644 --- a/roles/matrix-base/tasks/setup_matrix_base.yml +++ b/roles/matrix-base/tasks/setup_matrix_base.yml @@ -17,7 +17,7 @@ owner: "{{ matrix_user_username }}" group: "{{ matrix_user_groupname }}" mode: '0660' - when: "matrix_vars_yml_snapshotting_enabled|bool" + when: "matrix_vars_yml_snapshotting_enabled | bool" - name: Ensure Matrix network is created in Docker docker_network: diff --git a/roles/matrix-base/tasks/setup_well_known.yml b/roles/matrix-base/tasks/setup_well_known.yml index c4a5c236..d51e93d3 100644 --- a/roles/matrix-base/tasks/setup_well_known.yml +++ b/roles/matrix-base/tasks/setup_well_known.yml @@ -15,7 +15,7 @@ - name: Ensure Matrix /.well-known/matrix/client file configured ansible.builtin.copy: - content: "{{ matrix_well_known_matrix_client_configuration|to_nice_json }}" + content: "{{ matrix_well_known_matrix_client_configuration | to_nice_json }}" dest: "{{ matrix_static_files_base_path }}/.well-known/matrix/client" mode: 0644 owner: "{{ matrix_user_username }}" @@ -23,18 +23,18 @@ - name: Ensure Matrix /.well-known/matrix/server file configured ansible.builtin.copy: - content: "{{ matrix_well_known_matrix_server_configuration|to_nice_json }}" + content: "{{ matrix_well_known_matrix_server_configuration | to_nice_json }}" dest: "{{ matrix_static_files_base_path }}/.well-known/matrix/server" mode: 0644 owner: "{{ matrix_user_username }}" group: "{{ matrix_user_groupname }}" - when: matrix_well_known_matrix_server_enabled|bool + when: matrix_well_known_matrix_server_enabled | bool - name: Ensure Matrix /.well-known/matrix/server file deleted ansible.builtin.file: path: "{{ matrix_static_files_base_path }}/.well-known/matrix/server" state: absent - when: "not matrix_well_known_matrix_server_enabled|bool" + when: "not matrix_well_known_matrix_server_enabled | bool" - name: Ensure Matrix /.well-known/matrix/support file configured ansible.builtin.copy: diff --git a/roles/matrix-bot-buscarron/tasks/init.yml b/roles/matrix-bot-buscarron/tasks/init.yml index 37c0932e..a1f5751d 100644 --- a/roles/matrix-bot-buscarron/tasks/init.yml +++ b/roles/matrix-bot-buscarron/tasks/init.yml @@ -2,4 +2,4 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-bot-buscarron.service'] }}" - when: matrix_bot_buscarron_enabled|bool + when: matrix_bot_buscarron_enabled | bool diff --git a/roles/matrix-bot-buscarron/tasks/main.yml b/roles/matrix-bot-buscarron/tasks/main.yml index 63e87dfb..e6712262 100644 --- a/roles/matrix-bot-buscarron/tasks/main.yml +++ b/roles/matrix-bot-buscarron/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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_bot_buscarron_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_bot_buscarron_enabled | bool" tags: - setup-all - setup-bot-buscarron -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_bot_buscarron_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_bot_buscarron_enabled | bool" tags: - setup-all - setup-bot-buscarron -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_bot_buscarron_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_bot_buscarron_enabled | bool" tags: - setup-all - setup-bot-buscarron diff --git a/roles/matrix-bot-buscarron/tasks/setup_install.yml b/roles/matrix-bot-buscarron/tasks/setup_install.yml index 6559a95a..e9ba1258 100644 --- a/roles/matrix-bot-buscarron/tasks/setup_install.yml +++ b/roles/matrix-bot-buscarron/tasks/setup_install.yml @@ -4,7 +4,7 @@ - block: - name: Check if an SQLite database already exists - stat: + ansible.builtin.stat: path: "{{ matrix_bot_buscarron_sqlite_database_path_local }}" register: matrix_bot_buscarron_sqlite_database_path_local_stat_result @@ -13,16 +13,16 @@ matrix_postgres_db_migration_request: src: "{{ matrix_bot_buscarron_sqlite_database_path_local }}" dst: "{{ matrix_bot_buscarron_database_connection_string }}" - caller: "{{ role_path|basename }}" + caller: "{{ role_path | basename }}" engine_variable_name: 'matrix_bot_buscarron_database_engine' engine_old: 'sqlite' systemd_services_to_stop: ['matrix-bot-buscarron.service'] - - 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_bot_buscarron_requires_restart: true - when: "matrix_bot_buscarron_sqlite_database_path_local_stat_result.stat.exists|bool" + when: "matrix_bot_buscarron_sqlite_database_path_local_stat_result.stat.exists | bool" when: "matrix_bot_buscarron_database_engine == 'postgres'" - name: Ensure buscarron paths exist @@ -37,7 +37,7 @@ - {path: "{{ matrix_bot_buscarron_data_path }}", when: true} - {path: "{{ matrix_bot_buscarron_data_store_path }}", when: true} - {path: "{{ matrix_bot_buscarron_docker_src_files_path }}", when: true} - when: "item.when|bool" + when: "item.when | bool" - name: Ensure buscarron environment variables file created ansible.builtin.template: @@ -53,7 +53,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_bot_buscarron_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_bot_buscarron_docker_image_force_pull }}" - when: "not matrix_bot_buscarron_container_image_self_build|bool" + when: "not matrix_bot_buscarron_container_image_self_build | bool" register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -67,7 +67,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_bot_buscarron_git_pull_results - when: "matrix_bot_buscarron_container_image_self_build|bool" + when: "matrix_bot_buscarron_container_image_self_build | bool" - name: Ensure buscarron image is built docker_image: @@ -79,7 +79,7 @@ dockerfile: Dockerfile path: "{{ matrix_bot_buscarron_docker_src_files_path }}" pull: true - when: "matrix_bot_buscarron_container_image_self_build|bool" + when: "matrix_bot_buscarron_container_image_self_build | bool" - name: Ensure matrix-bot-buscarron.service installed ansible.builtin.template: @@ -91,10 +91,10 @@ - name: Ensure systemd reloaded after matrix-bot-buscarron.service installation ansible.builtin.service: daemon_reload: true - when: "matrix_bot_buscarron_systemd_service_result.changed|bool" + when: "matrix_bot_buscarron_systemd_service_result.changed | bool" - name: Ensure matrix-bot-buscarron.service restarted, if necessary ansible.builtin.service: name: "matrix-bot-buscarron.service" state: restarted - when: "matrix_bot_buscarron_requires_restart|bool" + when: "matrix_bot_buscarron_requires_restart | bool" diff --git a/roles/matrix-bot-buscarron/tasks/setup_uninstall.yml b/roles/matrix-bot-buscarron/tasks/setup_uninstall.yml index 5dd26653..ad9e78cd 100644 --- a/roles/matrix-bot-buscarron/tasks/setup_uninstall.yml +++ b/roles/matrix-bot-buscarron/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-buscarron service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-bot-buscarron.service" register: matrix_bot_buscarron_service_stat @@ -12,18 +12,18 @@ enabled: false daemon_reload: true register: stopping_result - when: "matrix_bot_buscarron_service_stat.stat.exists|bool" + when: "matrix_bot_buscarron_service_stat.stat.exists | bool" - name: Ensure matrix-bot-buscarron.service doesn't exist ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-bot-buscarron.service" state: absent - when: "matrix_bot_buscarron_service_stat.stat.exists|bool" + when: "matrix_bot_buscarron_service_stat.stat.exists | bool" - name: Ensure systemd reloaded after matrix-bot-buscarron.service removal ansible.builtin.service: daemon_reload: true - when: "matrix_bot_buscarron_service_stat.stat.exists|bool" + when: "matrix_bot_buscarron_service_stat.stat.exists | bool" - name: Ensure Matrix buscarron paths don't exist ansible.builtin.file: diff --git a/roles/matrix-bot-go-neb/defaults/main.yml b/roles/matrix-bot-go-neb/defaults/main.yml index 31cb27d6..f01f28fc 100644 --- a/roles/matrix-bot-go-neb/defaults/main.yml +++ b/roles/matrix-bot-go-neb/defaults/main.yml @@ -224,8 +224,8 @@ matrix_bot_go_neb_configuration_extension_yaml: | # If you need something more special, you can take full control by # completely redefining `matrix_bot_go_neb_configuration_yaml`. -matrix_bot_go_neb_configuration_extension: "{{ matrix_bot_go_neb_configuration_extension_yaml|from_yaml if matrix_bot_go_neb_configuration_extension_yaml|from_yaml is mapping else {} }}" +matrix_bot_go_neb_configuration_extension: "{{ matrix_bot_go_neb_configuration_extension_yaml | from_yaml if matrix_bot_go_neb_configuration_extension_yaml | from_yaml is mapping else {} }}" # Holds the final configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_bot_go_neb_configuration_yaml`. -matrix_bot_go_neb_configuration: "{{ matrix_bot_go_neb_configuration_yaml|from_yaml|combine(matrix_bot_go_neb_configuration_extension, recursive=True) }}" +matrix_bot_go_neb_configuration: "{{ matrix_bot_go_neb_configuration_yaml | from_yaml|combine(matrix_bot_go_neb_configuration_extension, recursive=True) }}" diff --git a/roles/matrix-bot-go-neb/tasks/init.yml b/roles/matrix-bot-go-neb/tasks/init.yml index a1b57ec6..9d5b4f89 100644 --- a/roles/matrix-bot-go-neb/tasks/init.yml +++ b/roles/matrix-bot-go-neb/tasks/init.yml @@ -2,4 +2,4 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-bot-go-neb.service'] }}" - when: matrix_bot_go_neb_enabled|bool + when: matrix_bot_go_neb_enabled | bool diff --git a/roles/matrix-bot-go-neb/tasks/main.yml b/roles/matrix-bot-go-neb/tasks/main.yml index 3c2ed9c5..27487ac5 100644 --- a/roles/matrix-bot-go-neb/tasks/main.yml +++ b/roles/matrix-bot-go-neb/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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_bot_go_neb_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_bot_go_neb_enabled | bool" tags: - setup-all - setup-bot-go-neb -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_bot_go_neb_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_bot_go_neb_enabled | bool" tags: - setup-all - setup-bot-go-neb -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_bot_go_neb_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_bot_go_neb_enabled | bool" tags: - setup-all - setup-bot-go-neb diff --git a/roles/matrix-bot-go-neb/tasks/setup_install.yml b/roles/matrix-bot-go-neb/tasks/setup_install.yml index 71d5168a..a651c160 100644 --- a/roles/matrix-bot-go-neb/tasks/setup_install.yml +++ b/roles/matrix-bot-go-neb/tasks/setup_install.yml @@ -14,7 +14,7 @@ - {path: "{{ matrix_bot_go_neb_config_path }}", when: true} - {path: "{{ matrix_bot_go_neb_data_path }}", when: true} - {path: "{{ matrix_bot_go_neb_data_store_path }}", when: true} - when: "item.when|bool" + when: "item.when | bool" - name: Ensure go-neb image is pulled docker_image: @@ -29,7 +29,7 @@ - name: Ensure go-neb config installed ansible.builtin.copy: - content: "{{ matrix_bot_go_neb_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_bot_go_neb_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_bot_go_neb_config_path }}/config.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -45,10 +45,10 @@ - name: Ensure systemd reloaded after matrix-bot-go-neb.service installation ansible.builtin.service: daemon_reload: true - when: "matrix_bot_go_neb_systemd_service_result.changed|bool" + when: "matrix_bot_go_neb_systemd_service_result.changed | bool" - name: Ensure matrix-bot-go-neb.service restarted, if necessary ansible.builtin.service: name: "matrix-bot-go-neb.service" state: restarted - when: "matrix_bot_go_neb_requires_restart|bool" + when: "matrix_bot_go_neb_requires_restart | bool" diff --git a/roles/matrix-bot-go-neb/tasks/setup_uninstall.yml b/roles/matrix-bot-go-neb/tasks/setup_uninstall.yml index d27377c1..9794a90a 100644 --- a/roles/matrix-bot-go-neb/tasks/setup_uninstall.yml +++ b/roles/matrix-bot-go-neb/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-go-neb service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-bot-go-neb.service" register: matrix_bot_go_neb_service_stat @@ -12,18 +12,18 @@ enabled: false daemon_reload: true register: stopping_result - when: "matrix_bot_go_neb_service_stat.stat.exists|bool" + when: "matrix_bot_go_neb_service_stat.stat.exists | bool" - name: Ensure matrix-bot-go-neb.service doesn't exist ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-bot-go-neb.service" state: absent - when: "matrix_bot_go_neb_service_stat.stat.exists|bool" + when: "matrix_bot_go_neb_service_stat.stat.exists | bool" - name: Ensure systemd reloaded after matrix-bot-go-neb.service removal ansible.builtin.service: daemon_reload: true - when: "matrix_bot_go_neb_service_stat.stat.exists|bool" + when: "matrix_bot_go_neb_service_stat.stat.exists | bool" - name: Ensure Matrix go-neb paths don't exist ansible.builtin.file: diff --git a/roles/matrix-bot-honoroit/tasks/init.yml b/roles/matrix-bot-honoroit/tasks/init.yml index 2a5ea4d7..1b03373c 100644 --- a/roles/matrix-bot-honoroit/tasks/init.yml +++ b/roles/matrix-bot-honoroit/tasks/init.yml @@ -2,4 +2,4 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-bot-honoroit.service'] }}" - when: matrix_bot_honoroit_enabled|bool + when: matrix_bot_honoroit_enabled | bool diff --git a/roles/matrix-bot-honoroit/tasks/main.yml b/roles/matrix-bot-honoroit/tasks/main.yml index 7d66177c..5de468fe 100644 --- a/roles/matrix-bot-honoroit/tasks/main.yml +++ b/roles/matrix-bot-honoroit/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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_bot_honoroit_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_bot_honoroit_enabled | bool" tags: - setup-all - setup-bot-honoroit -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_bot_honoroit_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_bot_honoroit_enabled | bool" tags: - setup-all - setup-bot-honoroit -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_bot_honoroit_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_bot_honoroit_enabled | bool" tags: - setup-all - setup-bot-honoroit diff --git a/roles/matrix-bot-honoroit/tasks/setup_install.yml b/roles/matrix-bot-honoroit/tasks/setup_install.yml index 2f7bb9a4..f41c4a26 100644 --- a/roles/matrix-bot-honoroit/tasks/setup_install.yml +++ b/roles/matrix-bot-honoroit/tasks/setup_install.yml @@ -4,7 +4,7 @@ - block: - name: Check if an SQLite database already exists - stat: + ansible.builtin.stat: path: "{{ matrix_bot_honoroit_sqlite_database_path_local }}" register: matrix_bot_honoroit_sqlite_database_path_local_stat_result @@ -13,16 +13,16 @@ matrix_postgres_db_migration_request: src: "{{ matrix_bot_honoroit_sqlite_database_path_local }}" dst: "{{ matrix_bot_honoroit_database_connection_string }}" - caller: "{{ role_path|basename }}" + caller: "{{ role_path | basename }}" engine_variable_name: 'matrix_bot_honoroit_database_engine' engine_old: 'sqlite' systemd_services_to_stop: ['matrix-bot-honoroit.service'] - - 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_bot_honoroit_requires_restart: true - when: "matrix_bot_honoroit_sqlite_database_path_local_stat_result.stat.exists|bool" + when: "matrix_bot_honoroit_sqlite_database_path_local_stat_result.stat.exists | bool" when: "matrix_bot_honoroit_database_engine == 'postgres'" - name: Ensure honoroit paths exist @@ -37,7 +37,7 @@ - {path: "{{ matrix_bot_honoroit_data_path }}", when: true} - {path: "{{ matrix_bot_honoroit_data_store_path }}", when: true} - {path: "{{ matrix_bot_honoroit_docker_src_files_path }}", when: true} - when: "item.when|bool" + when: "item.when | bool" - name: Ensure honoroit environment variables file created ansible.builtin.template: @@ -53,7 +53,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_bot_honoroit_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_bot_honoroit_docker_image_force_pull }}" - when: "not matrix_bot_honoroit_container_image_self_build|bool" + when: "not matrix_bot_honoroit_container_image_self_build | bool" register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -67,7 +67,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_bot_honoroit_git_pull_results - when: "matrix_bot_honoroit_container_image_self_build|bool" + when: "matrix_bot_honoroit_container_image_self_build | bool" - name: Ensure honoroit image is built docker_image: @@ -79,7 +79,7 @@ dockerfile: Dockerfile path: "{{ matrix_bot_honoroit_docker_src_files_path }}" pull: true - when: "matrix_bot_honoroit_container_image_self_build|bool" + when: "matrix_bot_honoroit_container_image_self_build | bool" - name: Ensure matrix-bot-honoroit.service installed ansible.builtin.template: @@ -91,10 +91,10 @@ - name: Ensure systemd reloaded after matrix-bot-honoroit.service installation ansible.builtin.service: daemon_reload: true - when: "matrix_bot_honoroit_systemd_service_result.changed|bool" + when: "matrix_bot_honoroit_systemd_service_result.changed | bool" - name: Ensure matrix-bot-honoroit.service restarted, if necessary ansible.builtin.service: name: "matrix-bot-honoroit.service" state: restarted - when: "matrix_bot_honoroit_requires_restart|bool" + when: "matrix_bot_honoroit_requires_restart | bool" diff --git a/roles/matrix-bot-honoroit/tasks/setup_uninstall.yml b/roles/matrix-bot-honoroit/tasks/setup_uninstall.yml index 7bb6b8f1..6ede0d1d 100644 --- a/roles/matrix-bot-honoroit/tasks/setup_uninstall.yml +++ b/roles/matrix-bot-honoroit/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-honoroit service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-bot-honoroit.service" register: matrix_bot_honoroit_service_stat @@ -12,18 +12,18 @@ enabled: false daemon_reload: true register: stopping_result - when: "matrix_bot_honoroit_service_stat.stat.exists|bool" + when: "matrix_bot_honoroit_service_stat.stat.exists | bool" - name: Ensure matrix-bot-honoroit.service doesn't exist ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-bot-honoroit.service" state: absent - when: "matrix_bot_honoroit_service_stat.stat.exists|bool" + when: "matrix_bot_honoroit_service_stat.stat.exists | bool" - name: Ensure systemd reloaded after matrix-bot-honoroit.service removal ansible.builtin.service: daemon_reload: true - when: "matrix_bot_honoroit_service_stat.stat.exists|bool" + when: "matrix_bot_honoroit_service_stat.stat.exists | bool" - name: Ensure Matrix honoroit paths don't exist ansible.builtin.file: diff --git a/roles/matrix-bot-matrix-registration-bot/tasks/init.yml b/roles/matrix-bot-matrix-registration-bot/tasks/init.yml index c3988eb2..91b1f095 100644 --- a/roles/matrix-bot-matrix-registration-bot/tasks/init.yml +++ b/roles/matrix-bot-matrix-registration-bot/tasks/init.yml @@ -2,4 +2,4 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-bot-matrix-registration-bot.service'] }}" - when: matrix_bot_matrix_registration_bot_enabled|bool + when: matrix_bot_matrix_registration_bot_enabled | bool diff --git a/roles/matrix-bot-matrix-registration-bot/tasks/main.yml b/roles/matrix-bot-matrix-registration-bot/tasks/main.yml index c90da6a8..cc162e99 100644 --- a/roles/matrix-bot-matrix-registration-bot/tasks/main.yml +++ b/roles/matrix-bot-matrix-registration-bot/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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_bot_matrix_registration_bot_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_bot_matrix_registration_bot_enabled | bool" tags: - setup-all - setup-bot-matrix-registration-bot -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_bot_matrix_registration_bot_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_bot_matrix_registration_bot_enabled | bool" tags: - setup-all - setup-bot-matrix-registration-bot -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_bot_matrix_registration_bot_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_bot_matrix_registration_bot_enabled | bool" tags: - setup-all - setup-bot-matrix-registration-bot diff --git a/roles/matrix-bot-matrix-registration-bot/tasks/setup_install.yml b/roles/matrix-bot-matrix-registration-bot/tasks/setup_install.yml index 6fd17ee8..e5155cdd 100644 --- a/roles/matrix-bot-matrix-registration-bot/tasks/setup_install.yml +++ b/roles/matrix-bot-matrix-registration-bot/tasks/setup_install.yml @@ -11,7 +11,7 @@ - {path: "{{ matrix_bot_matrix_registration_bot_config_path }}", when: true} - - {path: "{{ matrix_bot_matrix_registration_bot_data_path }}", when: true} - {path: "{{ matrix_bot_matrix_registration_bot_docker_src_files_path }}", when: true} - when: "item.when|bool" + when: "item.when | bool" - name: Ensure matrix-registration-bot configuration file created ansible.builtin.template: @@ -27,7 +27,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_bot_matrix_registration_bot_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_bot_matrix_registration_bot_docker_image_force_pull }}" - when: "not matrix_bot_matrix_registration_bot_container_image_self_build|bool" + when: "not matrix_bot_matrix_registration_bot_container_image_self_build | bool" register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -41,7 +41,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_bot_matrix_registration_bot_git_pull_results - when: "matrix_bot_matrix_registration_bot_container_image_self_build|bool" + when: "matrix_bot_matrix_registration_bot_container_image_self_build | bool" - name: Ensure matrix-registration-bot image is built docker_image: @@ -53,7 +53,7 @@ dockerfile: Dockerfile path: "{{ matrix_bot_matrix_registration_bot_docker_src_files_path }}" pull: true - when: "matrix_bot_matrix_registration_bot_container_image_self_build|bool" + when: "matrix_bot_matrix_registration_bot_container_image_self_build | bool" - name: Ensure matrix-bot-matrix-registration-bot.service installed ansible.builtin.template: @@ -65,7 +65,7 @@ - name: Ensure systemd reloaded after matrix-bot-matrix-registration-bot.service installation ansible.builtin.service: daemon_reload: true - when: "matrix_bot_matrix_registration_bot_systemd_service_result.changed|bool" + when: "matrix_bot_matrix_registration_bot_systemd_service_result.changed | bool" - name: Ensure matrix-bot-matrix-registration-bot.service restarted, if necessary ansible.builtin.service: diff --git a/roles/matrix-bot-matrix-registration-bot/tasks/setup_uninstall.yml b/roles/matrix-bot-matrix-registration-bot/tasks/setup_uninstall.yml index 5a2dbc26..426eefc1 100644 --- a/roles/matrix-bot-matrix-registration-bot/tasks/setup_uninstall.yml +++ b/roles/matrix-bot-matrix-registration-bot/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-matrix-registration-bot service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-bot-matrix-registration-bot.service" register: matrix_bot_matrix_registration_bot_service_stat @@ -12,18 +12,18 @@ enabled: false daemon_reload: true register: stopping_result - when: "matrix_bot_matrix_registration_bot_service_stat.stat.exists|bool" + when: "matrix_bot_matrix_registration_bot_service_stat.stat.exists | bool" - name: Ensure matrix-bot-matrix-registration-bot.service doesn't exist ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-bot-matrix-registration-bot.service" state: absent - when: "matrix_bot_matrix_registration_bot_service_stat.stat.exists|bool" + when: "matrix_bot_matrix_registration_bot_service_stat.stat.exists | bool" - name: Ensure systemd reloaded after matrix-bot-matrix-registration-bot.service removal ansible.builtin.service: daemon_reload: true - when: "matrix_bot_matrix_registration_bot_service_stat.stat.exists|bool" + when: "matrix_bot_matrix_registration_bot_service_stat.stat.exists | bool" - name: Ensure Matrix matrix-registration-bot paths don't exist ansible.builtin.file: diff --git a/roles/matrix-bot-matrix-reminder-bot/defaults/main.yml b/roles/matrix-bot-matrix-reminder-bot/defaults/main.yml index 48e6f07b..8a63413e 100644 --- a/roles/matrix-bot-matrix-reminder-bot/defaults/main.yml +++ b/roles/matrix-bot-matrix-reminder-bot/defaults/main.yml @@ -93,8 +93,8 @@ matrix_bot_matrix_reminder_bot_configuration_extension_yaml: | # matrix: # device_name: My-Reminder-Bot -matrix_bot_matrix_reminder_bot_configuration_extension: "{{ matrix_bot_matrix_reminder_bot_configuration_extension_yaml|from_yaml if matrix_bot_matrix_reminder_bot_configuration_extension_yaml|from_yaml is mapping else {} }}" +matrix_bot_matrix_reminder_bot_configuration_extension: "{{ matrix_bot_matrix_reminder_bot_configuration_extension_yaml | from_yaml if matrix_bot_matrix_reminder_bot_configuration_extension_yaml | from_yaml is mapping else {} }}" # Holds the final configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_bot_matrix_reminder_bot_configuration_yaml`. -matrix_bot_matrix_reminder_bot_configuration: "{{ matrix_bot_matrix_reminder_bot_configuration_yaml|from_yaml|combine(matrix_bot_matrix_reminder_bot_configuration_extension, recursive=True) }}" +matrix_bot_matrix_reminder_bot_configuration: "{{ matrix_bot_matrix_reminder_bot_configuration_yaml | from_yaml|combine(matrix_bot_matrix_reminder_bot_configuration_extension, recursive=True) }}" diff --git a/roles/matrix-bot-matrix-reminder-bot/tasks/init.yml b/roles/matrix-bot-matrix-reminder-bot/tasks/init.yml index cae7074c..0a5ba482 100644 --- a/roles/matrix-bot-matrix-reminder-bot/tasks/init.yml +++ b/roles/matrix-bot-matrix-reminder-bot/tasks/init.yml @@ -2,4 +2,4 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-bot-matrix-reminder-bot.service'] }}" - when: matrix_bot_matrix_reminder_bot_enabled|bool + when: matrix_bot_matrix_reminder_bot_enabled | bool diff --git a/roles/matrix-bot-matrix-reminder-bot/tasks/main.yml b/roles/matrix-bot-matrix-reminder-bot/tasks/main.yml index d9a1df7e..19c3823f 100644 --- a/roles/matrix-bot-matrix-reminder-bot/tasks/main.yml +++ b/roles/matrix-bot-matrix-reminder-bot/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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_bot_matrix_reminder_bot_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_bot_matrix_reminder_bot_enabled | bool" tags: - setup-all - setup-bot-matrix-reminder-bot -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_bot_matrix_reminder_bot_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_bot_matrix_reminder_bot_enabled | bool" tags: - setup-all - setup-bot-matrix-reminder-bot -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_bot_matrix_reminder_bot_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_bot_matrix_reminder_bot_enabled | bool" tags: - setup-all - setup-bot-matrix-reminder-bot diff --git a/roles/matrix-bot-matrix-reminder-bot/tasks/setup_install.yml b/roles/matrix-bot-matrix-reminder-bot/tasks/setup_install.yml index 3abda733..915831d3 100644 --- a/roles/matrix-bot-matrix-reminder-bot/tasks/setup_install.yml +++ b/roles/matrix-bot-matrix-reminder-bot/tasks/setup_install.yml @@ -5,7 +5,7 @@ - block: - name: Check if an SQLite database already exists - stat: + ansible.builtin.stat: path: "{{ matrix_bot_matrix_reminder_bot_sqlite_database_path_local }}" register: matrix_bot_matrix_reminder_bot_sqlite_database_path_local_stat_result @@ -14,16 +14,16 @@ matrix_postgres_db_migration_request: src: "{{ matrix_bot_matrix_reminder_bot_sqlite_database_path_local }}" dst: "{{ matrix_bot_matrix_reminder_bot_database_connection_string }}" - caller: "{{ role_path|basename }}" + caller: "{{ role_path | basename }}" engine_variable_name: 'matrix_bot_matrix_reminder_bot_database_engine' engine_old: 'sqlite' systemd_services_to_stop: ['matrix-bot-matrix-reminder-bot.service'] - - 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_bot_matrix_reminder_bot_requires_restart: true - when: "matrix_bot_matrix_reminder_bot_sqlite_database_path_local_stat_result.stat.exists|bool" + when: "matrix_bot_matrix_reminder_bot_sqlite_database_path_local_stat_result.stat.exists | bool" when: "matrix_bot_matrix_reminder_bot_database_engine == 'postgres'" - name: Ensure matrix-reminder-bot paths exist @@ -38,7 +38,7 @@ - {path: "{{ matrix_bot_matrix_reminder_bot_data_path }}", when: true} - {path: "{{ matrix_bot_matrix_reminder_bot_data_store_path }}", when: true} - {path: "{{ matrix_bot_matrix_reminder_bot_docker_src_files_path }}", when: true} - when: "item.when|bool" + when: "item.when | bool" - name: Ensure matrix-reminder-bot image is pulled docker_image: @@ -46,7 +46,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_bot_matrix_reminder_bot_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_bot_matrix_reminder_bot_docker_image_force_pull }}" - when: "not matrix_bot_matrix_reminder_bot_container_image_self_build|bool" + when: "not matrix_bot_matrix_reminder_bot_container_image_self_build | bool" register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -60,7 +60,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_bot_matrix_reminder_bot_git_pull_results - when: "matrix_bot_matrix_reminder_bot_container_image_self_build|bool" + when: "matrix_bot_matrix_reminder_bot_container_image_self_build | bool" - name: Ensure matrix-reminder-bot image is built docker_image: @@ -72,11 +72,11 @@ dockerfile: docker/Dockerfile path: "{{ matrix_bot_matrix_reminder_bot_docker_src_files_path }}" pull: true - when: "matrix_bot_matrix_reminder_bot_container_image_self_build|bool" + when: "matrix_bot_matrix_reminder_bot_container_image_self_build | bool" - name: Ensure matrix-reminder-bot config installed ansible.builtin.copy: - content: "{{ matrix_bot_matrix_reminder_bot_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_bot_matrix_reminder_bot_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_bot_matrix_reminder_bot_config_path }}/config.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -92,10 +92,10 @@ - name: Ensure systemd reloaded after matrix-bot-matrix-reminder-bot.service installation ansible.builtin.service: daemon_reload: true - when: "matrix_bot_matrix_reminder_bot_systemd_service_result.changed|bool" + when: "matrix_bot_matrix_reminder_bot_systemd_service_result.changed | bool" - name: Ensure matrix-bot-matrix-reminder-bot.service restarted, if necessary ansible.builtin.service: name: "matrix-bot-matrix-reminder-bot.service" state: restarted - when: "matrix_bot_matrix_reminder_bot_requires_restart|bool" + when: "matrix_bot_matrix_reminder_bot_requires_restart | bool" diff --git a/roles/matrix-bot-matrix-reminder-bot/tasks/setup_uninstall.yml b/roles/matrix-bot-matrix-reminder-bot/tasks/setup_uninstall.yml index 1b5201e7..d8926df7 100644 --- a/roles/matrix-bot-matrix-reminder-bot/tasks/setup_uninstall.yml +++ b/roles/matrix-bot-matrix-reminder-bot/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-matrix-reminder-bot service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-bot-matrix-reminder-bot.service" register: matrix_bot_matrix_reminder_bot_service_stat @@ -12,18 +12,18 @@ enabled: false daemon_reload: true register: stopping_result - when: "matrix_bot_matrix_reminder_bot_service_stat.stat.exists|bool" + when: "matrix_bot_matrix_reminder_bot_service_stat.stat.exists | bool" - name: Ensure matrix-bot-matrix-reminder-bot.service doesn't exist ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-bot-matrix-reminder-bot.service" state: absent - when: "matrix_bot_matrix_reminder_bot_service_stat.stat.exists|bool" + when: "matrix_bot_matrix_reminder_bot_service_stat.stat.exists | bool" - name: Ensure systemd reloaded after matrix-bot-matrix-reminder-bot.service removal ansible.builtin.service: daemon_reload: true - when: "matrix_bot_matrix_reminder_bot_service_stat.stat.exists|bool" + when: "matrix_bot_matrix_reminder_bot_service_stat.stat.exists | bool" - name: Ensure Matrix matrix-reminder-bot paths don't exist ansible.builtin.file: diff --git a/roles/matrix-bot-mjolnir/defaults/main.yml b/roles/matrix-bot-mjolnir/defaults/main.yml index 94d04e78..e03dff40 100644 --- a/roles/matrix-bot-mjolnir/defaults/main.yml +++ b/roles/matrix-bot-mjolnir/defaults/main.yml @@ -52,8 +52,8 @@ matrix_bot_mjolnir_configuration_extension_yaml: | # If you need something more special, you can take full control by # completely redefining `matrix_bot_mjolnir_configuration_yaml`. -matrix_bot_mjolnir_configuration_extension: "{{ matrix_bot_mjolnir_configuration_extension_yaml|from_yaml if matrix_bot_mjolnir_configuration_extension_yaml|from_yaml is mapping else {} }}" +matrix_bot_mjolnir_configuration_extension: "{{ matrix_bot_mjolnir_configuration_extension_yaml | from_yaml if matrix_bot_mjolnir_configuration_extension_yaml | from_yaml is mapping else {} }}" # Holds the final configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_bot_mjolnir_configuration_yaml`. -matrix_bot_mjolnir_configuration: "{{ matrix_bot_mjolnir_configuration_yaml|from_yaml|combine(matrix_bot_mjolnir_configuration_extension, recursive=True) }}" +matrix_bot_mjolnir_configuration: "{{ matrix_bot_mjolnir_configuration_yaml | from_yaml|combine(matrix_bot_mjolnir_configuration_extension, recursive=True) }}" diff --git a/roles/matrix-bot-mjolnir/tasks/init.yml b/roles/matrix-bot-mjolnir/tasks/init.yml index 5955a6f4..2b605342 100644 --- a/roles/matrix-bot-mjolnir/tasks/init.yml +++ b/roles/matrix-bot-mjolnir/tasks/init.yml @@ -8,4 +8,4 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-bot-mjolnir.service'] }}" - when: matrix_bot_mjolnir_enabled|bool + when: matrix_bot_mjolnir_enabled | bool diff --git a/roles/matrix-bot-mjolnir/tasks/main.yml b/roles/matrix-bot-mjolnir/tasks/main.yml index a2a20914..867201a2 100644 --- a/roles/matrix-bot-mjolnir/tasks/main.yml +++ b/roles/matrix-bot-mjolnir/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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_bot_mjolnir_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_bot_mjolnir_enabled | bool" tags: - setup-all - setup-bot-mjolnir -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_bot_mjolnir_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_bot_mjolnir_enabled | bool" tags: - setup-all - setup-bot-mjolnir -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_bot_mjolnir_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_bot_mjolnir_enabled | bool" tags: - setup-all - setup-bot-mjolnir diff --git a/roles/matrix-bot-mjolnir/tasks/setup_install.yml b/roles/matrix-bot-mjolnir/tasks/setup_install.yml index f9e73964..08ac9d03 100644 --- a/roles/matrix-bot-mjolnir/tasks/setup_install.yml +++ b/roles/matrix-bot-mjolnir/tasks/setup_install.yml @@ -15,7 +15,7 @@ - {path: "{{ matrix_bot_mjolnir_config_path }}", when: true} - {path: "{{ matrix_bot_mjolnir_data_path }}", when: true} - {path: "{{ matrix_bot_mjolnir_docker_src_files_path }}", when: "{{ matrix_bot_mjolnir_container_image_self_build }}"} - when: "item.when|bool" + when: "item.when | bool" - name: Ensure mjolnir Docker image is pulled docker_image: @@ -23,7 +23,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_bot_mjolnir_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_bot_mjolnir_docker_image_force_pull }}" - when: "not matrix_bot_mjolnir_container_image_self_build|bool" + when: "not matrix_bot_mjolnir_container_image_self_build | bool" register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -38,7 +38,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_bot_mjolnir_git_pull_results - when: "matrix_bot_mjolnir_container_image_self_build|bool" + when: "matrix_bot_mjolnir_container_image_self_build | bool" - name: Ensure mjolnir Docker image is built docker_image: @@ -49,11 +49,11 @@ dockerfile: Dockerfile path: "{{ matrix_bot_mjolnir_docker_src_files_path }}" pull: true - when: "matrix_bot_mjolnir_container_image_self_build|bool" + when: "matrix_bot_mjolnir_container_image_self_build | bool" - name: Ensure matrix-bot-mjolnir config installed ansible.builtin.copy: - content: "{{ matrix_bot_mjolnir_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_bot_mjolnir_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_bot_mjolnir_config_path }}/production.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -69,10 +69,10 @@ - name: Ensure systemd reloaded after matrix-bot-mjolnir.service installation ansible.builtin.service: daemon_reload: true - when: "matrix_bot_mjolnir_systemd_service_result.changed|bool" + when: "matrix_bot_mjolnir_systemd_service_result.changed | bool" - name: Ensure matrix-bot-mjolnir.service restarted, if necessary ansible.builtin.service: name: "matrix-bot-mjolnir.service" state: restarted - when: "matrix_bot_mjolnir_requires_restart|bool" + when: "matrix_bot_mjolnir_requires_restart | bool" diff --git a/roles/matrix-bot-mjolnir/tasks/setup_uninstall.yml b/roles/matrix-bot-mjolnir/tasks/setup_uninstall.yml index d7a240e7..5c7f4c89 100644 --- a/roles/matrix-bot-mjolnir/tasks/setup_uninstall.yml +++ b/roles/matrix-bot-mjolnir/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-bot-mjolnir service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-bot-mjolnir.service" register: matrix_bot_mjolnir_service_stat @@ -12,18 +12,18 @@ enabled: false daemon_reload: true register: stopping_result - when: "matrix_bot_mjolnir_service_stat.stat.exists|bool" + when: "matrix_bot_mjolnir_service_stat.stat.exists | bool" - name: Ensure matrix-bot-mjolnir.service doesn't exist ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-bot-mjolnir.service" state: absent - when: "matrix_bot_mjolnir_service_stat.stat.exists|bool" + when: "matrix_bot_mjolnir_service_stat.stat.exists | bool" - name: Ensure systemd reloaded after matrix-bot-mjolnir.service removal ansible.builtin.service: daemon_reload: true - when: "matrix_bot_mjolnir_service_stat.stat.exists|bool" + when: "matrix_bot_mjolnir_service_stat.stat.exists | bool" - name: Ensure matrix-bot-mjolnir paths don't exist ansible.builtin.file: diff --git a/roles/matrix-bridge-appservice-discord/defaults/main.yml b/roles/matrix-bridge-appservice-discord/defaults/main.yml index f3e39f24..0d0d35fb 100644 --- a/roles/matrix-bridge-appservice-discord/defaults/main.yml +++ b/roles/matrix-bridge-appservice-discord/defaults/main.yml @@ -87,9 +87,9 @@ matrix_appservice_discord_configuration_extension_yaml: | # If you need something more special, you can take full control by # completely redefining `matrix_appservice_discord_configuration_yaml`. -matrix_appservice_discord_configuration_extension: "{{ matrix_appservice_discord_configuration_extension_yaml|from_yaml if matrix_appservice_discord_configuration_extension_yaml|from_yaml is mapping else {} }}" +matrix_appservice_discord_configuration_extension: "{{ matrix_appservice_discord_configuration_extension_yaml | from_yaml if matrix_appservice_discord_configuration_extension_yaml | from_yaml is mapping else {} }}" -matrix_appservice_discord_configuration: "{{ matrix_appservice_discord_configuration_yaml|from_yaml|combine(matrix_appservice_discord_configuration_extension, recursive=True) }}" +matrix_appservice_discord_configuration: "{{ matrix_appservice_discord_configuration_yaml | from_yaml|combine(matrix_appservice_discord_configuration_extension, recursive=True) }}" matrix_appservice_discord_registration_yaml: | #jinja2: lstrip_blocks: "True" @@ -109,4 +109,4 @@ matrix_appservice_discord_registration_yaml: | protocols: - discord -matrix_appservice_discord_registration: "{{ matrix_appservice_discord_registration_yaml|from_yaml }}" +matrix_appservice_discord_registration: "{{ matrix_appservice_discord_registration_yaml | from_yaml }}" diff --git a/roles/matrix-bridge-appservice-discord/tasks/init.yml b/roles/matrix-bridge-appservice-discord/tasks/init.yml index df3c927b..b9d875da 100644 --- a/roles/matrix-bridge-appservice-discord/tasks/init.yml +++ b/roles/matrix-bridge-appservice-discord/tasks/init.yml @@ -5,25 +5,25 @@ ansible.builtin.fail: msg: >- The matrix-bridge-appservice-discord role needs to execute before the matrix-synapse role. - when: "matrix_appservice_discord_enabled and matrix_synapse_role_executed|default(False)" + when: "matrix_appservice_discord_enabled and matrix_synapse_role_executed | default(False)" - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-appservice-discord.service'] }}" - when: matrix_appservice_discord_enabled|bool + when: matrix_appservice_discord_enabled | bool # If the matrix-synapse role is not used, these variables may not exist. - ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ - matrix_synapse_container_extra_arguments|default([]) + matrix_synapse_container_extra_arguments | default([]) + ["--mount type=bind,src={{ matrix_appservice_discord_config_path }}/registration.yaml,dst=/matrix-appservice-discord-registration.yaml,ro"] }} matrix_synapse_app_service_config_files: > {{ - matrix_synapse_app_service_config_files|default([]) + matrix_synapse_app_service_config_files | default([]) + ["/matrix-appservice-discord-registration.yaml"] }} - when: matrix_appservice_discord_enabled|bool + when: matrix_appservice_discord_enabled | bool diff --git a/roles/matrix-bridge-appservice-discord/tasks/main.yml b/roles/matrix-bridge-appservice-discord/tasks/main.yml index 5df7bfe2..7ab8f3a6 100644 --- a/roles/matrix-bridge-appservice-discord/tasks/main.yml +++ b/roles/matrix-bridge-appservice-discord/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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_appservice_discord_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_appservice_discord_enabled | bool" tags: - setup-all - setup-appservice-discord -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_appservice_discord_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_appservice_discord_enabled | bool" tags: - setup-all - setup-appservice-discord -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_appservice_discord_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_appservice_discord_enabled | bool" tags: - setup-all - setup-appservice-discord diff --git a/roles/matrix-bridge-appservice-discord/tasks/setup_install.yml b/roles/matrix-bridge-appservice-discord/tasks/setup_install.yml index 5e9bf969..4b12442b 100644 --- a/roles/matrix-bridge-appservice-discord/tasks/setup_install.yml +++ b/roles/matrix-bridge-appservice-discord/tasks/setup_install.yml @@ -5,7 +5,7 @@ - block: - name: Check if an SQLite database already exists - stat: + ansible.builtin.stat: path: "{{ matrix_appservice_discord_sqlite_database_path_local }}" register: matrix_appservice_discord_sqlite_database_path_local_stat_result @@ -14,16 +14,16 @@ matrix_postgres_db_migration_request: src: "{{ matrix_appservice_discord_sqlite_database_path_local }}" dst: "{{ matrix_appservice_discord_database_connString }}" - caller: "{{ role_path|basename }}" + caller: "{{ role_path | basename }}" engine_variable_name: 'matrix_appservice_discord_database_engine' engine_old: 'sqlite' systemd_services_to_stop: ['matrix-appservice-discord.service'] - - 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_appservice_discord_requires_restart: true - when: "matrix_appservice_discord_sqlite_database_path_local_stat_result.stat.exists|bool" + when: "matrix_appservice_discord_sqlite_database_path_local_stat_result.stat.exists | bool" when: "matrix_appservice_discord_database_engine == 'postgres'" - name: Ensure Appservice Discord image is pulled @@ -50,7 +50,7 @@ - "{{ matrix_appservice_discord_data_path }}" - name: Check if an old database file already exists - stat: + ansible.builtin.stat: path: "{{ matrix_appservice_discord_base_path }}/discord.db" register: matrix_appservice_discord_stat_db @@ -73,7 +73,7 @@ - name: Ensure AppService Discord config.yaml installed ansible.builtin.copy: - content: "{{ matrix_appservice_discord_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_appservice_discord_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_appservice_discord_config_path }}/config.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -81,7 +81,7 @@ - name: Ensure AppService Discord registration.yaml installed ansible.builtin.copy: - content: "{{ matrix_appservice_discord_registration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_appservice_discord_registration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_appservice_discord_config_path }}/registration.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -116,4 +116,4 @@ ansible.builtin.service: name: "matrix-appservice-discord.service" state: restarted - when: "matrix_appservice_discord_requires_restart|bool" + when: "matrix_appservice_discord_requires_restart | bool" diff --git a/roles/matrix-bridge-appservice-discord/tasks/setup_uninstall.yml b/roles/matrix-bridge-appservice-discord/tasks/setup_uninstall.yml index b844fa7c..83588d1c 100644 --- a/roles/matrix-bridge-appservice-discord/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-appservice-discord/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-appservice-discord service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-appservice-discord.service" register: matrix_appservice_discord_service_stat diff --git a/roles/matrix-bridge-appservice-irc/defaults/main.yml b/roles/matrix-bridge-appservice-irc/defaults/main.yml index 52554f61..19dd9e59 100644 --- a/roles/matrix-bridge-appservice-irc/defaults/main.yml +++ b/roles/matrix-bridge-appservice-irc/defaults/main.yml @@ -382,9 +382,9 @@ matrix_appservice_irc_configuration_extension_yaml: | # If you need something more special, you can take full control by # completely redefining `matrix_appservice_irc_configuration_yaml`. -matrix_appservice_irc_configuration_extension: "{{ matrix_appservice_irc_configuration_extension_yaml|from_yaml if matrix_appservice_irc_configuration_extension_yaml|from_yaml is mapping else {} }}" +matrix_appservice_irc_configuration_extension: "{{ matrix_appservice_irc_configuration_extension_yaml | from_yaml if matrix_appservice_irc_configuration_extension_yaml | from_yaml is mapping else {} }}" -matrix_appservice_irc_configuration: "{{ matrix_appservice_irc_configuration_yaml|from_yaml|combine(matrix_appservice_irc_configuration_extension, recursive=True) }}" +matrix_appservice_irc_configuration: "{{ matrix_appservice_irc_configuration_yaml | from_yaml|combine(matrix_appservice_irc_configuration_extension, recursive=True) }}" # The original registration.yaml file generated by AppService IRC is merged with this config override, # to produce the final registration.yaml file ultimately used by both the bridge and the homeserver. @@ -399,4 +399,4 @@ matrix_appservice_irc_registration_override_yaml: | as_token: "{{ matrix_appservice_irc_appservice_token }}" hs_token: "{{ matrix_appservice_irc_homeserver_token }}" -matrix_appservice_irc_registration_override: "{{ matrix_appservice_irc_registration_override_yaml|from_yaml }}" +matrix_appservice_irc_registration_override: "{{ matrix_appservice_irc_registration_override_yaml | from_yaml }}" diff --git a/roles/matrix-bridge-appservice-irc/tasks/init.yml b/roles/matrix-bridge-appservice-irc/tasks/init.yml index b318f23f..d22dd5d7 100644 --- a/roles/matrix-bridge-appservice-irc/tasks/init.yml +++ b/roles/matrix-bridge-appservice-irc/tasks/init.yml @@ -12,25 +12,25 @@ ansible.builtin.fail: msg: >- The matrix-bridge-appservice-irc role needs to execute before the matrix-synapse role. - when: "matrix_appservice_irc_enabled|bool and matrix_synapse_role_executed|default(False)" + when: "matrix_appservice_irc_enabled | bool and matrix_synapse_role_executed | default(False)" - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-appservice-irc.service'] }}" - when: matrix_appservice_irc_enabled|bool + when: matrix_appservice_irc_enabled | bool # If the matrix-synapse role is not used, these variables may not exist. - ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ - matrix_synapse_container_extra_arguments|default([]) + matrix_synapse_container_extra_arguments | default([]) + ["--mount type=bind,src={{ matrix_appservice_irc_config_path }}/registration.yaml,dst=/matrix-appservice-irc-registration.yaml,ro"] }} matrix_synapse_app_service_config_files: > {{ - matrix_synapse_app_service_config_files|default([]) + matrix_synapse_app_service_config_files | default([]) + ["/matrix-appservice-irc-registration.yaml"] }} - when: matrix_appservice_irc_enabled|bool + when: matrix_appservice_irc_enabled | bool diff --git a/roles/matrix-bridge-appservice-irc/tasks/main.yml b/roles/matrix-bridge-appservice-irc/tasks/main.yml index 339615ea..41d2017b 100644 --- a/roles/matrix-bridge-appservice-irc/tasks/main.yml +++ b/roles/matrix-bridge-appservice-irc/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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_appservice_irc_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_appservice_irc_enabled | bool" tags: - setup-all - setup-appservice-irc -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_appservice_irc_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_appservice_irc_enabled | bool" tags: - setup-all - setup-appservice-irc -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_appservice_irc_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_appservice_irc_enabled | bool" tags: - setup-all - setup-appservice-irc diff --git a/roles/matrix-bridge-appservice-irc/tasks/migrate_nedb_to_postgres.yml b/roles/matrix-bridge-appservice-irc/tasks/migrate_nedb_to_postgres.yml index 486b093b..6b87ab01 100644 --- a/roles/matrix-bridge-appservice-irc/tasks/migrate_nedb_to_postgres.yml +++ b/roles/matrix-bridge-appservice-irc/tasks/migrate_nedb_to_postgres.yml @@ -3,14 +3,14 @@ - name: Fail if Postgres not enabled ansible.builtin.fail: msg: "Postgres via the matrix-postgres role is not enabled (`matrix_postgres_enabled`). Cannot migrate." - when: "not matrix_postgres_enabled|bool" + when: "not matrix_postgres_enabled | bool" # Defaults - name: Set postgres_start_wait_time, if not provided ansible.builtin.set_fact: postgres_start_wait_time: 15 - when: "postgres_start_wait_time|default('') == ''" + when: "postgres_start_wait_time | default('') == ''" # Actual import work @@ -22,14 +22,14 @@ register: matrix_postgres_service_start_result - name: Wait a bit, so that Postgres can start - wait_for: + ansible.builtin.wait_for: timeout: "{{ postgres_start_wait_time }}" delegate_to: 127.0.0.1 become: false - when: "matrix_postgres_service_start_result.changed|bool" + when: "matrix_postgres_service_start_result.changed | bool" - name: Check existence of matrix-appservice-irc service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-appservice-irc.service" register: matrix_appservice_irc_service_stat @@ -64,7 +64,7 @@ ansible.builtin.set_fact: matrix_playbook_runtime_results: | {{ - matrix_playbook_runtime_results|default([]) + matrix_playbook_runtime_results | default([]) + [ "NOTE: Your appservice-irc database files have been imported into Postgres. The original database files have been moved from `{{ matrix_appservice_irc_data_path }}/*.db` to `{{ matrix_appservice_irc_data_path }}/*.db.backup`. When you've confirmed that the import went well and everything works, you should be able to safely delete these files." diff --git a/roles/matrix-bridge-appservice-irc/tasks/setup_install.yml b/roles/matrix-bridge-appservice-irc/tasks/setup_install.yml index d24de340..b04b1ade 100644 --- a/roles/matrix-bridge-appservice-irc/tasks/setup_install.yml +++ b/roles/matrix-bridge-appservice-irc/tasks/setup_install.yml @@ -1,6 +1,6 @@ --- -- import_tasks: "{{ role_path }}/../matrix-base/tasks/util/ensure_openssl_installed.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/../matrix-base/tasks/util/ensure_openssl_installed.yml" - name: Ensure Appservice IRC paths exist ansible.builtin.file: @@ -14,10 +14,10 @@ - {path: "{{ matrix_appservice_irc_config_path }}", when: true} - {path: "{{ matrix_appservice_irc_data_path }}", when: true} - {path: "{{ matrix_appservice_irc_docker_src_files_path }}", when: "{{ matrix_appservice_irc_container_image_self_build }}"} - when: item.when|bool + when: item.when | bool - name: Check if an old passkey file already exists - stat: + ansible.builtin.stat: path: "{{ matrix_appservice_irc_base_path }}/passkey.pem" register: matrix_appservice_irc_stat_passkey @@ -45,16 +45,16 @@ - block: - name: Check if a nedb database already exists - stat: + ansible.builtin.stat: path: "{{ matrix_appservice_irc_data_path }}/users.db" register: matrix_appservice_irc_nedb_database_path_local_stat_result - block: - - import_tasks: "{{ role_path }}/tasks/migrate_nedb_to_postgres.yml" + - ansible.builtin.import_tasks: "{{ role_path }}/tasks/migrate_nedb_to_postgres.yml" - ansible.builtin.set_fact: matrix_appservice_irc_requires_restart: true - when: "matrix_appservice_irc_nedb_database_path_local_stat_result.stat.exists|bool" + when: "matrix_appservice_irc_nedb_database_path_local_stat_result.stat.exists | bool" when: "matrix_appservice_irc_database_engine == 'postgres'" - name: Ensure Appservice IRC image is pulled @@ -63,7 +63,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_appservice_irc_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_appservice_irc_docker_image_force_pull }}" - when: "matrix_appservice_irc_enabled|bool and not matrix_appservice_irc_container_image_self_build|bool" + when: "matrix_appservice_irc_enabled | bool and not matrix_appservice_irc_container_image_self_build | bool" register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -77,7 +77,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_appservice_irc_git_pull_results - when: "matrix_appservice_irc_enabled|bool and matrix_appservice_irc_container_image_self_build|bool" + when: "matrix_appservice_irc_enabled | bool and matrix_appservice_irc_container_image_self_build | bool" - name: Ensure matrix-appservice-irc Docker image is built docker_image: @@ -89,18 +89,18 @@ dockerfile: Dockerfile path: "{{ matrix_appservice_irc_docker_src_files_path }}" pull: true - when: "matrix_appservice_irc_enabled|bool and matrix_appservice_irc_container_image_self_build|bool and matrix_appservice_irc_git_pull_results.changed" + when: "matrix_appservice_irc_enabled | bool and matrix_appservice_irc_container_image_self_build | bool and matrix_appservice_irc_git_pull_results.changed" - name: Ensure Matrix Appservice IRC config installed ansible.builtin.copy: - content: "{{ matrix_appservice_irc_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_appservice_irc_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_appservice_irc_config_path }}/config.yaml" mode: 0644 owner: "{{ matrix_user_username }}" group: "{{ matrix_user_groupname }}" - name: Check if Appservice IRC passkey exists - stat: + ansible.builtin.stat: path: "{{ matrix_appservice_irc_data_path }}/passkey.pem" register: irc_passkey_file @@ -177,7 +177,7 @@ - name: Ensure Appservice IRC registration.yaml installed ansible.builtin.copy: - content: "{{ matrix_appservice_irc_registration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_appservice_irc_registration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_appservice_irc_config_path }}/registration.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -199,4 +199,4 @@ ansible.builtin.service: name: "matrix-appservice-irc.service" state: restarted - when: "matrix_appservice_irc_requires_restart|bool" + when: "matrix_appservice_irc_requires_restart | bool" diff --git a/roles/matrix-bridge-appservice-irc/tasks/setup_uninstall.yml b/roles/matrix-bridge-appservice-irc/tasks/setup_uninstall.yml index 216ec682..176317de 100644 --- a/roles/matrix-bridge-appservice-irc/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-appservice-irc/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-appservice-irc service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-appservice-irc.service" register: matrix_appservice_irc_service_stat diff --git a/roles/matrix-bridge-appservice-slack/defaults/main.yml b/roles/matrix-bridge-appservice-slack/defaults/main.yml index 91a00d3d..8f88c308 100644 --- a/roles/matrix-bridge-appservice-slack/defaults/main.yml +++ b/roles/matrix-bridge-appservice-slack/defaults/main.yml @@ -95,9 +95,9 @@ matrix_appservice_slack_configuration_extension_yaml: | # - "./debug.log": "info" #- "./error.log": "error" -matrix_appservice_slack_configuration_extension: "{{ matrix_appservice_slack_configuration_extension_yaml|from_yaml if matrix_appservice_slack_configuration_extension_yaml|from_yaml else {} }}" +matrix_appservice_slack_configuration_extension: "{{ matrix_appservice_slack_configuration_extension_yaml | from_yaml if matrix_appservice_slack_configuration_extension_yaml | from_yaml else {} }}" -matrix_appservice_slack_configuration: "{{ matrix_appservice_slack_configuration_yaml|from_yaml|combine(matrix_appservice_slack_configuration_extension, recursive=True) }}" +matrix_appservice_slack_configuration: "{{ matrix_appservice_slack_configuration_yaml | from_yaml|combine(matrix_appservice_slack_configuration_extension, recursive=True) }}" matrix_appservice_slack_registration_yaml: | id: "{{ matrix_appservice_slack_id_token }}" @@ -116,4 +116,4 @@ matrix_appservice_slack_registration_yaml: | rate_limited: true protocols: null -matrix_appservice_slack_registration: "{{ matrix_appservice_slack_registration_yaml|from_yaml }}" +matrix_appservice_slack_registration: "{{ matrix_appservice_slack_registration_yaml | from_yaml }}" diff --git a/roles/matrix-bridge-appservice-slack/tasks/init.yml b/roles/matrix-bridge-appservice-slack/tasks/init.yml index 21fee674..b4895aea 100644 --- a/roles/matrix-bridge-appservice-slack/tasks/init.yml +++ b/roles/matrix-bridge-appservice-slack/tasks/init.yml @@ -12,28 +12,28 @@ ansible.builtin.fail: msg: >- The matrix-bridge-appservice-slack role needs to execute before the matrix-synapse role. - when: "matrix_synapse_role_executed|default(False)" + when: "matrix_synapse_role_executed | default(False)" - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-appservice-slack.service'] }}" - when: matrix_appservice_slack_enabled|bool + when: matrix_appservice_slack_enabled | bool # If the matrix-synapse role is not used, these variables may not exist. - ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ - matrix_synapse_container_extra_arguments|default([]) + matrix_synapse_container_extra_arguments | default([]) + ["--mount type=bind,src={{ matrix_appservice_slack_config_path }}/slack-registration.yaml,dst=/matrix-appservice-slack-registration.yaml,ro"] }} matrix_synapse_app_service_config_files: > {{ - matrix_synapse_app_service_config_files|default([]) + matrix_synapse_app_service_config_files | default([]) + ["/matrix-appservice-slack-registration.yaml"] }} - when: matrix_appservice_slack_enabled|bool + when: matrix_appservice_slack_enabled | bool # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # We don't want to fail in such cases. @@ -41,7 +41,7 @@ ansible.builtin.fail: msg: >- The matrix-bridge-appservice-slack role needs to execute before the matrix-synapse role. - when: "matrix_synapse_role_executed|default(False)" + when: "matrix_synapse_role_executed | default(False)" - block: - name: Fail if matrix-nginx-proxy role already executed @@ -51,13 +51,13 @@ but it's pointless since the matrix-nginx-proxy role had already executed. To fix this, please change the order of roles in your playbook, so that the matrix-nginx-proxy role would run after the matrix-bridge-appservice-slack role. - when: matrix_nginx_proxy_role_executed|default(False)|bool + when: matrix_nginx_proxy_role_executed | default(False) | bool - name: Generate Matrix Appservice Slack proxying configuration for matrix-nginx-proxy ansible.builtin.set_fact: matrix_appservice_slack_matrix_nginx_proxy_configuration: | location {{ matrix_appservice_slack_public_endpoint }} { - {% if matrix_nginx_proxy_enabled|default(False) %} + {% if matrix_nginx_proxy_enabled | default(False) %} {# Use the embedded DNS resolver in Docker containers to discover the service #} resolver 127.0.0.11 valid=5s; set $backend "{{ matrix_appservice_slack_appservice_url }}:{{ matrix_appservice_slack_slack_port }}"; @@ -72,13 +72,13 @@ ansible.builtin.set_fact: matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: | {{ - matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([]) + matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks | default([]) + [matrix_appservice_slack_matrix_nginx_proxy_configuration] }} tags: - always - when: matrix_appservice_slack_enabled|bool + when: matrix_appservice_slack_enabled | bool - name: Warn about reverse-proxying if matrix-nginx-proxy not used ansible.builtin.debug: @@ -88,4 +88,4 @@ Please make sure that you're proxying the `{{ something }}` URL endpoint to the matrix-appservice-slack container. You can expose the container's port using the `matrix_appservice_slack_container_http_host_bind_port` variable. - when: "matrix_appservice_slack_enabled|bool and not matrix_nginx_proxy_enabled|default(False)|bool" + when: "matrix_appservice_slack_enabled | bool and not matrix_nginx_proxy_enabled | default(False) | bool" diff --git a/roles/matrix-bridge-appservice-slack/tasks/main.yml b/roles/matrix-bridge-appservice-slack/tasks/main.yml index 06c3abb6..cd83f61f 100644 --- a/roles/matrix-bridge-appservice-slack/tasks/main.yml +++ b/roles/matrix-bridge-appservice-slack/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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_appservice_slack_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_appservice_slack_enabled | bool" tags: - setup-all - setup-appservice-slack -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_appservice_slack_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_appservice_slack_enabled | bool" tags: - setup-all - setup-appservice-slack -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_appservice_slack_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_appservice_slack_enabled | bool" tags: - setup-all - setup-appservice-slack diff --git a/roles/matrix-bridge-appservice-slack/tasks/migrate_nedb_to_postgres.yml b/roles/matrix-bridge-appservice-slack/tasks/migrate_nedb_to_postgres.yml index 6c0dd278..a13d9cc2 100644 --- a/roles/matrix-bridge-appservice-slack/tasks/migrate_nedb_to_postgres.yml +++ b/roles/matrix-bridge-appservice-slack/tasks/migrate_nedb_to_postgres.yml @@ -3,14 +3,14 @@ - name: Fail if Postgres not enabled ansible.builtin.fail: msg: "Postgres via the matrix-postgres role is not enabled (`matrix_postgres_enabled`). Cannot migrate." - when: "not matrix_postgres_enabled|bool" + when: "not matrix_postgres_enabled | bool" # Defaults - name: Set postgres_start_wait_time, if not provided ansible.builtin.set_fact: postgres_start_wait_time: 15 - when: "postgres_start_wait_time|default('') == ''" + when: "postgres_start_wait_time | default('') == ''" # Actual import work @@ -22,11 +22,11 @@ register: matrix_postgres_service_start_result - name: Wait a bit, so that Postgres can start - wait_for: + ansible.builtin.wait_for: timeout: "{{ postgres_start_wait_time }}" delegate_to: 127.0.0.1 become: false - when: "matrix_postgres_service_start_result.changed|bool" + when: "matrix_postgres_service_start_result.changed | bool" - name: Ensure matrix-appservice-slack is stopped ansible.builtin.service: @@ -60,7 +60,7 @@ ansible.builtin.set_fact: matrix_playbook_runtime_results: | {{ - matrix_playbook_runtime_results|default([]) + matrix_playbook_runtime_results | default([]) + [ "NOTE: Your appservice-slack database files have been imported into Postgres. The original database files have been moved from `{{ matrix_appservice_slack_data_path }}/*.db` to `{{ matrix_appservice_slack_data_path }}/*.db.backup`. When you've confirmed that the import went well and everything works, you should be able to safely delete these files." diff --git a/roles/matrix-bridge-appservice-slack/tasks/setup_install.yml b/roles/matrix-bridge-appservice-slack/tasks/setup_install.yml index 5eb860ee..32428f73 100644 --- a/roles/matrix-bridge-appservice-slack/tasks/setup_install.yml +++ b/roles/matrix-bridge-appservice-slack/tasks/setup_install.yml @@ -12,23 +12,23 @@ - {path: "{{ matrix_appservice_slack_config_path }}", when: true} - {path: "{{ matrix_appservice_slack_data_path }}", when: true} - {path: "{{ matrix_appservice_slack_docker_src_files_path }}", when: "{{ matrix_appservice_slack_container_image_self_build }}"} - when: item.when|bool + when: item.when | bool - ansible.builtin.set_fact: matrix_appservice_slack_requires_restart: false - block: - name: Check if a nedb database already exists - stat: + ansible.builtin.stat: path: "{{ matrix_appservice_slack_data_path }}/teams.db" register: matrix_appservice_slack_nedb_database_path_local_stat_result - block: - - import_tasks: "{{ role_path }}/tasks/migrate_nedb_to_postgres.yml" + - ansible.builtin.import_tasks: "{{ role_path }}/tasks/migrate_nedb_to_postgres.yml" - ansible.builtin.set_fact: matrix_appservice_slack_requires_restart: true - when: "matrix_appservice_slack_nedb_database_path_local_stat_result.stat.exists|bool" + when: "matrix_appservice_slack_nedb_database_path_local_stat_result.stat.exists | bool" when: "matrix_appservice_slack_database_engine == 'postgres'" - name: Ensure Appservice Slack image is pulled @@ -37,7 +37,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_appservice_slack_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_appservice_slack_docker_image_force_pull }}" - when: "not matrix_appservice_slack_container_image_self_build|bool" + when: "not matrix_appservice_slack_container_image_self_build | bool" register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -51,7 +51,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_appservice_slack_git_pull_results - when: "matrix_appservice_slack_container_image_self_build|bool" + when: "matrix_appservice_slack_container_image_self_build | bool" - name: Ensure matrix-appservice-slack Docker image is built docker_image: @@ -63,11 +63,11 @@ dockerfile: Dockerfile path: "{{ matrix_appservice_slack_docker_src_files_path }}" pull: true - when: "matrix_appservice_slack_container_image_self_build|bool and matrix_appservice_slack_git_pull_results.changed" + when: "matrix_appservice_slack_container_image_self_build | bool and matrix_appservice_slack_git_pull_results.changed" - name: Ensure Matrix Appservice Slack config installed ansible.builtin.copy: - content: "{{ matrix_appservice_slack_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_appservice_slack_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_appservice_slack_config_path }}/config.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -75,7 +75,7 @@ - name: Ensure appservice-slack registration.yaml installed ansible.builtin.copy: - content: "{{ matrix_appservice_slack_registration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_appservice_slack_registration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_appservice_slack_config_path }}/slack-registration.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -97,4 +97,4 @@ ansible.builtin.service: name: "matrix-appservice-slack.service" state: restarted - when: "matrix_appservice_slack_requires_restart|bool" + when: "matrix_appservice_slack_requires_restart | bool" diff --git a/roles/matrix-bridge-appservice-slack/tasks/setup_uninstall.yml b/roles/matrix-bridge-appservice-slack/tasks/setup_uninstall.yml index fefa9aba..fa1aaf26 100644 --- a/roles/matrix-bridge-appservice-slack/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-appservice-slack/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-appservice-slack service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-appservice-slack.service" register: matrix_appservice_slack_service_stat diff --git a/roles/matrix-bridge-appservice-webhooks/defaults/main.yml b/roles/matrix-bridge-appservice-webhooks/defaults/main.yml index e7ea26ed..0824dc1c 100644 --- a/roles/matrix-bridge-appservice-webhooks/defaults/main.yml +++ b/roles/matrix-bridge-appservice-webhooks/defaults/main.yml @@ -61,9 +61,9 @@ matrix_appservice_webhooks_configuration_yaml: "{{ lookup('template', 'templates matrix_appservice_webhooks_configuration_extension_yaml: | # -matrix_appservice_webhooks_configuration_extension: "{{ matrix_appservice_webhooks_configuration_extension_yaml|from_yaml if matrix_appservice_webhooks_configuration_extension_yaml|from_yaml else {} }}" +matrix_appservice_webhooks_configuration_extension: "{{ matrix_appservice_webhooks_configuration_extension_yaml | from_yaml if matrix_appservice_webhooks_configuration_extension_yaml | from_yaml else {} }}" -matrix_appservice_webhooks_configuration: "{{ matrix_appservice_webhooks_configuration_yaml|from_yaml|combine(matrix_appservice_webhooks_configuration_extension, recursive=True) }}" +matrix_appservice_webhooks_configuration: "{{ matrix_appservice_webhooks_configuration_yaml | from_yaml|combine(matrix_appservice_webhooks_configuration_extension, recursive=True) }}" matrix_appservice_webhooks_registration_yaml: | id: "{{ matrix_appservice_webhooks_id_token }}" @@ -80,4 +80,4 @@ matrix_appservice_webhooks_registration_yaml: | rate_limited: false protocols: null -matrix_appservice_webhooks_registration: "{{ matrix_appservice_webhooks_registration_yaml|from_yaml }}" +matrix_appservice_webhooks_registration: "{{ matrix_appservice_webhooks_registration_yaml | from_yaml }}" diff --git a/roles/matrix-bridge-appservice-webhooks/tasks/init.yml b/roles/matrix-bridge-appservice-webhooks/tasks/init.yml index 6b9fa87e..8a12a686 100644 --- a/roles/matrix-bridge-appservice-webhooks/tasks/init.yml +++ b/roles/matrix-bridge-appservice-webhooks/tasks/init.yml @@ -5,28 +5,28 @@ ansible.builtin.fail: msg: >- The matrix-bridge-appservice-webhooks role needs to execute before the matrix-synapse role. - when: "matrix_synapse_role_executed|default(False)" + when: "matrix_synapse_role_executed | default(False)" - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-appservice-webhooks.service'] }}" - when: matrix_appservice_webhooks_enabled|bool + when: matrix_appservice_webhooks_enabled | bool # If the matrix-synapse role is not used, these variables may not exist. - ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ - matrix_synapse_container_extra_arguments|default([]) + matrix_synapse_container_extra_arguments | default([]) + ["--mount type=bind,src={{ matrix_appservice_webhooks_config_path }}/webhooks-registration.yaml,dst=/matrix-appservice-webhooks-registration.yaml,ro"] }} matrix_synapse_app_service_config_files: > {{ - matrix_synapse_app_service_config_files|default([]) + matrix_synapse_app_service_config_files | default([]) + ["/matrix-appservice-webhooks-registration.yaml"] }} - when: matrix_appservice_webhooks_enabled|bool + when: matrix_appservice_webhooks_enabled | bool # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # We don't want to fail in such cases. @@ -34,7 +34,7 @@ ansible.builtin.fail: msg: >- The matrix-bridge-appservice-webhooks role needs to execute before the matrix-synapse role. - when: "matrix_synapse_role_executed|default(False)" + when: "matrix_synapse_role_executed | default(False)" - block: - name: Fail if matrix-nginx-proxy role already executed @@ -44,12 +44,12 @@ but it's pointless since the matrix-nginx-proxy role had already executed. To fix this, please change the order of roles in your playbook, so that the matrix-nginx-proxy role would run after the matrix-bridge-appservice-webhooks role. - when: matrix_nginx_proxy_role_executed|default(False)|bool + when: matrix_nginx_proxy_role_executed | default(False) | bool - name: Generate Matrix Appservice webhooks proxying configuration for matrix-nginx-proxy ansible.builtin.set_fact: matrix_appservice_webhooks_matrix_nginx_proxy_configuration: | - {% if matrix_nginx_proxy_enabled|default(False) %} + {% if matrix_nginx_proxy_enabled | default(False) %} {# Use the embedded DNS resolver in Docker containers to discover the service #} location ~ ^{{ matrix_appservice_webhooks_public_endpoint }}/(.*)$ { resolver 127.0.0.11 valid=5s; @@ -67,13 +67,13 @@ ansible.builtin.set_fact: matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: | {{ - matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([]) + matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks | default([]) + [matrix_appservice_webhooks_matrix_nginx_proxy_configuration] }} tags: - always - when: matrix_appservice_webhooks_enabled|bool + when: matrix_appservice_webhooks_enabled | bool - name: Warn about reverse-proxying if matrix-nginx-proxy not used ansible.builtin.debug: @@ -83,4 +83,4 @@ Please make sure that you're proxying the `{{ matrix_appservice_webhooks_public_endpoint }}` URL endpoint to the matrix-appservice-webhooks container. You can expose the container's port using the `matrix_appservice_webhooks_container_http_host_bind_port` variable. - when: "matrix_appservice_webhooks_enabled|bool and not matrix_nginx_proxy_enabled|default(False)|bool" + when: "matrix_appservice_webhooks_enabled | bool and not matrix_nginx_proxy_enabled | default(False) | bool" diff --git a/roles/matrix-bridge-appservice-webhooks/tasks/main.yml b/roles/matrix-bridge-appservice-webhooks/tasks/main.yml index 26a7e24c..30f05469 100644 --- a/roles/matrix-bridge-appservice-webhooks/tasks/main.yml +++ b/roles/matrix-bridge-appservice-webhooks/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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_appservice_webhooks_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_appservice_webhooks_enabled | bool" tags: - setup-all - setup-appservice-webhooks -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_appservice_webhooks_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_appservice_webhooks_enabled | bool" tags: - setup-all - setup-appservice-webhooks -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_appservice_webhooks_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_appservice_webhooks_enabled | bool" tags: - setup-all - setup-appservice-webhooks diff --git a/roles/matrix-bridge-appservice-webhooks/tasks/setup_install.yml b/roles/matrix-bridge-appservice-webhooks/tasks/setup_install.yml index 9228b617..603f9d1d 100644 --- a/roles/matrix-bridge-appservice-webhooks/tasks/setup_install.yml +++ b/roles/matrix-bridge-appservice-webhooks/tasks/setup_install.yml @@ -12,7 +12,7 @@ - {path: "{{ matrix_appservice_webhooks_config_path }}", when: true} - {path: "{{ matrix_appservice_webhooks_data_path }}", when: true} - {path: "{{ matrix_appservice_webhooks_docker_src_files_path }}", when: "{{ matrix_appservice_webhooks_container_image_self_build }}"} - when: "item.when|bool" + when: "item.when | bool" - name: Ensure Appservice webhooks image is pulled docker_image: @@ -20,7 +20,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_appservice_webhooks_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_appservice_webhooks_docker_image_force_pull }}" - when: "not matrix_appservice_webhooks_container_image_self_build|bool" + when: "not matrix_appservice_webhooks_container_image_self_build | bool" register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -47,11 +47,11 @@ dockerfile: "{{ matrix_appservice_webhooks_container_image_self_build_repo_dockerfile_path }}" path: "{{ matrix_appservice_webhooks_docker_src_files_path }}" pull: true - when: "matrix_appservice_webhooks_container_image_self_build|bool" + when: "matrix_appservice_webhooks_container_image_self_build | bool" - name: Ensure Matrix Appservice webhooks config is installed ansible.builtin.copy: - content: "{{ matrix_appservice_webhooks_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_appservice_webhooks_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_appservice_webhooks_config_path }}/config.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -75,7 +75,7 @@ - name: Ensure appservice-webhooks registration.yaml installed ansible.builtin.copy: - content: "{{ matrix_appservice_webhooks_registration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_appservice_webhooks_registration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_appservice_webhooks_config_path }}/webhooks-registration.yaml" mode: 0644 owner: "{{ matrix_user_username }}" diff --git a/roles/matrix-bridge-appservice-webhooks/tasks/setup_uninstall.yml b/roles/matrix-bridge-appservice-webhooks/tasks/setup_uninstall.yml index 8da6f8c2..2b3c29d5 100644 --- a/roles/matrix-bridge-appservice-webhooks/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-appservice-webhooks/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-appservice-webhooks service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-appservice-webhooks.service" register: matrix_appservice_webhooks_service_stat diff --git a/roles/matrix-bridge-beeper-linkedin/defaults/main.yml b/roles/matrix-bridge-beeper-linkedin/defaults/main.yml index 498e4894..18ca90e9 100644 --- a/roles/matrix-bridge-beeper-linkedin/defaults/main.yml +++ b/roles/matrix-bridge-beeper-linkedin/defaults/main.yml @@ -88,11 +88,11 @@ matrix_beeper_linkedin_configuration_extension_yaml: | # If you need something more special, you can take full control by # completely redefining `matrix_beeper_linkedin_configuration_yaml`. -matrix_beeper_linkedin_configuration_extension: "{{ matrix_beeper_linkedin_configuration_extension_yaml|from_yaml if matrix_beeper_linkedin_configuration_extension_yaml|from_yaml is mapping else {} }}" +matrix_beeper_linkedin_configuration_extension: "{{ matrix_beeper_linkedin_configuration_extension_yaml | from_yaml if matrix_beeper_linkedin_configuration_extension_yaml | from_yaml is mapping else {} }}" # Holds the final configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_beeper_linkedin_configuration_yaml`. -matrix_beeper_linkedin_configuration: "{{ matrix_beeper_linkedin_configuration_yaml|from_yaml|combine(matrix_beeper_linkedin_configuration_extension, recursive=True) }}" +matrix_beeper_linkedin_configuration: "{{ matrix_beeper_linkedin_configuration_yaml | from_yaml|combine(matrix_beeper_linkedin_configuration_extension, recursive=True) }}" matrix_beeper_linkedin_registration_yaml: | id: linkedin @@ -110,4 +110,4 @@ matrix_beeper_linkedin_registration_yaml: | regex: '^@{{ matrix_beeper_linkedin_appservice_bot_username|regex_escape }}:{{ matrix_beeper_linkedin_homeserver_domain|regex_escape }}$' de.sorunome.msc2409.push_ephemeral: true -matrix_beeper_linkedin_registration: "{{ matrix_beeper_linkedin_registration_yaml|from_yaml }}" +matrix_beeper_linkedin_registration: "{{ matrix_beeper_linkedin_registration_yaml | from_yaml }}" diff --git a/roles/matrix-bridge-beeper-linkedin/tasks/init.yml b/roles/matrix-bridge-beeper-linkedin/tasks/init.yml index 6de40974..14137b70 100644 --- a/roles/matrix-bridge-beeper-linkedin/tasks/init.yml +++ b/roles/matrix-bridge-beeper-linkedin/tasks/init.yml @@ -2,21 +2,21 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-beeper-linkedin.service'] }}" - when: matrix_beeper_linkedin_enabled|bool + when: matrix_beeper_linkedin_enabled | bool # If the matrix-synapse role is not used, these variables may not exist. - ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ - matrix_synapse_container_extra_arguments|default([]) + matrix_synapse_container_extra_arguments | default([]) + ["--mount type=bind,src={{ matrix_beeper_linkedin_config_path }}/registration.yaml,dst=/matrix-beeper-linkedin-registration.yaml,ro"] }} matrix_synapse_app_service_config_files: > {{ - matrix_synapse_app_service_config_files|default([]) + matrix_synapse_app_service_config_files | default([]) + ["/matrix-beeper-linkedin-registration.yaml"] }} - when: matrix_beeper_linkedin_enabled|bool + when: matrix_beeper_linkedin_enabled | bool diff --git a/roles/matrix-bridge-beeper-linkedin/tasks/main.yml b/roles/matrix-bridge-beeper-linkedin/tasks/main.yml index 920265fb..8f295d2c 100644 --- a/roles/matrix-bridge-beeper-linkedin/tasks/main.yml +++ b/roles/matrix-bridge-beeper-linkedin/tasks/main.yml @@ -1,22 +1,22 @@ --- -- 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_beeper_linkedin_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_beeper_linkedin_enabled | bool" tags: - setup-all - setup-beeper-linkedin -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" when: "run_setup and matrix_beeper_linkedin_enabled" tags: - setup-all - setup-beeper-linkedin -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" when: "run_setup and not matrix_beeper_linkedin_enabled" tags: - setup-all diff --git a/roles/matrix-bridge-beeper-linkedin/tasks/setup_install.yml b/roles/matrix-bridge-beeper-linkedin/tasks/setup_install.yml index 73794efe..bfbc1a6b 100644 --- a/roles/matrix-bridge-beeper-linkedin/tasks/setup_install.yml +++ b/roles/matrix-bridge-beeper-linkedin/tasks/setup_install.yml @@ -6,7 +6,7 @@ ansible.builtin.fail: msg: >- The matrix-bridge-beeper-linkedin role needs to execute before the matrix-synapse role. - when: "matrix_synapse_role_executed|default(False)" + when: "matrix_synapse_role_executed | default(False)" - name: Ensure Beeper LinkedIn paths exists ansible.builtin.file: path: "{{ item.path }}" @@ -19,7 +19,7 @@ - {path: "{{ matrix_beeper_linkedin_config_path }}", when: true} - {path: "{{ matrix_beeper_linkedin_data_path }}", when: true} - {path: "{{ matrix_beeper_linkedin_docker_src_files_path }}", when: "{{ matrix_beeper_linkedin_container_image_self_build }}"} - when: "item.when|bool" + when: "item.when | bool" - name: Ensure Beeper LinkedIn image is pulled @@ -28,7 +28,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_beeper_linkedin_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_beeper_linkedin_docker_image_force_pull }}" - when: "not matrix_beeper_linkedin_container_image_self_build|bool" + when: "not matrix_beeper_linkedin_container_image_self_build | bool" register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -69,11 +69,11 @@ pull: true args: TARGETARCH: "{{ matrix_architecture }}" - when: "matrix_beeper_linkedin_container_image_self_build|bool" + when: "matrix_beeper_linkedin_container_image_self_build | bool" - name: Ensure beeper-linkedin config.yaml installed ansible.builtin.copy: - content: "{{ matrix_beeper_linkedin_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_beeper_linkedin_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_beeper_linkedin_config_path }}/config.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -81,7 +81,7 @@ - name: Ensure beeper-linkedin registration.yaml installed ansible.builtin.copy: - content: "{{ matrix_beeper_linkedin_registration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_beeper_linkedin_registration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_beeper_linkedin_config_path }}/registration.yaml" mode: 0644 owner: "{{ matrix_user_username }}" diff --git a/roles/matrix-bridge-beeper-linkedin/tasks/setup_uninstall.yml b/roles/matrix-bridge-beeper-linkedin/tasks/setup_uninstall.yml index be2b198f..25dbf82b 100644 --- a/roles/matrix-bridge-beeper-linkedin/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-beeper-linkedin/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-beeper-linkedin service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-beeper-linkedin.service" register: matrix_beeper_linkedin_service_stat diff --git a/roles/matrix-bridge-go-skype-bridge/defaults/main.yml b/roles/matrix-bridge-go-skype-bridge/defaults/main.yml index 5e31b045..dd08fc40 100644 --- a/roles/matrix-bridge-go-skype-bridge/defaults/main.yml +++ b/roles/matrix-bridge-go-skype-bridge/defaults/main.yml @@ -101,11 +101,11 @@ matrix_go_skype_bridge_configuration_extension_yaml: | # If you need something more special, you can take full control by # completely redefining `matrix_go_skype_bridge_configuration_yaml`. -matrix_go_skype_bridge_configuration_extension: "{{ matrix_go_skype_bridge_configuration_extension_yaml|from_yaml if matrix_go_skype_bridge_configuration_extension_yaml|from_yaml is mapping else {} }}" +matrix_go_skype_bridge_configuration_extension: "{{ matrix_go_skype_bridge_configuration_extension_yaml | from_yaml if matrix_go_skype_bridge_configuration_extension_yaml | from_yaml is mapping else {} }}" # Holds the final configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_go_skype_bridge_configuration_yaml`. -matrix_go_skype_bridge_configuration: "{{ matrix_go_skype_bridge_configuration_yaml|from_yaml|combine(matrix_go_skype_bridge_configuration_extension, recursive=True) }}" +matrix_go_skype_bridge_configuration: "{{ matrix_go_skype_bridge_configuration_yaml | from_yaml|combine(matrix_go_skype_bridge_configuration_extension, recursive=True) }}" matrix_go_skype_bridge_registration_yaml: | id: skype @@ -123,7 +123,7 @@ matrix_go_skype_bridge_registration_yaml: | regex: '^@{{ matrix_go_skype_bridge_appservice_bot_username|regex_escape }}:{{ matrix_go_skype_bridge_homeserver_domain|regex_escape }}$' de.sorunome.msc2409.push_ephemeral: true -matrix_go_skype_bridge_registration: "{{ matrix_go_skype_bridge_registration_yaml|from_yaml }}" +matrix_go_skype_bridge_registration: "{{ matrix_go_skype_bridge_registration_yaml | from_yaml }}" # Enable End-to-bridge encryption matrix_go_skype_bridge_bridge_encryption_allow: false diff --git a/roles/matrix-bridge-go-skype-bridge/tasks/init.yml b/roles/matrix-bridge-go-skype-bridge/tasks/init.yml index 81baaa24..9b826556 100644 --- a/roles/matrix-bridge-go-skype-bridge/tasks/init.yml +++ b/roles/matrix-bridge-go-skype-bridge/tasks/init.yml @@ -1,21 +1,21 @@ --- - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-go-skype-bridge.service'] }}" - when: matrix_go_skype_bridge_enabled|bool + when: matrix_go_skype_bridge_enabled | bool # If the matrix-synapse role is not used, these variables may not exist. - ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ - matrix_synapse_container_extra_arguments|default([]) + matrix_synapse_container_extra_arguments | default([]) + ["--mount type=bind,src={{ matrix_go_skype_bridge_config_path }}/registration.yaml,dst=/matrix-go-skype-bridge-registration.yaml,ro"] }} matrix_synapse_app_service_config_files: > {{ - matrix_synapse_app_service_config_files|default([]) + matrix_synapse_app_service_config_files | default([]) + ["/matrix-go-skype-bridge-registration.yaml"] }} - when: matrix_go_skype_bridge_enabled|bool + when: matrix_go_skype_bridge_enabled | bool diff --git a/roles/matrix-bridge-go-skype-bridge/tasks/main.yml b/roles/matrix-bridge-go-skype-bridge/tasks/main.yml index 456ea53c..39f4b2e5 100644 --- a/roles/matrix-bridge-go-skype-bridge/tasks/main.yml +++ b/roles/matrix-bridge-go-skype-bridge/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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_go_skype_bridge_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_go_skype_bridge_enabled | bool" tags: - setup-all - setup-go-skype-bridge -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_go_skype_bridge_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_go_skype_bridge_enabled | bool" tags: - setup-all - setup-go-skype-bridge -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_go_skype_bridge_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_go_skype_bridge_enabled | bool" tags: - setup-all - setup-go-skype-bridge diff --git a/roles/matrix-bridge-go-skype-bridge/tasks/setup_install.yml b/roles/matrix-bridge-go-skype-bridge/tasks/setup_install.yml index d43941d4..ba37c59c 100644 --- a/roles/matrix-bridge-go-skype-bridge/tasks/setup_install.yml +++ b/roles/matrix-bridge-go-skype-bridge/tasks/setup_install.yml @@ -6,14 +6,14 @@ ansible.builtin.fail: msg: >- The matrix-bridge-go-skype-bridge role needs to execute before the matrix-synapse role. - when: "matrix_synapse_role_executed|default(False)" + when: "matrix_synapse_role_executed | default(False)" - ansible.builtin.set_fact: matrix_go_skype_bridge_requires_restart: false - block: - name: Check if an SQLite database already exists - stat: + ansible.builtin.stat: path: "{{ matrix_go_skype_bridge_sqlite_database_path_local }}" register: matrix_go_skype_bridge_sqlite_database_path_local_stat_result @@ -22,17 +22,17 @@ matrix_postgres_db_migration_request: src: "{{ matrix_go_skype_bridge_sqlite_database_path_local }}" dst: "{{ matrix_go_skype_bridge_database_connection_string }}" - caller: "{{ role_path|basename }}" + caller: "{{ role_path | basename }}" engine_variable_name: 'matrix_go_skype_bridge_database_engine' engine_old: 'sqlite' systemd_services_to_stop: ['matrix-go-skype-bridge.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_go_skype_bridge_requires_restart: true - when: "matrix_go_skype_bridge_sqlite_database_path_local_stat_result.stat.exists|bool" + when: "matrix_go_skype_bridge_sqlite_database_path_local_stat_result.stat.exists | bool" when: "matrix_go_skype_bridge_database_engine == 'postgres'" @@ -48,7 +48,7 @@ - {path: "{{ matrix_go_skype_bridge_config_path }}", when: true} - {path: "{{ matrix_go_skype_bridge_data_path }}", when: true} - {path: "{{ matrix_go_skype_bridge_docker_src_files_path }}", when: "{{ matrix_go_skype_bridge_container_image_self_build }}"} - when: item.when|bool + when: item.when | bool - name: Ensure Go Skype Bridge image is pulled docker_image: @@ -71,7 +71,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_go_skype_bridge_git_pull_results - when: "matrix_go_skype_bridge_container_image_self_build|bool" + when: "matrix_go_skype_bridge_container_image_self_build | bool" - name: Ensure Go Skype Bridge Docker image is built docker_image: @@ -83,15 +83,15 @@ dockerfile: Dockerfile path: "{{ matrix_go_skype_bridge_docker_src_files_path }}" pull: true - when: "matrix_go_skype_bridge_container_image_self_build|bool" + when: "matrix_go_skype_bridge_container_image_self_build | bool" - name: Check if an old database file exists - stat: + ansible.builtin.stat: path: "{{ matrix_go_skype_bridge_base_path }}/go-skype-bridge.db" register: matrix_go_skype_bridge_stat_database - name: Check if an old matrix state file exists - stat: + ansible.builtin.stat: path: "{{ matrix_go_skype_bridge_base_path }}/mx-state.json" register: matrix_go_skype_bridge_stat_mx_state @@ -114,7 +114,7 @@ - name: Ensure go-skype-bridge config.yaml installed ansible.builtin.copy: - content: "{{ matrix_go_skype_bridge_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_go_skype_bridge_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_go_skype_bridge_config_path }}/config.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -122,7 +122,7 @@ - name: Ensure go-skype-bridge registration.yaml installed ansible.builtin.copy: - content: "{{ matrix_go_skype_bridge_registration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_go_skype_bridge_registration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_go_skype_bridge_config_path }}/registration.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -144,4 +144,4 @@ ansible.builtin.service: name: "matrix-go-skype-bridge.service" state: restarted - when: "matrix_go_skype_bridge_requires_restart|bool" + when: "matrix_go_skype_bridge_requires_restart | bool" diff --git a/roles/matrix-bridge-go-skype-bridge/tasks/setup_uninstall.yml b/roles/matrix-bridge-go-skype-bridge/tasks/setup_uninstall.yml index 138cdbf1..975b25ab 100644 --- a/roles/matrix-bridge-go-skype-bridge/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-go-skype-bridge/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-go-skype-bridge service - stat: + ansible.builtin.stat: path: "/etc/systemd/system/matrix-go-skype-bridge.service" register: matrix_go_skype_bridge_service_stat diff --git a/roles/matrix-bridge-heisenbridge/defaults/main.yml b/roles/matrix-bridge-heisenbridge/defaults/main.yml index e8d2c790..68c5d75b 100644 --- a/roles/matrix-bridge-heisenbridge/defaults/main.yml +++ b/roles/matrix-bridge-heisenbridge/defaults/main.yml @@ -45,4 +45,4 @@ matrix_heisenbridge_registration_yaml: aliases: [] rooms: [] -matrix_heisenbridge_registration: "{{ matrix_heisenbridge_registration_yaml|from_yaml }}" +matrix_heisenbridge_registration: "{{ matrix_heisenbridge_registration_yaml | from_yaml }}" diff --git a/roles/matrix-bridge-heisenbridge/tasks/init.yml b/roles/matrix-bridge-heisenbridge/tasks/init.yml index dd08beb5..1612a505 100644 --- a/roles/matrix-bridge-heisenbridge/tasks/init.yml +++ b/roles/matrix-bridge-heisenbridge/tasks/init.yml @@ -5,25 +5,25 @@ ansible.builtin.fail: msg: >- The matrix-bridge-heisenbridge role needs to execute before the matrix-synapse role. - when: "matrix_heisenbridge_enabled and matrix_synapse_role_executed|default(False)" + when: "matrix_heisenbridge_enabled and matrix_synapse_role_executed | default(False)" - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-heisenbridge.service'] }}" - when: matrix_heisenbridge_enabled|bool + when: matrix_heisenbridge_enabled | bool # If the matrix-synapse role is not used, these variables may not exist. - ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ - matrix_synapse_container_extra_arguments|default([]) + matrix_synapse_container_extra_arguments | default([]) + ["--mount type=bind,src={{ matrix_heisenbridge_base_path }}/registration.yaml,dst=/heisenbridge-registration.yaml,ro"] }} matrix_synapse_app_service_config_files: > {{ - matrix_synapse_app_service_config_files|default([]) + matrix_synapse_app_service_config_files | default([]) + ["/heisenbridge-registration.yaml"] }} - when: matrix_heisenbridge_enabled|bool + when: matrix_heisenbridge_enabled | bool diff --git a/roles/matrix-bridge-heisenbridge/tasks/main.yml b/roles/matrix-bridge-heisenbridge/tasks/main.yml index a266643d..6af9813e 100644 --- a/roles/matrix-bridge-heisenbridge/tasks/main.yml +++ b/roles/matrix-bridge-heisenbridge/tasks/main.yml @@ -1,17 +1,17 @@ --- -- import_tasks: "{{ role_path }}/tasks/init.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/init.yml" tags: - always -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_heisenbridge_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_heisenbridge_enabled | bool" tags: - setup-all - setup-heisenbridge -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_heisenbridge_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_heisenbridge_enabled | bool" tags: - setup-all - setup-heisenbridge diff --git a/roles/matrix-bridge-heisenbridge/tasks/setup_install.yml b/roles/matrix-bridge-heisenbridge/tasks/setup_install.yml index 4112f047..ffcc1c8b 100644 --- a/roles/matrix-bridge-heisenbridge/tasks/setup_install.yml +++ b/roles/matrix-bridge-heisenbridge/tasks/setup_install.yml @@ -23,7 +23,7 @@ - name: Ensure heisenbridge registration.yaml installed if provided ansible.builtin.copy: - content: "{{ matrix_heisenbridge_registration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_heisenbridge_registration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_heisenbridge_base_path }}/registration.yaml" mode: 0644 owner: "{{ matrix_user_username }}" diff --git a/roles/matrix-bridge-heisenbridge/tasks/setup_uninstall.yml b/roles/matrix-bridge-heisenbridge/tasks/setup_uninstall.yml index c3bf7950..a0232295 100644 --- a/roles/matrix-bridge-heisenbridge/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-heisenbridge/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-heisenbridge service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-heisenbridge.service" register: matrix_heisenbridge_service_stat diff --git a/roles/matrix-bridge-hookshot/defaults/main.yml b/roles/matrix-bridge-hookshot/defaults/main.yml index 74f98bac..ed99ef6d 100644 --- a/roles/matrix-bridge-hookshot/defaults/main.yml +++ b/roles/matrix-bridge-hookshot/defaults/main.yml @@ -233,11 +233,11 @@ matrix_hookshot_configuration_extension_yaml: | # If you need something more special, you can take full control by # completely redefining `matrix_hookshot_configuration_yaml`. -matrix_hookshot_configuration_extension: "{{ matrix_hookshot_configuration_extension_yaml|from_yaml if matrix_hookshot_configuration_extension_yaml|from_yaml is mapping else {} }}" +matrix_hookshot_configuration_extension: "{{ matrix_hookshot_configuration_extension_yaml | from_yaml if matrix_hookshot_configuration_extension_yaml | from_yaml is mapping else {} }}" # Holds the final configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_hookshot_configuration_yaml`. -matrix_hookshot_configuration: "{{ matrix_hookshot_configuration_yaml|from_yaml|combine(matrix_hookshot_configuration_extension, recursive=True) }}" +matrix_hookshot_configuration: "{{ matrix_hookshot_configuration_yaml | from_yaml|combine(matrix_hookshot_configuration_extension, recursive=True) }}" # Default registration template which covers the generic use case. # You can customize it by controlling the various variables inside it. @@ -255,8 +255,8 @@ matrix_hookshot_registration_extension_yaml: | # If you need something more special, you can take full control by # completely redefining `matrix_hookshot_registration_yaml`. -matrix_hookshot_registration_extension: "{{ matrix_hookshot_registration_extension_yaml|from_yaml if matrix_hookshot_registration_extension_yaml|from_yaml is mapping else {} }}" +matrix_hookshot_registration_extension: "{{ matrix_hookshot_registration_extension_yaml | from_yaml if matrix_hookshot_registration_extension_yaml | from_yaml is mapping else {} }}" # Holds the final registration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_hookshot_registration_yaml`. -matrix_hookshot_registration: "{{ matrix_hookshot_registration_yaml|from_yaml|combine(matrix_hookshot_registration_extension, recursive=True) }}" +matrix_hookshot_registration: "{{ matrix_hookshot_registration_yaml | from_yaml|combine(matrix_hookshot_registration_extension, recursive=True) }}" diff --git a/roles/matrix-bridge-hookshot/tasks/init.yml b/roles/matrix-bridge-hookshot/tasks/init.yml index 5ac8c4f2..f8a1e76c 100644 --- a/roles/matrix-bridge-hookshot/tasks/init.yml +++ b/roles/matrix-bridge-hookshot/tasks/init.yml @@ -5,28 +5,28 @@ ansible.builtin.fail: msg: >- The matrix-bridge-hookshot role needs to execute before the matrix-synapse role. - when: "matrix_hookshot_enabled and matrix_synapse_role_executed|default(False)" + when: "matrix_hookshot_enabled and matrix_synapse_role_executed | default(False)" - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-hookshot.service'] }}" - when: matrix_hookshot_enabled|bool + when: matrix_hookshot_enabled | bool # If the matrix-synapse role is not used, these variables may not exist. - ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ - matrix_synapse_container_extra_arguments|default([]) + matrix_synapse_container_extra_arguments | default([]) + ["--mount type=bind,src={{ matrix_hookshot_base_path }}/registration.yml,dst=/hookshot-registration.yml,ro"] }} matrix_synapse_app_service_config_files: > {{ - matrix_synapse_app_service_config_files|default([]) + matrix_synapse_app_service_config_files | default([]) + ["/hookshot-registration.yml"] }} - when: matrix_hookshot_enabled|bool + when: matrix_hookshot_enabled | bool - block: - name: Fail if matrix-nginx-proxy role already executed @@ -36,13 +36,13 @@ but it's pointless since the matrix-nginx-proxy role had already executed. To fix this, please change the order of roles in your playbook, so that the matrix-nginx-proxy role would run after the matrix-bridge-hookshot role. - when: matrix_nginx_proxy_role_executed|default(False)|bool + when: matrix_nginx_proxy_role_executed | default(False) | bool - name: Generate Matrix hookshot proxying configuration for matrix-nginx-proxy ansible.builtin.set_fact: matrix_hookshot_matrix_nginx_proxy_configuration: | location ~ ^{{ matrix_hookshot_appservice_endpoint }}/(.*)$ { - {% if matrix_nginx_proxy_enabled|default(False) %} + {% if matrix_nginx_proxy_enabled | default(False) %} {# Use the embedded DNS resolver in Docker containers to discover the service #} resolver 127.0.0.11 valid=5s; set $backend "{{ matrix_hookshot_container_url }}:{{ matrix_hookshot_appservice_port }}"; @@ -55,7 +55,7 @@ } {% if matrix_hookshot_provisioning_enabled %} location ~ ^{{ matrix_hookshot_provisioning_endpoint }}/(.*)$ { - {% if matrix_nginx_proxy_enabled|default(False) %} + {% if matrix_nginx_proxy_enabled | default(False) %} {# Use the embedded DNS resolver in Docker containers to discover the service #} resolver 127.0.0.11 valid=5s; set $backend "{{ matrix_hookshot_container_url }}:{{ matrix_hookshot_provisioning_port }}"; @@ -69,7 +69,7 @@ {% endif %} {% if matrix_hookshot_widgets_enabled %} location ~ ^{{ matrix_hookshot_widgets_endpoint }}/(.*)$ { - {% if matrix_nginx_proxy_enabled|default(False) %} + {% if matrix_nginx_proxy_enabled | default(False) %} {# Use the embedded DNS resolver in Docker containers to discover the service #} resolver 127.0.0.11 valid=5s; set $backend "{{ matrix_hookshot_container_url }}:{{ matrix_hookshot_widgets_port }}"; @@ -82,7 +82,7 @@ } {% endif %} location ~ ^{{ matrix_hookshot_webhook_endpoint }}/(.*)$ { - {% if matrix_nginx_proxy_enabled|default(False) %} + {% if matrix_nginx_proxy_enabled | default(False) %} {# Use the embedded DNS resolver in Docker containers to discover the service #} resolver 127.0.0.11 valid=5s; set $backend "{{ matrix_hookshot_container_url }}:{{ matrix_hookshot_webhook_port }}"; @@ -98,7 +98,7 @@ ansible.builtin.set_fact: matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: | {{ - matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([]) + matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks | default([]) + [matrix_hookshot_matrix_nginx_proxy_configuration] }} @@ -107,7 +107,7 @@ ansible.builtin.set_fact: matrix_hookshot_matrix_nginx_proxy_metrics_configuration_matrix_domain: | location /metrics/hookshot { - {% if matrix_nginx_proxy_enabled|default(False) %} + {% if matrix_nginx_proxy_enabled | default(False) %} {# Use the embedded DNS resolver in Docker containers to discover the service #} resolver 127.0.0.11 valid=5s; set $backend "{{ matrix_hookshot_container_url }}:{{ matrix_hookshot_metrics_port }}"; @@ -117,18 +117,18 @@ proxy_pass http://127.0.0.1:{{ matrix_hookshot_metrics_port }}/metrics; {% endif %} } - when: matrix_hookshot_metrics_enabled|bool and matrix_hookshot_metrics_proxying_enabled|bool + when: matrix_hookshot_metrics_enabled | bool and matrix_hookshot_metrics_proxying_enabled | bool - name: Register hookshot metrics proxying configuration with matrix-nginx-proxy (matrix.DOMAIN/metrics/hookshot) ansible.builtin.set_fact: matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks: | {{ - matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks|default([]) + matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks | default([]) + [matrix_hookshot_matrix_nginx_proxy_metrics_configuration_matrix_domain] }} - when: matrix_hookshot_metrics_enabled|bool and matrix_hookshot_metrics_proxying_enabled|bool - when: matrix_hookshot_enabled|bool + when: matrix_hookshot_metrics_enabled | bool and matrix_hookshot_metrics_proxying_enabled | bool + when: matrix_hookshot_enabled | bool - name: Warn about reverse-proxying if matrix-nginx-proxy not used ansible.builtin.debug: @@ -138,4 +138,4 @@ Please make sure that you're proxying the `{{ matrix_hookshot_public_endpoint }}` URL endpoint to the matrix-hookshot container. You can expose the container's ports using the `matrix_hookshot_container_http_host_bind_ports` variable. - when: "matrix_hookshot_enabled|bool and not matrix_nginx_proxy_enabled|default(False)|bool" + when: "matrix_hookshot_enabled | bool and not matrix_nginx_proxy_enabled | default(False) | bool" diff --git a/roles/matrix-bridge-hookshot/tasks/main.yml b/roles/matrix-bridge-hookshot/tasks/main.yml index 409b6175..99febe11 100644 --- a/roles/matrix-bridge-hookshot/tasks/main.yml +++ b/roles/matrix-bridge-hookshot/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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_hookshot_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_hookshot_enabled | bool" tags: - setup-all - setup-hookshot -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_hookshot_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_hookshot_enabled | bool" tags: - setup-all - setup-hookshot -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_hookshot_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_hookshot_enabled | bool" tags: - setup-all - setup-hookshot diff --git a/roles/matrix-bridge-hookshot/tasks/setup_install.yml b/roles/matrix-bridge-hookshot/tasks/setup_install.yml index eb5e9a98..e1ced948 100644 --- a/roles/matrix-bridge-hookshot/tasks/setup_install.yml +++ b/roles/matrix-bridge-hookshot/tasks/setup_install.yml @@ -1,6 +1,6 @@ --- -- import_tasks: "{{ role_path }}/../matrix-base/tasks/util/ensure_openssl_installed.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/../matrix-base/tasks/util/ensure_openssl_installed.yml" - name: Ensure hookshot paths exist ansible.builtin.file: @@ -12,7 +12,7 @@ with_items: - {path: "{{ matrix_hookshot_base_path }}", when: true} - {path: "{{ matrix_hookshot_docker_src_files_path }}", when: "{{ matrix_hookshot_container_image_self_build }}"} - when: item.when|bool + when: item.when | bool - name: Ensure hookshot image is pulled docker_image: @@ -35,7 +35,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_hookshot_git_pull_results - when: "matrix_hookshot_container_image_self_build|bool" + when: "matrix_hookshot_container_image_self_build | bool" - name: Ensure hookshot Docker image is built docker_image: @@ -47,10 +47,10 @@ dockerfile: Dockerfile path: "{{ matrix_hookshot_docker_src_files_path }}" pull: true - when: "matrix_hookshot_container_image_self_build|bool" + when: "matrix_hookshot_container_image_self_build | bool" - name: Check if hookshot passkey exists - stat: + ansible.builtin.stat: path: "{{ matrix_hookshot_base_path }}/passkey.pem" register: hookshot_passkey_file @@ -62,7 +62,7 @@ - name: Ensure hookshot config.yml installed if provided ansible.builtin.copy: - content: "{{ matrix_hookshot_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_hookshot_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_hookshot_base_path }}/config.yml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -86,7 +86,7 @@ - name: Ensure hookshot registration.yml installed if provided ansible.builtin.copy: - content: "{{ matrix_hookshot_registration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_hookshot_registration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_hookshot_base_path }}/registration.yml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -99,7 +99,7 @@ mode: 0400 owner: "{{ matrix_user_username }}" group: "{{ matrix_user_groupname }}" - when: matrix_hookshot_github_enabled|bool and matrix_hookshot_github_private_key|length > 0 + when: matrix_hookshot_github_enabled | bool and matrix_hookshot_github_private_key|length > 0 - name: Ensure matrix-hookshot.service installed ansible.builtin.template: diff --git a/roles/matrix-bridge-hookshot/tasks/setup_uninstall.yml b/roles/matrix-bridge-hookshot/tasks/setup_uninstall.yml index 903f46e6..5aba14de 100644 --- a/roles/matrix-bridge-hookshot/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-hookshot/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-hookshot service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-hookshot.service" register: matrix_hookshot_service_stat diff --git a/roles/matrix-bridge-mautrix-facebook/defaults/main.yml b/roles/matrix-bridge-mautrix-facebook/defaults/main.yml index 7993550f..0deb244d 100644 --- a/roles/matrix-bridge-mautrix-facebook/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-facebook/defaults/main.yml @@ -110,11 +110,11 @@ matrix_mautrix_facebook_configuration_extension_yaml: | # If you need something more special, you can take full control by # completely redefining `matrix_mautrix_facebook_configuration_yaml`. -matrix_mautrix_facebook_configuration_extension: "{{ matrix_mautrix_facebook_configuration_extension_yaml|from_yaml if matrix_mautrix_facebook_configuration_extension_yaml|from_yaml is mapping else {} }}" +matrix_mautrix_facebook_configuration_extension: "{{ matrix_mautrix_facebook_configuration_extension_yaml | from_yaml if matrix_mautrix_facebook_configuration_extension_yaml | from_yaml is mapping else {} }}" # Holds the final configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_mautrix_facebook_configuration_yaml`. -matrix_mautrix_facebook_configuration: "{{ matrix_mautrix_facebook_configuration_yaml|from_yaml|combine(matrix_mautrix_facebook_configuration_extension, recursive=True) }}" +matrix_mautrix_facebook_configuration: "{{ matrix_mautrix_facebook_configuration_yaml | from_yaml|combine(matrix_mautrix_facebook_configuration_extension, recursive=True) }}" matrix_mautrix_facebook_registration_yaml: | id: facebook @@ -132,4 +132,4 @@ matrix_mautrix_facebook_registration_yaml: | rate_limited: false de.sorunome.msc2409.push_ephemeral: true -matrix_mautrix_facebook_registration: "{{ matrix_mautrix_facebook_registration_yaml|from_yaml }}" +matrix_mautrix_facebook_registration: "{{ matrix_mautrix_facebook_registration_yaml | from_yaml }}" diff --git a/roles/matrix-bridge-mautrix-facebook/tasks/init.yml b/roles/matrix-bridge-mautrix-facebook/tasks/init.yml index 3bad6fb2..a5debc0b 100644 --- a/roles/matrix-bridge-mautrix-facebook/tasks/init.yml +++ b/roles/matrix-bridge-mautrix-facebook/tasks/init.yml @@ -8,24 +8,24 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-facebook.service'] }}" - when: matrix_mautrix_facebook_enabled|bool + when: matrix_mautrix_facebook_enabled | bool # If the matrix-synapse role is not used, these variables may not exist. - ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ - matrix_synapse_container_extra_arguments|default([]) + matrix_synapse_container_extra_arguments | default([]) + ["--mount type=bind,src={{ matrix_mautrix_facebook_config_path }}/registration.yaml,dst=/matrix-mautrix-facebook-registration.yaml,ro"] }} matrix_synapse_app_service_config_files: > {{ - matrix_synapse_app_service_config_files|default([]) + matrix_synapse_app_service_config_files | default([]) + ["/matrix-mautrix-facebook-registration.yaml"] }} - when: matrix_mautrix_facebook_enabled|bool + when: matrix_mautrix_facebook_enabled | bool - block: - name: Fail if matrix-nginx-proxy role already executed @@ -35,13 +35,13 @@ but it's pointless since the matrix-nginx-proxy role had already executed. To fix this, please change the order of roles in your playbook, so that the matrix-nginx-proxy role would run after the matrix-bridge-mautrix-facebook role. - when: matrix_nginx_proxy_role_executed|default(False)|bool + when: matrix_nginx_proxy_role_executed | default(False) | bool - name: Generate Mautrix Facebook proxying configuration for matrix-nginx-proxy ansible.builtin.set_fact: matrix_mautrix_facebook_matrix_nginx_proxy_configuration: | location {{ matrix_mautrix_facebook_public_endpoint }} { - {% if matrix_nginx_proxy_enabled|default(False) %} + {% if matrix_nginx_proxy_enabled | default(False) %} {# Use the embedded DNS resolver in Docker containers to discover the service #} resolver 127.0.0.11 valid=5s; set $backend "matrix-mautrix-facebook:29319"; @@ -56,7 +56,7 @@ ansible.builtin.set_fact: matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: | {{ - matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([]) + matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks | default([]) + [matrix_mautrix_facebook_matrix_nginx_proxy_configuration] }} @@ -69,8 +69,8 @@ Please make sure that you're proxying the `{{ matrix_mautrix_facebook_public_endpoint }}` URL endpoint to the matrix-mautrix-facebook container. You can expose the container's port using the `matrix_mautrix_facebook_container_http_host_bind_port` variable. - when: "not matrix_nginx_proxy_enabled|default(False)|bool" + when: "not matrix_nginx_proxy_enabled | default(False) | bool" tags: - always - when: matrix_mautrix_facebook_enabled|bool and matrix_mautrix_facebook_appservice_public_enabled|bool + when: matrix_mautrix_facebook_enabled | bool and matrix_mautrix_facebook_appservice_public_enabled | bool diff --git a/roles/matrix-bridge-mautrix-facebook/tasks/main.yml b/roles/matrix-bridge-mautrix-facebook/tasks/main.yml index b6e65fe2..3ef2cb23 100644 --- a/roles/matrix-bridge-mautrix-facebook/tasks/main.yml +++ b/roles/matrix-bridge-mautrix-facebook/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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_mautrix_facebook_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_mautrix_facebook_enabled | bool" tags: - setup-all - setup-mautrix-facebook -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_mautrix_facebook_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_mautrix_facebook_enabled | bool" tags: - setup-all - setup-mautrix-facebook -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_mautrix_facebook_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_mautrix_facebook_enabled | bool" tags: - setup-all - setup-mautrix-facebook diff --git a/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml index eaf2f139..0855c197 100644 --- a/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml @@ -6,14 +6,14 @@ ansible.builtin.fail: msg: >- The matrix-bridge-mautrix-facebook role needs to execute before the matrix-synapse role. - when: "matrix_synapse_role_executed|default(False)" + when: "matrix_synapse_role_executed | default(False)" - ansible.builtin.set_fact: matrix_mautrix_facebook_requires_restart: false - block: - name: Check if an SQLite database already exists - stat: + ansible.builtin.stat: path: "{{ matrix_mautrix_facebook_sqlite_database_path_local }}" register: matrix_mautrix_facebook_sqlite_database_path_local_stat_result @@ -22,16 +22,16 @@ matrix_postgres_db_migration_request: src: "{{ matrix_mautrix_facebook_sqlite_database_path_local }}" dst: "{{ matrix_mautrix_facebook_database_connection_string }}" - caller: "{{ role_path|basename }}" + caller: "{{ role_path | basename }}" engine_variable_name: 'matrix_mautrix_facebook_database_engine' engine_old: 'sqlite' systemd_services_to_stop: ['matrix-mautrix-facebook.service'] - - 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_mautrix_facebook_requires_restart: true - when: "matrix_mautrix_facebook_sqlite_database_path_local_stat_result.stat.exists|bool" + when: "matrix_mautrix_facebook_sqlite_database_path_local_stat_result.stat.exists | bool" when: "matrix_mautrix_facebook_database_engine == 'postgres'" - name: Ensure Mautrix Facebook image is pulled @@ -58,7 +58,7 @@ - {path: "{{ matrix_mautrix_facebook_config_path }}", when: true} - {path: "{{ matrix_mautrix_facebook_data_path }}", when: true} - {path: "{{ matrix_mautrix_facebook_docker_src_files_path }}", when: "{{ matrix_mautrix_facebook_container_image_self_build }}"} - when: item.when|bool + when: item.when | bool - name: Ensure Mautrix Facebook repository is present on self-build ansible.builtin.git: @@ -69,7 +69,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_mautrix_facebook_git_pull_results - when: "matrix_mautrix_facebook_container_image_self_build|bool" + when: "matrix_mautrix_facebook_container_image_self_build | bool" - name: Ensure Mautrix Facebook Docker image is built docker_image: @@ -81,10 +81,10 @@ dockerfile: Dockerfile path: "{{ matrix_mautrix_facebook_docker_src_files_path }}" pull: true - when: "matrix_mautrix_facebook_container_image_self_build|bool" + when: "matrix_mautrix_facebook_container_image_self_build | bool" - name: Check if an old database file already exists - stat: + ansible.builtin.stat: path: "{{ matrix_mautrix_facebook_base_path }}/mautrix-facebook.db" register: matrix_mautrix_facebook_stat_database @@ -103,7 +103,7 @@ - name: Ensure mautrix-facebook config.yaml installed ansible.builtin.copy: - content: "{{ matrix_mautrix_facebook_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_mautrix_facebook_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_facebook_config_path }}/config.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -111,7 +111,7 @@ - name: Ensure mautrix-facebook registration.yaml installed ansible.builtin.copy: - content: "{{ matrix_mautrix_facebook_registration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_mautrix_facebook_registration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_facebook_config_path }}/registration.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -133,4 +133,4 @@ ansible.builtin.service: name: "matrix-mautrix-facebook.service" state: restarted - when: "matrix_mautrix_facebook_requires_restart|bool" + when: "matrix_mautrix_facebook_requires_restart | bool" diff --git a/roles/matrix-bridge-mautrix-facebook/tasks/setup_uninstall.yml b/roles/matrix-bridge-mautrix-facebook/tasks/setup_uninstall.yml index cebdcdab..2635f1f5 100644 --- a/roles/matrix-bridge-mautrix-facebook/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-mautrix-facebook/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-mautrix-facebook service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-mautrix-facebook.service" register: matrix_mautrix_facebook_service_stat diff --git a/roles/matrix-bridge-mautrix-facebook/tasks/validate_config.yml b/roles/matrix-bridge-mautrix-facebook/tasks/validate_config.yml index 986fbc63..4f588b5f 100644 --- a/roles/matrix-bridge-mautrix-facebook/tasks/validate_config.yml +++ b/roles/matrix-bridge-mautrix-facebook/tasks/validate_config.yml @@ -15,7 +15,7 @@ ansible.builtin.set_fact: matrix_playbook_runtime_results: | {{ - matrix_playbook_runtime_results|default([]) + matrix_playbook_runtime_results | default([]) + [ "NOTE: Your mautrix-facebook bridge is still on SQLite and on the last version that supported it, before support was dropped. Support has been subsequently re-added in v0.3.2, so we advise you to upgrade (by removing your `matrix_mautrix_facebook_docker_image` definition from vars.yml)" diff --git a/roles/matrix-bridge-mautrix-googlechat/defaults/main.yml b/roles/matrix-bridge-mautrix-googlechat/defaults/main.yml index 5b93741a..ebac567e 100644 --- a/roles/matrix-bridge-mautrix-googlechat/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-googlechat/defaults/main.yml @@ -99,11 +99,11 @@ matrix_mautrix_googlechat_configuration_extension_yaml: | # If you need something more special, you can take full control by # completely redefining `matrix_mautrix_googlechat_configuration_yaml`. -matrix_mautrix_googlechat_configuration_extension: "{{ matrix_mautrix_googlechat_configuration_extension_yaml|from_yaml if matrix_mautrix_googlechat_configuration_extension_yaml|from_yaml is mapping else {} }}" +matrix_mautrix_googlechat_configuration_extension: "{{ matrix_mautrix_googlechat_configuration_extension_yaml | from_yaml if matrix_mautrix_googlechat_configuration_extension_yaml | from_yaml is mapping else {} }}" # Holds the final configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_mautrix_googlechat_configuration_yaml`. -matrix_mautrix_googlechat_configuration: "{{ matrix_mautrix_googlechat_configuration_yaml|from_yaml|combine(matrix_mautrix_googlechat_configuration_extension, recursive=True) }}" +matrix_mautrix_googlechat_configuration: "{{ matrix_mautrix_googlechat_configuration_yaml | from_yaml|combine(matrix_mautrix_googlechat_configuration_extension, recursive=True) }}" matrix_mautrix_googlechat_registration_yaml: | id: googlechat @@ -121,4 +121,4 @@ matrix_mautrix_googlechat_registration_yaml: | rate_limited: false de.sorunome.msc2409.push_ephemeral: true -matrix_mautrix_googlechat_registration: "{{ matrix_mautrix_googlechat_registration_yaml|from_yaml }}" +matrix_mautrix_googlechat_registration: "{{ matrix_mautrix_googlechat_registration_yaml | from_yaml }}" diff --git a/roles/matrix-bridge-mautrix-googlechat/tasks/init.yml b/roles/matrix-bridge-mautrix-googlechat/tasks/init.yml index 67cdd4a5..af1e7d30 100644 --- a/roles/matrix-bridge-mautrix-googlechat/tasks/init.yml +++ b/roles/matrix-bridge-mautrix-googlechat/tasks/init.yml @@ -8,24 +8,24 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-googlechat.service'] }}" - when: matrix_mautrix_googlechat_enabled|bool + when: matrix_mautrix_googlechat_enabled | bool # If the matrix-synapse role is not used, these variables may not exist. - ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ - matrix_synapse_container_extra_arguments|default([]) + matrix_synapse_container_extra_arguments | default([]) + ["--mount type=bind,src={{ matrix_mautrix_googlechat_config_path }}/registration.yaml,dst=/matrix-mautrix-googlechat-registration.yaml,ro"] }} matrix_synapse_app_service_config_files: > {{ - matrix_synapse_app_service_config_files|default([]) + matrix_synapse_app_service_config_files | default([]) + ["/matrix-mautrix-googlechat-registration.yaml"] }} - when: matrix_mautrix_googlechat_enabled|bool + when: matrix_mautrix_googlechat_enabled | bool - block: - name: Fail if matrix-nginx-proxy role already executed @@ -35,13 +35,13 @@ but it's pointless since the matrix-nginx-proxy role had already executed. To fix this, please change the order of roles in your playbook, so that the matrix-nginx-proxy role would run after the matrix-bridge-mautrix-googlechat role. - when: matrix_nginx_proxy_role_executed|default(False)|bool + when: matrix_nginx_proxy_role_executed | default(False) | bool - name: Generate Mautrix googlechat proxying configuration for matrix-nginx-proxy ansible.builtin.set_fact: matrix_mautrix_googlechat_matrix_nginx_proxy_configuration: | location {{ matrix_mautrix_googlechat_public_endpoint }} { - {% if matrix_nginx_proxy_enabled|default(False) %} + {% if matrix_nginx_proxy_enabled | default(False) %} {# Use the embedded DNS resolver in Docker containers to discover the service #} resolver 127.0.0.11 valid=5s; set $backend "matrix-mautrix-googlechat:8080"; @@ -55,13 +55,13 @@ ansible.builtin.set_fact: matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: | {{ - matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([]) + matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks | default([]) + [matrix_mautrix_googlechat_matrix_nginx_proxy_configuration] }} tags: - always - when: matrix_mautrix_googlechat_enabled|bool + when: matrix_mautrix_googlechat_enabled | bool - name: Warn about reverse-proxying if matrix-nginx-proxy not used ansible.builtin.debug: @@ -71,4 +71,4 @@ Please make sure that you're proxying the `{{ matrix_mautrix_googlechat_public_endpoint }}` URL endpoint to the matrix-mautrix-googlechat container. You can expose the container's port using the `matrix_mautrix_googlechat_container_http_host_bind_port` variable. - when: "matrix_mautrix_googlechat_enabled|bool and not matrix_nginx_proxy_enabled|default(False)|bool" + when: "matrix_mautrix_googlechat_enabled | bool and not matrix_nginx_proxy_enabled | default(False) | bool" diff --git a/roles/matrix-bridge-mautrix-googlechat/tasks/main.yml b/roles/matrix-bridge-mautrix-googlechat/tasks/main.yml index 16054e7b..070abfcd 100644 --- a/roles/matrix-bridge-mautrix-googlechat/tasks/main.yml +++ b/roles/matrix-bridge-mautrix-googlechat/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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_mautrix_googlechat_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_mautrix_googlechat_enabled | bool" tags: - setup-all - setup-mautrix-googlechat -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_mautrix_googlechat_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_mautrix_googlechat_enabled | bool" tags: - setup-all - setup-mautrix-googlechat -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_mautrix_googlechat_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_mautrix_googlechat_enabled | bool" tags: - setup-all - setup-mautrix-googlechat diff --git a/roles/matrix-bridge-mautrix-googlechat/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-googlechat/tasks/setup_install.yml index a2544c57..8a9b55df 100644 --- a/roles/matrix-bridge-mautrix-googlechat/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-googlechat/tasks/setup_install.yml @@ -6,14 +6,14 @@ ansible.builtin.fail: msg: >- The matrix-bridge-mautrix-googlechat role needs to execute before the matrix-synapse role. - when: "matrix_synapse_role_executed|default(False)" + when: "matrix_synapse_role_executed | default(False)" - ansible.builtin.set_fact: matrix_mautrix_googlechat_requires_restart: false - block: - name: Check if an SQLite database already exists - stat: + ansible.builtin.stat: path: "{{ matrix_mautrix_googlechat_sqlite_database_path_local }}" register: matrix_mautrix_googlechat_sqlite_database_path_local_stat_result @@ -22,16 +22,16 @@ matrix_postgres_db_migration_request: src: "{{ matrix_mautrix_googlechat_sqlite_database_path_local }}" dst: "{{ matrix_mautrix_googlechat_database_connection_string }}" - caller: "{{ role_path|basename }}" + caller: "{{ role_path | basename }}" engine_variable_name: 'matrix_mautrix_googlechat_database_engine' engine_old: 'sqlite' systemd_services_to_stop: ['matrix-mautrix-googlechat.service'] - - 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_mautrix_googlechat_requires_restart: true - when: "matrix_mautrix_googlechat_sqlite_database_path_local_stat_result.stat.exists|bool" + when: "matrix_mautrix_googlechat_sqlite_database_path_local_stat_result.stat.exists | bool" when: "matrix_mautrix_googlechat_database_engine == 'postgres'" - name: Ensure Mautrix googlechat image is pulled @@ -58,7 +58,7 @@ - {path: "{{ matrix_mautrix_googlechat_config_path }}", when: true} - {path: "{{ matrix_mautrix_googlechat_data_path }}", when: true} - {path: "{{ matrix_mautrix_googlechat_docker_src_files_path }}", when: "{{ matrix_mautrix_googlechat_container_image_self_build }}"} - when: "item.when|bool" + when: "item.when | bool" - name: Ensure Mautrix Hangots repository is present on self build ansible.builtin.git: @@ -68,7 +68,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_mautrix_googlechat_git_pull_results - when: "matrix_mautrix_googlechat_container_image_self_build|bool" + when: "matrix_mautrix_googlechat_container_image_self_build | bool" - name: Ensure Mautrix googlechat Docker image is built docker_image: @@ -80,10 +80,10 @@ dockerfile: Dockerfile path: "{{ matrix_mautrix_googlechat_docker_src_files_path }}" pull: true - when: "matrix_mautrix_googlechat_container_image_self_build|bool" + when: "matrix_mautrix_googlechat_container_image_self_build | bool" - name: Check if an old database file already exists - stat: + ansible.builtin.stat: path: "{{ matrix_mautrix_googlechat_base_path }}/mautrix-googlechat.db" register: matrix_mautrix_googlechat_stat_database @@ -102,7 +102,7 @@ - name: Ensure mautrix-googlechat config.yaml installed ansible.builtin.copy: - content: "{{ matrix_mautrix_googlechat_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_mautrix_googlechat_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_googlechat_config_path }}/config.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -110,7 +110,7 @@ - name: Ensure mautrix-googlechat registration.yaml installed ansible.builtin.copy: - content: "{{ matrix_mautrix_googlechat_registration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_mautrix_googlechat_registration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_googlechat_config_path }}/registration.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -132,4 +132,4 @@ ansible.builtin.service: name: "matrix-mautrix-googlechat.service" state: restarted - when: "matrix_mautrix_googlechat_requires_restart|bool" + when: "matrix_mautrix_googlechat_requires_restart | bool" diff --git a/roles/matrix-bridge-mautrix-googlechat/tasks/setup_uninstall.yml b/roles/matrix-bridge-mautrix-googlechat/tasks/setup_uninstall.yml index 88955868..104e58a5 100644 --- a/roles/matrix-bridge-mautrix-googlechat/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-mautrix-googlechat/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-mautrix-googlechat service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-mautrix-googlechat.service" register: matrix_mautrix_googlechat_service_stat diff --git a/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml b/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml index 061fa56a..77db85fe 100644 --- a/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml @@ -96,11 +96,11 @@ matrix_mautrix_hangouts_configuration_extension_yaml: | # If you need something more special, you can take full control by # completely redefining `matrix_mautrix_hangouts_configuration_yaml`. -matrix_mautrix_hangouts_configuration_extension: "{{ matrix_mautrix_hangouts_configuration_extension_yaml|from_yaml if matrix_mautrix_hangouts_configuration_extension_yaml|from_yaml is mapping else {} }}" +matrix_mautrix_hangouts_configuration_extension: "{{ matrix_mautrix_hangouts_configuration_extension_yaml | from_yaml if matrix_mautrix_hangouts_configuration_extension_yaml | from_yaml is mapping else {} }}" # Holds the final configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_mautrix_hangouts_configuration_yaml`. -matrix_mautrix_hangouts_configuration: "{{ matrix_mautrix_hangouts_configuration_yaml|from_yaml|combine(matrix_mautrix_hangouts_configuration_extension, recursive=True) }}" +matrix_mautrix_hangouts_configuration: "{{ matrix_mautrix_hangouts_configuration_yaml | from_yaml|combine(matrix_mautrix_hangouts_configuration_extension, recursive=True) }}" matrix_mautrix_hangouts_registration_yaml: | id: hangouts @@ -118,4 +118,4 @@ matrix_mautrix_hangouts_registration_yaml: | rate_limited: false de.sorunome.msc2409.push_ephemeral: true -matrix_mautrix_hangouts_registration: "{{ matrix_mautrix_hangouts_registration_yaml|from_yaml }}" +matrix_mautrix_hangouts_registration: "{{ matrix_mautrix_hangouts_registration_yaml | from_yaml }}" diff --git a/roles/matrix-bridge-mautrix-hangouts/tasks/init.yml b/roles/matrix-bridge-mautrix-hangouts/tasks/init.yml index 6f7374ee..28ca1cdb 100644 --- a/roles/matrix-bridge-mautrix-hangouts/tasks/init.yml +++ b/roles/matrix-bridge-mautrix-hangouts/tasks/init.yml @@ -8,24 +8,24 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-hangouts.service'] }}" - when: matrix_mautrix_hangouts_enabled|bool + when: matrix_mautrix_hangouts_enabled | bool # If the matrix-synapse role is not used, these variables may not exist. - ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ - matrix_synapse_container_extra_arguments|default([]) + matrix_synapse_container_extra_arguments | default([]) + ["--mount type=bind,src={{ matrix_mautrix_hangouts_config_path }}/registration.yaml,dst=/matrix-mautrix-hangouts-registration.yaml,ro"] }} matrix_synapse_app_service_config_files: > {{ - matrix_synapse_app_service_config_files|default([]) + matrix_synapse_app_service_config_files | default([]) + ["/matrix-mautrix-hangouts-registration.yaml"] }} - when: matrix_mautrix_hangouts_enabled|bool + when: matrix_mautrix_hangouts_enabled | bool - block: - name: Fail if matrix-nginx-proxy role already executed @@ -35,13 +35,13 @@ but it's pointless since the matrix-nginx-proxy role had already executed. To fix this, please change the order of roles in your playbook, so that the matrix-nginx-proxy role would run after the matrix-bridge-mautrix-hangouts role. - when: matrix_nginx_proxy_role_executed|default(False)|bool + when: matrix_nginx_proxy_role_executed | default(False) | bool - name: Generate Mautrix Hangouts proxying configuration for matrix-nginx-proxy ansible.builtin.set_fact: matrix_mautrix_hangouts_matrix_nginx_proxy_configuration: | location {{ matrix_mautrix_hangouts_public_endpoint }} { - {% if matrix_nginx_proxy_enabled|default(False) %} + {% if matrix_nginx_proxy_enabled | default(False) %} {# Use the embedded DNS resolver in Docker containers to discover the service #} resolver 127.0.0.11 valid=5s; set $backend "matrix-mautrix-hangouts:8080"; @@ -55,13 +55,13 @@ ansible.builtin.set_fact: matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: | {{ - matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([]) + matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks | default([]) + [matrix_mautrix_hangouts_matrix_nginx_proxy_configuration] }} tags: - always - when: matrix_mautrix_hangouts_enabled|bool + when: matrix_mautrix_hangouts_enabled | bool - name: Warn about reverse-proxying if matrix-nginx-proxy not used ansible.builtin.debug: @@ -71,4 +71,4 @@ Please make sure that you're proxying the `{{ matrix_mautrix_hangouts_public_endpoint }}` URL endpoint to the matrix-mautrix-hangouts container. You can expose the container's port using the `matrix_mautrix_hangouts_container_http_host_bind_port` variable. - when: "matrix_mautrix_hangouts_enabled|bool and not matrix_nginx_proxy_enabled|default(False)|bool" + when: "matrix_mautrix_hangouts_enabled | bool and not matrix_nginx_proxy_enabled | default(False) | bool" diff --git a/roles/matrix-bridge-mautrix-hangouts/tasks/main.yml b/roles/matrix-bridge-mautrix-hangouts/tasks/main.yml index b43ff478..d6913689 100644 --- a/roles/matrix-bridge-mautrix-hangouts/tasks/main.yml +++ b/roles/matrix-bridge-mautrix-hangouts/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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_mautrix_hangouts_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_mautrix_hangouts_enabled | bool" tags: - setup-all - setup-mautrix-hangouts -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_mautrix_hangouts_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_mautrix_hangouts_enabled | bool" tags: - setup-all - setup-mautrix-hangouts -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_mautrix_hangouts_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_mautrix_hangouts_enabled | bool" tags: - setup-all - setup-mautrix-hangouts diff --git a/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml index 11456cc4..a135fd1f 100644 --- a/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml @@ -6,14 +6,14 @@ ansible.builtin.fail: msg: >- The matrix-bridge-mautrix-hangouts role needs to execute before the matrix-synapse role. - when: "matrix_synapse_role_executed|default(False)" + when: "matrix_synapse_role_executed | default(False)" - ansible.builtin.set_fact: matrix_mautrix_hangouts_requires_restart: false - block: - name: Check if an SQLite database already exists - stat: + ansible.builtin.stat: path: "{{ matrix_mautrix_hangouts_sqlite_database_path_local }}" register: matrix_mautrix_hangouts_sqlite_database_path_local_stat_result @@ -22,16 +22,16 @@ matrix_postgres_db_migration_request: src: "{{ matrix_mautrix_hangouts_sqlite_database_path_local }}" dst: "{{ matrix_mautrix_hangouts_database_connection_string }}" - caller: "{{ role_path|basename }}" + caller: "{{ role_path | basename }}" engine_variable_name: 'matrix_mautrix_hangouts_database_engine' engine_old: 'sqlite' systemd_services_to_stop: ['matrix-mautrix-hangouts.service'] - - 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_mautrix_hangouts_requires_restart: true - when: "matrix_mautrix_hangouts_sqlite_database_path_local_stat_result.stat.exists|bool" + when: "matrix_mautrix_hangouts_sqlite_database_path_local_stat_result.stat.exists | bool" when: "matrix_mautrix_hangouts_database_engine == 'postgres'" - name: Ensure Mautrix Hangouts image is pulled @@ -58,7 +58,7 @@ - {path: "{{ matrix_mautrix_hangouts_config_path }}", when: true} - {path: "{{ matrix_mautrix_hangouts_data_path }}", when: true} - {path: "{{ matrix_mautrix_hangouts_docker_src_files_path }}", when: "{{ matrix_mautrix_hangouts_container_image_self_build }}"} - when: "item.when|bool" + when: "item.when | bool" - name: Ensure Mautrix Hangots repository is present on self build ansible.builtin.git: @@ -68,7 +68,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_mautrix_hangouts_git_pull_results - when: "matrix_mautrix_hangouts_container_image_self_build|bool" + when: "matrix_mautrix_hangouts_container_image_self_build | bool" - name: Ensure Mautrix Hangouts Docker image is built docker_image: @@ -80,10 +80,10 @@ dockerfile: Dockerfile path: "{{ matrix_mautrix_hangouts_docker_src_files_path }}" pull: true - when: "matrix_mautrix_hangouts_container_image_self_build|bool" + when: "matrix_mautrix_hangouts_container_image_self_build | bool" - name: Check if an old database file already exists - stat: + ansible.builtin.stat: path: "{{ matrix_mautrix_hangouts_base_path }}/mautrix-hangouts.db" register: matrix_mautrix_hangouts_stat_database @@ -102,7 +102,7 @@ - name: Ensure mautrix-hangouts config.yaml installed ansible.builtin.copy: - content: "{{ matrix_mautrix_hangouts_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_mautrix_hangouts_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_hangouts_config_path }}/config.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -110,7 +110,7 @@ - name: Ensure mautrix-hangouts registration.yaml installed ansible.builtin.copy: - content: "{{ matrix_mautrix_hangouts_registration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_mautrix_hangouts_registration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_hangouts_config_path }}/registration.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -132,4 +132,4 @@ ansible.builtin.service: name: "matrix-mautrix-hangouts.service" state: restarted - when: "matrix_mautrix_hangouts_requires_restart|bool" + when: "matrix_mautrix_hangouts_requires_restart | bool" diff --git a/roles/matrix-bridge-mautrix-hangouts/tasks/setup_uninstall.yml b/roles/matrix-bridge-mautrix-hangouts/tasks/setup_uninstall.yml index f3234a2e..2cb676b5 100644 --- a/roles/matrix-bridge-mautrix-hangouts/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-mautrix-hangouts/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-mautrix-hangouts service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-mautrix-hangouts.service" register: matrix_mautrix_hangouts_service_stat diff --git a/roles/matrix-bridge-mautrix-instagram/defaults/main.yml b/roles/matrix-bridge-mautrix-instagram/defaults/main.yml index 5c849cfc..8452d6f3 100644 --- a/roles/matrix-bridge-mautrix-instagram/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-instagram/defaults/main.yml @@ -89,11 +89,11 @@ matrix_mautrix_instagram_configuration_extension_yaml: | # If you need something more special, you can take full control by # completely redefining `matrix_mautrix_instagram_configuration_yaml`. -matrix_mautrix_instagram_configuration_extension: "{{ matrix_mautrix_instagram_configuration_extension_yaml|from_yaml if matrix_mautrix_instagram_configuration_extension_yaml|from_yaml is mapping else {} }}" +matrix_mautrix_instagram_configuration_extension: "{{ matrix_mautrix_instagram_configuration_extension_yaml | from_yaml if matrix_mautrix_instagram_configuration_extension_yaml | from_yaml is mapping else {} }}" # Holds the final configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_mautrix_instagram_configuration_yaml`. -matrix_mautrix_instagram_configuration: "{{ matrix_mautrix_instagram_configuration_yaml|from_yaml|combine(matrix_mautrix_instagram_configuration_extension, recursive=True) }}" +matrix_mautrix_instagram_configuration: "{{ matrix_mautrix_instagram_configuration_yaml | from_yaml|combine(matrix_mautrix_instagram_configuration_extension, recursive=True) }}" matrix_mautrix_instagram_registration_yaml: | id: instagram @@ -111,4 +111,4 @@ matrix_mautrix_instagram_registration_yaml: | rate_limited: false de.sorunome.msc2409.push_ephemeral: true -matrix_mautrix_instagram_registration: "{{ matrix_mautrix_instagram_registration_yaml|from_yaml }}" +matrix_mautrix_instagram_registration: "{{ matrix_mautrix_instagram_registration_yaml | from_yaml }}" diff --git a/roles/matrix-bridge-mautrix-instagram/tasks/init.yml b/roles/matrix-bridge-mautrix-instagram/tasks/init.yml index e3b4c58c..858e2917 100644 --- a/roles/matrix-bridge-mautrix-instagram/tasks/init.yml +++ b/roles/matrix-bridge-mautrix-instagram/tasks/init.yml @@ -8,21 +8,21 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-instagram.service'] }}" - when: matrix_mautrix_instagram_enabled|bool + when: matrix_mautrix_instagram_enabled | bool # If the matrix-synapse role is not used, these variables may not exist. - ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ - matrix_synapse_container_extra_arguments|default([]) + matrix_synapse_container_extra_arguments | default([]) + ["--mount type=bind,src={{ matrix_mautrix_instagram_config_path }}/registration.yaml,dst=/matrix-mautrix-instagram-registration.yaml,ro"] }} matrix_synapse_app_service_config_files: > {{ - matrix_synapse_app_service_config_files|default([]) + matrix_synapse_app_service_config_files | default([]) + ["/matrix-mautrix-instagram-registration.yaml"] }} - when: matrix_mautrix_instagram_enabled|bool + when: matrix_mautrix_instagram_enabled | bool diff --git a/roles/matrix-bridge-mautrix-instagram/tasks/main.yml b/roles/matrix-bridge-mautrix-instagram/tasks/main.yml index b6ffcd06..d5becb6d 100644 --- a/roles/matrix-bridge-mautrix-instagram/tasks/main.yml +++ b/roles/matrix-bridge-mautrix-instagram/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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_mautrix_instagram_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_mautrix_instagram_enabled | bool" tags: - setup-all - setup-mautrix-instagram -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_mautrix_instagram_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_mautrix_instagram_enabled | bool" tags: - setup-all - setup-mautrix-instagram -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_mautrix_instagram_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_mautrix_instagram_enabled | bool" tags: - setup-all - setup-mautrix-instagram diff --git a/roles/matrix-bridge-mautrix-instagram/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-instagram/tasks/setup_install.yml index 98fa1157..cac885ad 100644 --- a/roles/matrix-bridge-mautrix-instagram/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-instagram/tasks/setup_install.yml @@ -5,7 +5,7 @@ ansible.builtin.fail: msg: >- The matrix-bridge-mautrix-instagram role needs to execute before the matrix-synapse role. - when: "matrix_synapse_role_executed|default(False)" + when: "matrix_synapse_role_executed | default(False)" - name: Ensure Mautrix instagram image is pulled docker_image: @@ -31,7 +31,7 @@ - {path: "{{ matrix_mautrix_instagram_config_path }}", when: true} - {path: "{{ matrix_mautrix_instagram_data_path }}", when: true} - {path: "{{ matrix_mautrix_instagram_docker_src_files_path }}", when: "{{ matrix_mautrix_instagram_container_image_self_build }}"} - when: item.when|bool + when: item.when | bool - name: Ensure Mautrix instagram repository is present on self-build ansible.builtin.git: @@ -41,7 +41,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_mautrix_instagram_git_pull_results - when: "matrix_mautrix_instagram_container_image_self_build|bool" + when: "matrix_mautrix_instagram_container_image_self_build | bool" - name: Ensure Mautrix instagram Docker image is built docker_image: @@ -53,11 +53,11 @@ dockerfile: Dockerfile path: "{{ matrix_mautrix_instagram_docker_src_files_path }}" pull: true - when: "matrix_mautrix_instagram_container_image_self_build|bool" + when: "matrix_mautrix_instagram_container_image_self_build | bool" - name: Ensure mautrix-instagram config.yaml installed ansible.builtin.copy: - content: "{{ matrix_mautrix_instagram_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_mautrix_instagram_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_instagram_config_path }}/config.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -65,7 +65,7 @@ - name: Ensure mautrix-instagram registration.yaml installed ansible.builtin.copy: - content: "{{ matrix_mautrix_instagram_registration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_mautrix_instagram_registration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_instagram_config_path }}/registration.yaml" mode: 0644 owner: "{{ matrix_user_username }}" diff --git a/roles/matrix-bridge-mautrix-instagram/tasks/setup_uninstall.yml b/roles/matrix-bridge-mautrix-instagram/tasks/setup_uninstall.yml index ef90f01f..55d882d3 100644 --- a/roles/matrix-bridge-mautrix-instagram/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-mautrix-instagram/tasks/setup_uninstall.yml @@ -1,6 +1,6 @@ --- - name: Check existence of matrix-mautrix-instagram service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-mautrix-instagram.service" register: matrix_mautrix_instagram_service_stat diff --git a/roles/matrix-bridge-mautrix-signal/defaults/main.yml b/roles/matrix-bridge-mautrix-signal/defaults/main.yml index 3ed92dbc..429d8ea8 100644 --- a/roles/matrix-bridge-mautrix-signal/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-signal/defaults/main.yml @@ -124,15 +124,15 @@ matrix_mautrix_signal_configuration_extension_yaml: | # If you need something more special, you can take full control by # completely redefining `matrix_mautrix_signal_configuration_yaml`. -matrix_mautrix_signal_configuration_extension: "{{ matrix_mautrix_signal_configuration_extension_yaml|from_yaml if matrix_mautrix_signal_configuration_extension_yaml|from_yaml is mapping else {} }}" +matrix_mautrix_signal_configuration_extension: "{{ matrix_mautrix_signal_configuration_extension_yaml | from_yaml if matrix_mautrix_signal_configuration_extension_yaml | from_yaml is mapping else {} }}" # Holds the final configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_mautrix_signal_configuration_yaml`. -matrix_mautrix_signal_configuration: "{{ matrix_mautrix_signal_configuration_yaml|from_yaml|combine(matrix_mautrix_signal_configuration_extension, recursive=True) }}" +matrix_mautrix_signal_configuration: "{{ matrix_mautrix_signal_configuration_yaml | from_yaml|combine(matrix_mautrix_signal_configuration_extension, recursive=True) }}" matrix_mautrix_signal_registration_yaml: "{{ lookup('template', 'templates/registration.yaml.j2') }}" -matrix_mautrix_signal_registration: "{{ matrix_mautrix_signal_registration_yaml|from_yaml }}" +matrix_mautrix_signal_registration: "{{ matrix_mautrix_signal_registration_yaml | from_yaml }}" matrix_mautrix_signal_log_level: 'DEBUG' diff --git a/roles/matrix-bridge-mautrix-signal/tasks/init.yml b/roles/matrix-bridge-mautrix-signal/tasks/init.yml index 4d9a2448..c96fe596 100644 --- a/roles/matrix-bridge-mautrix-signal/tasks/init.yml +++ b/roles/matrix-bridge-mautrix-signal/tasks/init.yml @@ -2,21 +2,21 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-signal.service', 'matrix-mautrix-signal-daemon.service'] }}" - when: matrix_mautrix_signal_enabled|bool + when: matrix_mautrix_signal_enabled | bool # If the matrix-synapse role is not used, these variables may not exist. - ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ - matrix_synapse_container_extra_arguments|default([]) + matrix_synapse_container_extra_arguments | default([]) + ["--mount type=bind,src={{ matrix_mautrix_signal_config_path }}/registration.yaml,dst=/matrix-mautrix-signal-registration.yaml,ro"] }} matrix_synapse_app_service_config_files: > {{ - matrix_synapse_app_service_config_files|default([]) + matrix_synapse_app_service_config_files | default([]) + ["/matrix-mautrix-signal-registration.yaml"] }} - when: matrix_mautrix_signal_enabled|bool + when: matrix_mautrix_signal_enabled | bool diff --git a/roles/matrix-bridge-mautrix-signal/tasks/main.yml b/roles/matrix-bridge-mautrix-signal/tasks/main.yml index 643b94c9..54bdafcd 100644 --- a/roles/matrix-bridge-mautrix-signal/tasks/main.yml +++ b/roles/matrix-bridge-mautrix-signal/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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_mautrix_signal_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_mautrix_signal_enabled | bool" tags: - setup-all - setup-mautrix-signal -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_mautrix_signal_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_mautrix_signal_enabled | bool" tags: - setup-all - setup-mautrix-signal -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_mautrix_signal_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_mautrix_signal_enabled | bool" tags: - setup-all - setup-mautrix-signal diff --git a/roles/matrix-bridge-mautrix-signal/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-signal/tasks/setup_install.yml index b7afb351..d92f2b3f 100644 --- a/roles/matrix-bridge-mautrix-signal/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-signal/tasks/setup_install.yml @@ -6,7 +6,7 @@ ansible.builtin.fail: msg: >- The matrix-bridge-mautrix-signal role needs to execute before the matrix-synapse role. - when: "matrix_synapse_role_executed|default(False)" + when: "matrix_synapse_role_executed | default(False)" - name: Ensure Mautrix Signal image is pulled docker_image: @@ -14,7 +14,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_mautrix_signal_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_mautrix_signal_docker_image_force_pull }}" - when: "not matrix_mautrix_signal_container_image_self_build|bool" + when: "not matrix_mautrix_signal_container_image_self_build | bool" register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -29,7 +29,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_mautrix_signal_git_pull_results - when: "matrix_mautrix_signal_container_image_self_build|bool" + when: "matrix_mautrix_signal_container_image_self_build | bool" - name: Ensure Mautrix Signal image is built docker_image: @@ -41,7 +41,7 @@ dockerfile: Dockerfile path: "{{ matrix_mautrix_signal_docker_src_files_path }}" pull: true - when: "matrix_mautrix_signal_container_image_self_build|bool" + when: "matrix_mautrix_signal_container_image_self_build | bool" - name: Ensure Mautrix Signal Daemon image is pulled @@ -50,7 +50,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_mautrix_signal_daemon_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_mautrix_signal_daemon_docker_image_force_pull }}" - when: matrix_mautrix_signal_enabled and not matrix_mautrix_signal_daemon_container_image_self_build|bool + when: matrix_mautrix_signal_enabled and not matrix_mautrix_signal_daemon_container_image_self_build | bool register: matrix_mautrix_signal_daemon_pull_results - name: Ensure Mautrix Signal Daemon repository is present on self-build @@ -61,7 +61,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_mautrix_signal_daemon_git_pull_results - when: "matrix_mautrix_signal_daemon_container_image_self_build|bool" + when: "matrix_mautrix_signal_daemon_container_image_self_build | bool" - name: Ensure Mautrix Signal Daemon image is built docker_image: @@ -73,7 +73,7 @@ dockerfile: Containerfile path: "{{ matrix_mautrix_signal_daemon_docker_src_files_path }}" pull: true - when: "matrix_mautrix_signal_daemon_container_image_self_build|bool" + when: "matrix_mautrix_signal_daemon_container_image_self_build | bool" - name: Ensure Mautrix Signal paths exist ansible.builtin.file: @@ -92,7 +92,7 @@ - name: Ensure mautrix-signal config.yaml installed ansible.builtin.copy: - content: "{{ matrix_mautrix_signal_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_mautrix_signal_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_signal_config_path }}/config.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -100,7 +100,7 @@ - name: Ensure mautrix-signal registration.yaml installed ansible.builtin.copy: - content: "{{ matrix_mautrix_signal_registration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_mautrix_signal_registration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_signal_config_path }}/registration.yaml" mode: 0644 owner: "{{ matrix_user_username }}" diff --git a/roles/matrix-bridge-mautrix-signal/tasks/setup_uninstall.yml b/roles/matrix-bridge-mautrix-signal/tasks/setup_uninstall.yml index 33f1b9f5..befbcbec 100644 --- a/roles/matrix-bridge-mautrix-signal/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-mautrix-signal/tasks/setup_uninstall.yml @@ -2,7 +2,7 @@ # Signal daemon service - name: Check existence of matrix-mautrix-signal-daemon service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-mautrix-signal-daemon.service" register: matrix_mautrix_signal_daemon_service_stat @@ -22,7 +22,7 @@ # Bridge service - name: Check existence of matrix-mautrix-signal service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-mautrix-signal.service" register: matrix_mautrix_signal_service_stat diff --git a/roles/matrix-bridge-mautrix-telegram/defaults/main.yml b/roles/matrix-bridge-mautrix-telegram/defaults/main.yml index 97ba2bc9..a76186ae 100644 --- a/roles/matrix-bridge-mautrix-telegram/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-telegram/defaults/main.yml @@ -117,11 +117,11 @@ matrix_mautrix_telegram_configuration_extension_yaml: | # If you need something more special, you can take full control by # completely redefining `matrix_mautrix_telegram_configuration_yaml`. -matrix_mautrix_telegram_configuration_extension: "{{ matrix_mautrix_telegram_configuration_extension_yaml|from_yaml if matrix_mautrix_telegram_configuration_extension_yaml|from_yaml is mapping else {} }}" +matrix_mautrix_telegram_configuration_extension: "{{ matrix_mautrix_telegram_configuration_extension_yaml | from_yaml if matrix_mautrix_telegram_configuration_extension_yaml | from_yaml is mapping else {} }}" # Holds the final configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_mautrix_telegram_configuration_yaml`. -matrix_mautrix_telegram_configuration: "{{ matrix_mautrix_telegram_configuration_yaml|from_yaml|combine(matrix_mautrix_telegram_configuration_extension, recursive=True) }}" +matrix_mautrix_telegram_configuration: "{{ matrix_mautrix_telegram_configuration_yaml | from_yaml|combine(matrix_mautrix_telegram_configuration_extension, recursive=True) }}" matrix_mautrix_telegram_registration_yaml: | id: telegram @@ -142,7 +142,7 @@ matrix_mautrix_telegram_registration_yaml: | rate_limited: false de.sorunome.msc2409.push_ephemeral: true -matrix_mautrix_telegram_registration: "{{ matrix_mautrix_telegram_registration_yaml|from_yaml }}" +matrix_mautrix_telegram_registration: "{{ matrix_mautrix_telegram_registration_yaml | from_yaml }}" # Templates for defining MXID's and displaynames for users and rooms. matrix_mautrix_telegram_username_template: 'telegram_{userid}' diff --git a/roles/matrix-bridge-mautrix-telegram/tasks/init.yml b/roles/matrix-bridge-mautrix-telegram/tasks/init.yml index a9cc0425..e83bc663 100644 --- a/roles/matrix-bridge-mautrix-telegram/tasks/init.yml +++ b/roles/matrix-bridge-mautrix-telegram/tasks/init.yml @@ -8,24 +8,24 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-telegram.service'] }}" - when: matrix_mautrix_telegram_enabled|bool + when: matrix_mautrix_telegram_enabled | bool # If the matrix-synapse role is not used, these variables may not exist. - ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ - matrix_synapse_container_extra_arguments|default([]) + matrix_synapse_container_extra_arguments | default([]) + ["--mount type=bind,src={{ matrix_mautrix_telegram_config_path }}/registration.yaml,dst=/matrix-mautrix-telegram-registration.yaml,ro"] }} matrix_synapse_app_service_config_files: > {{ - matrix_synapse_app_service_config_files|default([]) + matrix_synapse_app_service_config_files | default([]) + ["/matrix-mautrix-telegram-registration.yaml"] }} - when: matrix_mautrix_telegram_enabled|bool + when: matrix_mautrix_telegram_enabled | bool - block: - name: Fail if matrix-nginx-proxy role already executed @@ -35,13 +35,13 @@ but it's pointless since the matrix-nginx-proxy role had already executed. To fix this, please change the order of roles in your playbook, so that the matrix-nginx-proxy role would run after the matrix-bridge-mautrix-telegram role. - when: matrix_nginx_proxy_role_executed|default(False)|bool + when: matrix_nginx_proxy_role_executed | default(False) | bool - name: Generate Mautrix Telegram proxying configuration for matrix-nginx-proxy ansible.builtin.set_fact: matrix_mautrix_telegram_matrix_nginx_proxy_configuration: | location {{ matrix_mautrix_telegram_public_endpoint }} { - {% if matrix_nginx_proxy_enabled|default(False) %} + {% if matrix_nginx_proxy_enabled | default(False) %} {# Use the embedded DNS resolver in Docker containers to discover the service #} resolver 127.0.0.11 valid=5s; set $backend "matrix-mautrix-telegram:8080"; @@ -56,7 +56,7 @@ ansible.builtin.set_fact: matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: | {{ - matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([]) + matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks | default([]) + [matrix_mautrix_telegram_matrix_nginx_proxy_configuration] }} @@ -68,8 +68,8 @@ Please make sure that you're proxying the `{{ matrix_mautrix_telegram_public_endpoint }}` URL endpoint to the matrix-mautrix-telegram container. You can expose the container's port using the `matrix_mautrix_telegram_container_http_host_bind_port` variable. - when: "not matrix_nginx_proxy_enabled|default(False)|bool" + when: "not matrix_nginx_proxy_enabled | default(False) | bool" tags: - always - when: matrix_mautrix_telegram_enabled|bool and matrix_mautrix_telegram_appservice_public_enabled|bool + when: matrix_mautrix_telegram_enabled | bool and matrix_mautrix_telegram_appservice_public_enabled | bool diff --git a/roles/matrix-bridge-mautrix-telegram/tasks/main.yml b/roles/matrix-bridge-mautrix-telegram/tasks/main.yml index 018b30da..471f0cf1 100644 --- a/roles/matrix-bridge-mautrix-telegram/tasks/main.yml +++ b/roles/matrix-bridge-mautrix-telegram/tasks/main.yml @@ -1,22 +1,22 @@ --- -- 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_mautrix_telegram_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_mautrix_telegram_enabled | bool" tags: - setup-all - setup-mautrix-telegram -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_mautrix_telegram_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_mautrix_telegram_enabled | bool" tags: - setup-all - setup-mautrix-telegram -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_mautrix_telegram_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_mautrix_telegram_enabled | bool" tags: - setup-all - setup-mautrix-telegram diff --git a/roles/matrix-bridge-mautrix-telegram/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-telegram/tasks/setup_install.yml index d530d2b9..52bb8328 100644 --- a/roles/matrix-bridge-mautrix-telegram/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-telegram/tasks/setup_install.yml @@ -6,14 +6,14 @@ ansible.builtin.fail: msg: >- The matrix-bridge-mautrix-telegram role needs to execute before the matrix-synapse role. - when: "matrix_synapse_role_executed|default(False)" + when: "matrix_synapse_role_executed | default(False)" - ansible.builtin.set_fact: matrix_mautrix_telegram_requires_restart: false - block: - name: Check if an SQLite database already exists - stat: + ansible.builtin.stat: path: "{{ matrix_mautrix_telegram_sqlite_database_path_local }}" register: matrix_mautrix_telegram_sqlite_database_path_local_stat_result @@ -22,16 +22,16 @@ matrix_postgres_db_migration_request: src: "{{ matrix_mautrix_telegram_sqlite_database_path_local }}" dst: "{{ matrix_mautrix_telegram_database_connection_string }}" - caller: "{{ role_path|basename }}" + caller: "{{ role_path | basename }}" engine_variable_name: 'matrix_mautrix_telegram_database_engine' engine_old: 'sqlite' systemd_services_to_stop: ['matrix-mautrix-telegram.service'] - - 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_mautrix_telegram_requires_restart: true - when: "matrix_mautrix_telegram_sqlite_database_path_local_stat_result.stat.exists|bool" + when: "matrix_mautrix_telegram_sqlite_database_path_local_stat_result.stat.exists | bool" when: "matrix_mautrix_telegram_database_engine == 'postgres'" - name: Ensure Mautrix Telegram paths exist @@ -46,7 +46,7 @@ - {path: "{{ matrix_mautrix_telegram_config_path }}", when: true} - {path: "{{ matrix_mautrix_telegram_data_path }}", when: true} - {path: "{{ matrix_mautrix_telegram_docker_src_files_path }}", when: "{{ matrix_mautrix_telegram_container_image_self_build }}"} - when: item.when|bool + when: item.when | bool - name: Ensure Mautrix Telegram image is pulled docker_image: @@ -54,7 +54,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_mautrix_telegram_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_mautrix_telegram_docker_image_force_pull }}" - when: "not matrix_mautrix_telegram_container_image_self_build|bool" + when: "not matrix_mautrix_telegram_container_image_self_build | bool" register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -68,7 +68,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_telegram_lottieconverter_git_pull_results - when: "matrix_telegram_lottieconverter_container_image_self_build|bool and matrix_mautrix_telegram_container_image_self_build|bool" + when: "matrix_telegram_lottieconverter_container_image_self_build | bool and matrix_mautrix_telegram_container_image_self_build | bool" - name: Ensure lottieconverter Docker image is built docker_image: @@ -80,7 +80,7 @@ dockerfile: Dockerfile path: "{{ matrix_telegram_lottieconverter_docker_src_files_path }}" pull: true - when: "matrix_telegram_lottieconverter_container_image_self_build|bool and matrix_telegram_lottieconverter_git_pull_results.changed and matrix_mautrix_telegram_container_image_self_build|bool" + when: "matrix_telegram_lottieconverter_container_image_self_build | bool and matrix_telegram_lottieconverter_git_pull_results.changed and matrix_mautrix_telegram_container_image_self_build | bool" - name: Ensure matrix-mautrix-telegram repository is present when self-building ansible.builtin.git: @@ -90,7 +90,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_mautrix_telegram_git_pull_results - when: "matrix_mautrix_telegram_container_image_self_build|bool" + when: "matrix_mautrix_telegram_container_image_self_build | bool" - name: Ensure matrix-mautrix-telegram Docker image is built docker_image: @@ -101,13 +101,13 @@ build: dockerfile: Dockerfile path: "{{ matrix_mautrix_telegram_docker_src_files_path }}" - pull: "{{ not matrix_telegram_lottieconverter_container_image_self_build_mask_arch|bool }}" + pull: "{{ not matrix_telegram_lottieconverter_container_image_self_build_mask_arch | bool }}" args: TARGETARCH: "" - when: "matrix_mautrix_telegram_container_image_self_build|bool and matrix_mautrix_telegram_git_pull_results.changed" + when: "matrix_mautrix_telegram_container_image_self_build | bool and matrix_mautrix_telegram_git_pull_results.changed" - name: Check if an old database file already exists - stat: + ansible.builtin.stat: path: "{{ matrix_mautrix_telegram_base_path }}/mautrix-telegram.db" register: matrix_mautrix_telegram_stat_database @@ -126,7 +126,7 @@ - name: Ensure mautrix-telegram config.yaml installed ansible.builtin.copy: - content: "{{ matrix_mautrix_telegram_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_mautrix_telegram_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_telegram_config_path }}/config.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -134,7 +134,7 @@ - name: Ensure mautrix-telegram registration.yaml installed ansible.builtin.copy: - content: "{{ matrix_mautrix_telegram_registration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_mautrix_telegram_registration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_telegram_config_path }}/registration.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -156,4 +156,4 @@ ansible.builtin.service: name: "matrix-mautrix-telegram.service" state: restarted - when: "matrix_mautrix_telegram_requires_restart|bool" + when: "matrix_mautrix_telegram_requires_restart | bool" diff --git a/roles/matrix-bridge-mautrix-telegram/tasks/setup_uninstall.yml b/roles/matrix-bridge-mautrix-telegram/tasks/setup_uninstall.yml index 01b58313..f4a5f569 100644 --- a/roles/matrix-bridge-mautrix-telegram/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-mautrix-telegram/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-mautrix-telegram service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-mautrix-telegram.service" register: matrix_mautrix_telegram_service_stat diff --git a/roles/matrix-bridge-mautrix-twitter/defaults/main.yml b/roles/matrix-bridge-mautrix-twitter/defaults/main.yml index 150b5b4d..4943d715 100644 --- a/roles/matrix-bridge-mautrix-twitter/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-twitter/defaults/main.yml @@ -87,11 +87,11 @@ matrix_mautrix_twitter_configuration_extension_yaml: | # If you need something more special, you can take full control by # completely redefining `matrix_mautrix_twitter_configuration_yaml`. -matrix_mautrix_twitter_configuration_extension: "{{ matrix_mautrix_twitter_configuration_extension_yaml|from_yaml if matrix_mautrix_twitter_configuration_extension_yaml|from_yaml is mapping else {} }}" +matrix_mautrix_twitter_configuration_extension: "{{ matrix_mautrix_twitter_configuration_extension_yaml | from_yaml if matrix_mautrix_twitter_configuration_extension_yaml | from_yaml is mapping else {} }}" # Holds the final configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_mautrix_twitter_configuration_yaml`. -matrix_mautrix_twitter_configuration: "{{ matrix_mautrix_twitter_configuration_yaml|from_yaml|combine(matrix_mautrix_twitter_configuration_extension, recursive=True) }}" +matrix_mautrix_twitter_configuration: "{{ matrix_mautrix_twitter_configuration_yaml | from_yaml|combine(matrix_mautrix_twitter_configuration_extension, recursive=True) }}" matrix_mautrix_twitter_registration_yaml: | id: twitter @@ -109,4 +109,4 @@ matrix_mautrix_twitter_registration_yaml: | rate_limited: false de.sorunome.msc2409.push_ephemeral: true -matrix_mautrix_twitter_registration: "{{ matrix_mautrix_twitter_registration_yaml|from_yaml }}" +matrix_mautrix_twitter_registration: "{{ matrix_mautrix_twitter_registration_yaml | from_yaml }}" diff --git a/roles/matrix-bridge-mautrix-twitter/tasks/init.yml b/roles/matrix-bridge-mautrix-twitter/tasks/init.yml index 3fdd66d8..75a60ffa 100644 --- a/roles/matrix-bridge-mautrix-twitter/tasks/init.yml +++ b/roles/matrix-bridge-mautrix-twitter/tasks/init.yml @@ -2,24 +2,24 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-twitter.service'] }}" - when: matrix_mautrix_twitter_enabled|bool + when: matrix_mautrix_twitter_enabled | bool # If the matrix-synapse role is not used, these variables may not exist. - ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ - matrix_synapse_container_extra_arguments|default([]) + matrix_synapse_container_extra_arguments | default([]) + ["--mount type=bind,src={{ matrix_mautrix_twitter_config_path }}/registration.yaml,dst=/matrix-mautrix-twitter-registration.yaml,ro"] }} matrix_synapse_app_service_config_files: > {{ - matrix_synapse_app_service_config_files|default([]) + matrix_synapse_app_service_config_files | default([]) + ["/matrix-mautrix-twitter-registration.yaml"] }} - when: matrix_mautrix_twitter_enabled|bool + when: matrix_mautrix_twitter_enabled | bool # ansible lower than 2.8, does not support docker_image build parameters # for self buildig it is explicitly needed, so we rather fail here diff --git a/roles/matrix-bridge-mautrix-twitter/tasks/main.yml b/roles/matrix-bridge-mautrix-twitter/tasks/main.yml index 6c0abe4f..2f0c39b2 100644 --- a/roles/matrix-bridge-mautrix-twitter/tasks/main.yml +++ b/roles/matrix-bridge-mautrix-twitter/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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_mautrix_twitter_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_mautrix_twitter_enabled | bool" tags: - setup-all - setup-mautrix-twitter -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_mautrix_twitter_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_mautrix_twitter_enabled | bool" tags: - setup-all - setup-mautrix-twitter -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_mautrix_twitter_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_mautrix_twitter_enabled | bool" tags: - setup-all - setup-mautrix-twitter diff --git a/roles/matrix-bridge-mautrix-twitter/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-twitter/tasks/setup_install.yml index 167176a8..a611f352 100644 --- a/roles/matrix-bridge-mautrix-twitter/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-twitter/tasks/setup_install.yml @@ -6,7 +6,7 @@ ansible.builtin.fail: msg: >- The matrix-bridge-mautrix-twitter role needs to execute before the matrix-synapse role. - when: "matrix_synapse_role_executed|default(False)" + when: "matrix_synapse_role_executed | default(False)" - ansible.builtin.set_fact: matrix_mautrix_twitter_requires_restart: false @@ -17,7 +17,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_mautrix_twitter_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_mautrix_twitter_docker_image_force_pull }}" - when: matrix_mautrix_twitter_enabled|bool and not matrix_mautrix_twitter_container_image_self_build + when: matrix_mautrix_twitter_enabled | bool and not matrix_mautrix_twitter_container_image_self_build register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -35,7 +35,7 @@ - {path: "{{ matrix_mautrix_twitter_config_path }}", when: true} - {path: "{{ matrix_mautrix_twitter_data_path }}", when: true} - {path: "{{ matrix_mautrix_twitter_docker_src_files_path }}", when: "{{ matrix_mautrix_twitter_container_image_self_build }}"} - when: item.when|bool + when: item.when | bool - name: Ensure Mautrix Twitter repository is present on self-build ansible.builtin.git: @@ -46,7 +46,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_mautrix_twitter_git_pull_results - when: "matrix_mautrix_twitter_enabled|bool and matrix_mautrix_twitter_container_image_self_build" + when: "matrix_mautrix_twitter_enabled | bool and matrix_mautrix_twitter_container_image_self_build" - name: Ensure Mautrix Twitter Docker image is built docker_image: @@ -57,11 +57,11 @@ dockerfile: Dockerfile path: "{{ matrix_mautrix_twitter_docker_src_files_path }}" pull: true - when: "matrix_mautrix_twitter_enabled|bool and matrix_mautrix_twitter_container_image_self_build|bool" + when: "matrix_mautrix_twitter_enabled | bool and matrix_mautrix_twitter_container_image_self_build | bool" - name: Ensure mautrix-twitter config.yaml installed ansible.builtin.copy: - content: "{{ matrix_mautrix_twitter_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_mautrix_twitter_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_twitter_config_path }}/config.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -69,7 +69,7 @@ - name: Ensure mautrix-twitter registration.yaml installed ansible.builtin.copy: - content: "{{ matrix_mautrix_twitter_registration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_mautrix_twitter_registration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_twitter_config_path }}/registration.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -91,4 +91,4 @@ ansible.builtin.service: name: "matrix-mautrix-twitter.service" state: restarted - when: "matrix_mautrix_twitter_requires_restart|bool" + when: "matrix_mautrix_twitter_requires_restart | bool" diff --git a/roles/matrix-bridge-mautrix-twitter/tasks/setup_uninstall.yml b/roles/matrix-bridge-mautrix-twitter/tasks/setup_uninstall.yml index 9c357931..5ce64906 100644 --- a/roles/matrix-bridge-mautrix-twitter/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-mautrix-twitter/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-mautrix-twitter service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-mautrix-twitter.service" register: matrix_mautrix_twitter_service_stat diff --git a/roles/matrix-bridge-mautrix-whatsapp/defaults/main.yml b/roles/matrix-bridge-mautrix-whatsapp/defaults/main.yml index e7f02709..9c8652fb 100644 --- a/roles/matrix-bridge-mautrix-whatsapp/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-whatsapp/defaults/main.yml @@ -106,11 +106,11 @@ matrix_mautrix_whatsapp_configuration_extension_yaml: | # If you need something more special, you can take full control by # completely redefining `matrix_mautrix_whatsapp_configuration_yaml`. -matrix_mautrix_whatsapp_configuration_extension: "{{ matrix_mautrix_whatsapp_configuration_extension_yaml|from_yaml if matrix_mautrix_whatsapp_configuration_extension_yaml|from_yaml is mapping else {} }}" +matrix_mautrix_whatsapp_configuration_extension: "{{ matrix_mautrix_whatsapp_configuration_extension_yaml | from_yaml if matrix_mautrix_whatsapp_configuration_extension_yaml | from_yaml is mapping else {} }}" # Holds the final configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_mautrix_whatsapp_configuration_yaml`. -matrix_mautrix_whatsapp_configuration: "{{ matrix_mautrix_whatsapp_configuration_yaml|from_yaml|combine(matrix_mautrix_whatsapp_configuration_extension, recursive=True) }}" +matrix_mautrix_whatsapp_configuration: "{{ matrix_mautrix_whatsapp_configuration_yaml | from_yaml|combine(matrix_mautrix_whatsapp_configuration_extension, recursive=True) }}" matrix_mautrix_whatsapp_registration_yaml: | id: whatsapp @@ -128,7 +128,7 @@ matrix_mautrix_whatsapp_registration_yaml: | regex: '^@{{ matrix_mautrix_whatsapp_appservice_bot_username|regex_escape }}:{{ matrix_mautrix_whatsapp_homeserver_domain|regex_escape }}$' de.sorunome.msc2409.push_ephemeral: true -matrix_mautrix_whatsapp_registration: "{{ matrix_mautrix_whatsapp_registration_yaml|from_yaml }}" +matrix_mautrix_whatsapp_registration: "{{ matrix_mautrix_whatsapp_registration_yaml | from_yaml }}" # Enable End-to-bridge encryption matrix_mautrix_whatsapp_bridge_encryption_allow: false diff --git a/roles/matrix-bridge-mautrix-whatsapp/tasks/init.yml b/roles/matrix-bridge-mautrix-whatsapp/tasks/init.yml index 75a0134b..ab10a530 100644 --- a/roles/matrix-bridge-mautrix-whatsapp/tasks/init.yml +++ b/roles/matrix-bridge-mautrix-whatsapp/tasks/init.yml @@ -1,21 +1,21 @@ --- - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-whatsapp.service'] }}" - when: matrix_mautrix_whatsapp_enabled|bool + when: matrix_mautrix_whatsapp_enabled | bool # If the matrix-synapse role is not used, these variables may not exist. - ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ - matrix_synapse_container_extra_arguments|default([]) + matrix_synapse_container_extra_arguments | default([]) + ["--mount type=bind,src={{ matrix_mautrix_whatsapp_config_path }}/registration.yaml,dst=/matrix-mautrix-whatsapp-registration.yaml,ro"] }} matrix_synapse_app_service_config_files: > {{ - matrix_synapse_app_service_config_files|default([]) + matrix_synapse_app_service_config_files | default([]) + ["/matrix-mautrix-whatsapp-registration.yaml"] }} - when: matrix_mautrix_whatsapp_enabled|bool + when: matrix_mautrix_whatsapp_enabled | bool diff --git a/roles/matrix-bridge-mautrix-whatsapp/tasks/main.yml b/roles/matrix-bridge-mautrix-whatsapp/tasks/main.yml index 0a963eb2..4df6fd23 100644 --- a/roles/matrix-bridge-mautrix-whatsapp/tasks/main.yml +++ b/roles/matrix-bridge-mautrix-whatsapp/tasks/main.yml @@ -1,21 +1,21 @@ --- -- 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_mautrix_whatsapp_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_mautrix_whatsapp_enabled | bool" tags: - setup-all - setup-mautrix-whatsapp -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" when: "run_setup and matrix_mautrix_whatsapp_enabled" tags: - setup-all - setup-mautrix-whatsapp -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" when: "run_setup and not matrix_mautrix_whatsapp_enabled" tags: - setup-all diff --git a/roles/matrix-bridge-mautrix-whatsapp/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-whatsapp/tasks/setup_install.yml index 59e5fe0e..c80407e1 100644 --- a/roles/matrix-bridge-mautrix-whatsapp/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-whatsapp/tasks/setup_install.yml @@ -6,14 +6,14 @@ ansible.builtin.fail: msg: >- The matrix-bridge-mautrix-whatsapp role needs to execute before the matrix-synapse role. - when: "matrix_synapse_role_executed|default(False)" + when: "matrix_synapse_role_executed | default(False)" - ansible.builtin.set_fact: matrix_mautrix_whatsapp_requires_restart: false - block: - name: Check if an SQLite database already exists - stat: + ansible.builtin.stat: path: "{{ matrix_mautrix_whatsapp_sqlite_database_path_local }}" register: matrix_mautrix_whatsapp_sqlite_database_path_local_stat_result @@ -22,17 +22,17 @@ matrix_postgres_db_migration_request: src: "{{ matrix_mautrix_whatsapp_sqlite_database_path_local }}" dst: "{{ matrix_mautrix_whatsapp_database_connection_string }}" - caller: "{{ role_path|basename }}" + caller: "{{ role_path | basename }}" engine_variable_name: 'matrix_mautrix_whatsapp_database_engine' engine_old: 'sqlite' systemd_services_to_stop: ['matrix-mautrix-whatsapp.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_mautrix_whatsapp_requires_restart: true - when: "matrix_mautrix_whatsapp_sqlite_database_path_local_stat_result.stat.exists|bool" + when: "matrix_mautrix_whatsapp_sqlite_database_path_local_stat_result.stat.exists | bool" when: "matrix_mautrix_whatsapp_database_engine == 'postgres'" @@ -48,7 +48,7 @@ - {path: "{{ matrix_mautrix_whatsapp_config_path }}", when: true} - {path: "{{ matrix_mautrix_whatsapp_data_path }}", when: true} - {path: "{{ matrix_mautrix_whatsapp_docker_src_files_path }}", when: "{{ matrix_mautrix_whatsapp_container_image_self_build }}"} - when: item.when|bool + when: item.when | bool - name: Ensure Mautrix Whatsapp image is pulled docker_image: @@ -71,7 +71,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_mautrix_whatsapp_git_pull_results - when: "matrix_mautrix_whatsapp_container_image_self_build|bool" + when: "matrix_mautrix_whatsapp_container_image_self_build | bool" - name: Ensure Mautrix Whatsapp Docker image is built docker_image: @@ -83,15 +83,15 @@ dockerfile: Dockerfile path: "{{ matrix_mautrix_whatsapp_docker_src_files_path }}" pull: true - when: "matrix_mautrix_whatsapp_container_image_self_build|bool" + when: "matrix_mautrix_whatsapp_container_image_self_build | bool" - name: Check if an old database file exists - stat: + ansible.builtin.stat: path: "{{ matrix_mautrix_whatsapp_base_path }}/mautrix-whatsapp.db" register: matrix_mautrix_whatsapp_stat_database - name: Check if an old matrix state file exists - stat: + ansible.builtin.stat: path: "{{ matrix_mautrix_whatsapp_base_path }}/mx-state.json" register: matrix_mautrix_whatsapp_stat_mx_state @@ -114,7 +114,7 @@ - name: Ensure mautrix-whatsapp config.yaml installed ansible.builtin.copy: - content: "{{ matrix_mautrix_whatsapp_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_mautrix_whatsapp_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_whatsapp_config_path }}/config.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -122,7 +122,7 @@ - name: Ensure mautrix-whatsapp registration.yaml installed ansible.builtin.copy: - content: "{{ matrix_mautrix_whatsapp_registration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_mautrix_whatsapp_registration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_whatsapp_config_path }}/registration.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -144,4 +144,4 @@ ansible.builtin.service: name: "matrix-mautrix-whatsapp.service" state: restarted - when: "matrix_mautrix_whatsapp_requires_restart|bool" + when: "matrix_mautrix_whatsapp_requires_restart | bool" diff --git a/roles/matrix-bridge-mautrix-whatsapp/tasks/setup_uninstall.yml b/roles/matrix-bridge-mautrix-whatsapp/tasks/setup_uninstall.yml index 94f7f30a..c531b530 100644 --- a/roles/matrix-bridge-mautrix-whatsapp/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-mautrix-whatsapp/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-mautrix-whatsapp service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-mautrix-whatsapp.service" register: matrix_mautrix_whatsapp_service_stat diff --git a/roles/matrix-bridge-mx-puppet-discord/defaults/main.yml b/roles/matrix-bridge-mx-puppet-discord/defaults/main.yml index 4d297f25..3402bbbc 100644 --- a/roles/matrix-bridge-mx-puppet-discord/defaults/main.yml +++ b/roles/matrix-bridge-mx-puppet-discord/defaults/main.yml @@ -88,11 +88,11 @@ matrix_mx_puppet_discord_configuration_extension_yaml: | # If you need something more special, you can take full control by # completely redefining `matrix_mx_puppet_discord_configuration_yaml`. -matrix_mx_puppet_discord_configuration_extension: "{{ matrix_mx_puppet_discord_configuration_extension_yaml|from_yaml if matrix_mx_puppet_discord_configuration_extension_yaml|from_yaml is mapping else {} }}" +matrix_mx_puppet_discord_configuration_extension: "{{ matrix_mx_puppet_discord_configuration_extension_yaml | from_yaml if matrix_mx_puppet_discord_configuration_extension_yaml | from_yaml is mapping else {} }}" # Holds the final configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_mx_puppet_discord_configuration_yaml`. -matrix_mx_puppet_discord_configuration: "{{ matrix_mx_puppet_discord_configuration_yaml|from_yaml|combine(matrix_mx_puppet_discord_configuration_extension, recursive=True) }}" +matrix_mx_puppet_discord_configuration: "{{ matrix_mx_puppet_discord_configuration_yaml | from_yaml|combine(matrix_mx_puppet_discord_configuration_extension, recursive=True) }}" matrix_mx_puppet_discord_registration_yaml: | as_token: "{{ matrix_mx_puppet_discord_appservice_token }}" @@ -112,4 +112,4 @@ matrix_mx_puppet_discord_registration_yaml: | url: {{ matrix_mx_puppet_discord_appservice_address }} de.sorunome.msc2409.push_ephemeral: true -matrix_mx_puppet_discord_registration: "{{ matrix_mx_puppet_discord_registration_yaml|from_yaml }}" +matrix_mx_puppet_discord_registration: "{{ matrix_mx_puppet_discord_registration_yaml | from_yaml }}" diff --git a/roles/matrix-bridge-mx-puppet-discord/tasks/init.yml b/roles/matrix-bridge-mx-puppet-discord/tasks/init.yml index ca009028..1a821d7d 100644 --- a/roles/matrix-bridge-mx-puppet-discord/tasks/init.yml +++ b/roles/matrix-bridge-mx-puppet-discord/tasks/init.yml @@ -8,21 +8,21 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mx-puppet-discord.service'] }}" - when: matrix_mx_puppet_discord_enabled|bool + when: matrix_mx_puppet_discord_enabled | bool # If the matrix-synapse role is not used, these variables may not exist. - ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ - matrix_synapse_container_extra_arguments|default([]) + matrix_synapse_container_extra_arguments | default([]) + ["--mount type=bind,src={{ matrix_mx_puppet_discord_config_path }}/registration.yaml,dst=/matrix-mx-puppet-discord-registration.yaml,ro"] }} matrix_synapse_app_service_config_files: > {{ - matrix_synapse_app_service_config_files|default([]) + matrix_synapse_app_service_config_files | default([]) + ["/matrix-mx-puppet-discord-registration.yaml"] }} - when: matrix_mx_puppet_discord_enabled|bool + when: matrix_mx_puppet_discord_enabled | bool diff --git a/roles/matrix-bridge-mx-puppet-discord/tasks/main.yml b/roles/matrix-bridge-mx-puppet-discord/tasks/main.yml index e11a2db0..281092e1 100644 --- a/roles/matrix-bridge-mx-puppet-discord/tasks/main.yml +++ b/roles/matrix-bridge-mx-puppet-discord/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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_mx_puppet_discord_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_mx_puppet_discord_enabled | bool" tags: - setup-all - setup-mx-puppet-discord -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_mx_puppet_discord_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_mx_puppet_discord_enabled | bool" tags: - setup-all - setup-mx-puppet-discord -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_mx_puppet_discord_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_mx_puppet_discord_enabled | bool" tags: - setup-all - setup-mx-puppet-discord diff --git a/roles/matrix-bridge-mx-puppet-discord/tasks/setup_install.yml b/roles/matrix-bridge-mx-puppet-discord/tasks/setup_install.yml index 3c3c43a0..48c92bf0 100644 --- a/roles/matrix-bridge-mx-puppet-discord/tasks/setup_install.yml +++ b/roles/matrix-bridge-mx-puppet-discord/tasks/setup_install.yml @@ -6,7 +6,7 @@ ansible.builtin.fail: msg: >- The matrix-bridge-mx-puppet-discord role needs to execute before the matrix-synapse role. - when: "matrix_synapse_role_executed|default(False)" + when: "matrix_synapse_role_executed | default(False)" - name: Ensure MX Puppet Discord paths exist ansible.builtin.file: @@ -20,10 +20,10 @@ - {path: "{{ matrix_mx_puppet_discord_config_path }}", when: true} - {path: "{{ matrix_mx_puppet_discord_data_path }}", when: true} - {path: "{{ matrix_mx_puppet_discord_docker_src_files_path }}", when: "{{ matrix_mx_puppet_discord_container_image_self_build }}"} - when: matrix_mx_puppet_discord_enabled|bool and item.when|bool + when: matrix_mx_puppet_discord_enabled | bool and item.when | bool - name: Check if an old database file already exists - stat: + ansible.builtin.stat: path: "{{ matrix_mx_puppet_discord_base_path }}/database.db" register: matrix_mx_puppet_discord_stat_database @@ -44,7 +44,7 @@ - block: - name: Check if an SQLite database already exists - stat: + ansible.builtin.stat: path: "{{ matrix_mx_puppet_discord_sqlite_database_path_local }}" register: matrix_mx_puppet_discord_sqlite_database_path_local_stat_result @@ -53,16 +53,16 @@ matrix_postgres_db_migration_request: src: "{{ matrix_mx_puppet_discord_sqlite_database_path_local }}" dst: "{{ matrix_mx_puppet_discord_database_connection_string }}" - caller: "{{ role_path|basename }}" + caller: "{{ role_path | basename }}" engine_variable_name: 'matrix_mx_puppet_discord_database_engine' engine_old: 'sqlite' systemd_services_to_stop: ['matrix-mx-puppet-discord.service'] - - 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_mx_puppet_discord_requires_restart: true - when: "matrix_mx_puppet_discord_sqlite_database_path_local_stat_result.stat.exists|bool" + when: "matrix_mx_puppet_discord_sqlite_database_path_local_stat_result.stat.exists | bool" when: "matrix_mx_puppet_discord_database_engine == 'postgres'" - name: Ensure MX Puppet Discord image is pulled @@ -71,7 +71,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_mx_puppet_discord_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_mx_puppet_discord_docker_image_force_pull }}" - when: matrix_mx_puppet_discord_enabled|bool and not matrix_mx_puppet_discord_container_image_self_build + when: matrix_mx_puppet_discord_enabled | bool and not matrix_mx_puppet_discord_container_image_self_build register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -86,7 +86,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_mx_puppet_discord_git_pull_results - when: "matrix_mx_puppet_discord_enabled|bool and matrix_mx_puppet_discord_container_image_self_build" + when: "matrix_mx_puppet_discord_enabled | bool and matrix_mx_puppet_discord_container_image_self_build" - name: Ensure MX Puppet Discord Docker image is built docker_image: @@ -98,11 +98,11 @@ dockerfile: "{{ matrix_mx_puppet_discord_container_image_self_build_dockerfile_path }}" path: "{{ matrix_mx_puppet_discord_docker_src_files_path }}" pull: true - when: "matrix_mx_puppet_discord_enabled|bool and matrix_mx_puppet_discord_container_image_self_build|bool" + when: "matrix_mx_puppet_discord_enabled | bool and matrix_mx_puppet_discord_container_image_self_build | bool" - name: Ensure mx-puppet-discord config.yaml installed ansible.builtin.copy: - content: "{{ matrix_mx_puppet_discord_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_mx_puppet_discord_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mx_puppet_discord_config_path }}/config.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -110,7 +110,7 @@ - name: Ensure mx-puppet-discord discord-registration.yaml installed ansible.builtin.copy: - content: "{{ matrix_mx_puppet_discord_registration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_mx_puppet_discord_registration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mx_puppet_discord_config_path }}/registration.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -132,4 +132,4 @@ ansible.builtin.service: name: "matrix-mx-puppet-discord.service" state: restarted - when: "matrix_mx_puppet_discord_requires_restart|bool" + when: "matrix_mx_puppet_discord_requires_restart | bool" diff --git a/roles/matrix-bridge-mx-puppet-discord/tasks/setup_uninstall.yml b/roles/matrix-bridge-mx-puppet-discord/tasks/setup_uninstall.yml index beff6c5d..585c6c85 100644 --- a/roles/matrix-bridge-mx-puppet-discord/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-mx-puppet-discord/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-mx-puppet-discord service - stat: + ansible.builtin.stat: path: "/etc/systemd/system/matrix-mx-puppet-discord.service" register: matrix_mx_puppet_discord_service_stat diff --git a/roles/matrix-bridge-mx-puppet-groupme/defaults/main.yml b/roles/matrix-bridge-mx-puppet-groupme/defaults/main.yml index 696380ed..f2f7d963 100644 --- a/roles/matrix-bridge-mx-puppet-groupme/defaults/main.yml +++ b/roles/matrix-bridge-mx-puppet-groupme/defaults/main.yml @@ -83,11 +83,11 @@ matrix_mx_puppet_groupme_configuration_extension_yaml: | # If you need something more special, you can take full control by # completely redefining `matrix_mx_puppet_groupme_configuration_yaml`. -matrix_mx_puppet_groupme_configuration_extension: "{{ matrix_mx_puppet_groupme_configuration_extension_yaml|from_yaml if matrix_mx_puppet_groupme_configuration_extension_yaml|from_yaml is mapping else {} }}" +matrix_mx_puppet_groupme_configuration_extension: "{{ matrix_mx_puppet_groupme_configuration_extension_yaml | from_yaml if matrix_mx_puppet_groupme_configuration_extension_yaml | from_yaml is mapping else {} }}" # Holds the final configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_mx_puppet_groupme_configuration_yaml`. -matrix_mx_puppet_groupme_configuration: "{{ matrix_mx_puppet_groupme_configuration_yaml|from_yaml|combine(matrix_mx_puppet_groupme_configuration_extension, recursive=True) }}" +matrix_mx_puppet_groupme_configuration: "{{ matrix_mx_puppet_groupme_configuration_yaml | from_yaml|combine(matrix_mx_puppet_groupme_configuration_extension, recursive=True) }}" matrix_mx_puppet_groupme_registration_yaml: | as_token: "{{ matrix_mx_puppet_groupme_appservice_token }}" @@ -107,4 +107,4 @@ matrix_mx_puppet_groupme_registration_yaml: | url: {{ matrix_mx_puppet_groupme_appservice_address }} de.sorunome.msc2409.push_ephemeral: true -matrix_mx_puppet_groupme_registration: "{{ matrix_mx_puppet_groupme_registration_yaml|from_yaml }}" +matrix_mx_puppet_groupme_registration: "{{ matrix_mx_puppet_groupme_registration_yaml | from_yaml }}" diff --git a/roles/matrix-bridge-mx-puppet-groupme/tasks/init.yml b/roles/matrix-bridge-mx-puppet-groupme/tasks/init.yml index 0791546d..92f041d4 100644 --- a/roles/matrix-bridge-mx-puppet-groupme/tasks/init.yml +++ b/roles/matrix-bridge-mx-puppet-groupme/tasks/init.yml @@ -8,21 +8,21 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mx-puppet-groupme.service'] }}" - when: matrix_mx_puppet_groupme_enabled|bool + when: matrix_mx_puppet_groupme_enabled | bool # If the matrix-synapse role is not used, these variables may not exist. - ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ - matrix_synapse_container_extra_arguments|default([]) + matrix_synapse_container_extra_arguments | default([]) + ["--mount type=bind,src={{ matrix_mx_puppet_groupme_config_path }}/registration.yaml,dst=/matrix-mx-puppet-groupme-registration.yaml,ro"] }} matrix_synapse_app_service_config_files: > {{ - matrix_synapse_app_service_config_files|default([]) + matrix_synapse_app_service_config_files | default([]) + ["/matrix-mx-puppet-groupme-registration.yaml"] }} - when: matrix_mx_puppet_groupme_enabled|bool + when: matrix_mx_puppet_groupme_enabled | bool diff --git a/roles/matrix-bridge-mx-puppet-groupme/tasks/main.yml b/roles/matrix-bridge-mx-puppet-groupme/tasks/main.yml index 070f920b..8cc55759 100644 --- a/roles/matrix-bridge-mx-puppet-groupme/tasks/main.yml +++ b/roles/matrix-bridge-mx-puppet-groupme/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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_mx_puppet_groupme_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_mx_puppet_groupme_enabled | bool" tags: - setup-all - setup-mx-puppet-groupme -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_mx_puppet_groupme_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_mx_puppet_groupme_enabled | bool" tags: - setup-all - setup-mx-puppet-groupme -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_mx_puppet_groupme_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_mx_puppet_groupme_enabled | bool" tags: - setup-all - setup-mx-puppet-groupme diff --git a/roles/matrix-bridge-mx-puppet-groupme/tasks/setup_install.yml b/roles/matrix-bridge-mx-puppet-groupme/tasks/setup_install.yml index 9ca9c7ea..3393db21 100644 --- a/roles/matrix-bridge-mx-puppet-groupme/tasks/setup_install.yml +++ b/roles/matrix-bridge-mx-puppet-groupme/tasks/setup_install.yml @@ -6,7 +6,7 @@ ansible.builtin.fail: msg: >- The matrix-bridge-mx-puppet-groupme role needs to execute before the matrix-synapse role. - when: "matrix_synapse_role_executed|default(False)" + when: "matrix_synapse_role_executed | default(False)" - name: Ensure MX Puppet Groupme paths exist ansible.builtin.file: @@ -20,10 +20,10 @@ - {path: "{{ matrix_mx_puppet_groupme_config_path }}", when: true} - {path: "{{ matrix_mx_puppet_groupme_data_path }}", when: true} - {path: "{{ matrix_mx_puppet_groupme_docker_src_files_path }}", when: "{{ matrix_mx_puppet_groupme_container_image_self_build }}"} - when: matrix_mx_puppet_groupme_enabled|bool and item.when|bool + when: matrix_mx_puppet_groupme_enabled | bool and item.when | bool - name: Check if an old database file already exists - stat: + ansible.builtin.stat: path: "{{ matrix_mx_puppet_groupme_base_path }}/database.db" register: matrix_mx_puppet_groupme_stat_database @@ -45,7 +45,7 @@ - block: - name: Check if an SQLite database already exists - stat: + ansible.builtin.stat: path: "{{ matrix_mx_puppet_groupme_sqlite_database_path_local }}" register: matrix_mx_puppet_groupme_sqlite_database_path_local_stat_result @@ -54,16 +54,16 @@ matrix_postgres_db_migration_request: src: "{{ matrix_mx_puppet_groupme_sqlite_database_path_local }}" dst: "{{ matrix_mx_puppet_groupme_database_connection_string }}" - caller: "{{ role_path|basename }}" + caller: "{{ role_path | basename }}" engine_variable_name: 'matrix_mx_puppet_groupme_database_engine' engine_old: 'sqlite' systemd_services_to_stop: ['matrix-mx-puppet-groupme.service'] - - 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_mx_puppet_groupme_requires_restart: true - when: "matrix_mx_puppet_groupme_sqlite_database_path_local_stat_result.stat.exists|bool" + when: "matrix_mx_puppet_groupme_sqlite_database_path_local_stat_result.stat.exists | bool" when: "matrix_mx_puppet_groupme_database_engine == 'postgres'" - name: Ensure MX Puppet Groupme image is pulled @@ -72,7 +72,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_mx_puppet_groupme_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_mx_puppet_groupme_docker_image_force_pull }}" - when: matrix_mx_puppet_groupme_enabled|bool and not matrix_mx_puppet_groupme_container_image_self_build + when: matrix_mx_puppet_groupme_enabled | bool and not matrix_mx_puppet_groupme_container_image_self_build register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -86,7 +86,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_mx_puppet_groupme_git_pull_results - when: "matrix_mx_puppet_groupme_enabled|bool and matrix_mx_puppet_groupme_container_image_self_build" + when: "matrix_mx_puppet_groupme_enabled | bool and matrix_mx_puppet_groupme_container_image_self_build" - name: Ensure MX Puppet Groupme Docker image is built docker_image: @@ -98,11 +98,11 @@ dockerfile: Dockerfile path: "{{ matrix_mx_puppet_groupme_docker_src_files_path }}" pull: true - when: "matrix_mx_puppet_groupme_enabled|bool and matrix_mx_puppet_groupme_container_image_self_build" + when: "matrix_mx_puppet_groupme_enabled | bool and matrix_mx_puppet_groupme_container_image_self_build" - name: Ensure mx-puppet-groupme config.yaml installed ansible.builtin.copy: - content: "{{ matrix_mx_puppet_groupme_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_mx_puppet_groupme_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mx_puppet_groupme_config_path }}/config.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -110,7 +110,7 @@ - name: Ensure mx-puppet-groupme groupme-registration.yaml installed ansible.builtin.copy: - content: "{{ matrix_mx_puppet_groupme_registration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_mx_puppet_groupme_registration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mx_puppet_groupme_config_path }}/registration.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -132,4 +132,4 @@ ansible.builtin.service: name: "matrix-mx-puppet-groupme.service" state: restarted - when: "matrix_mx_puppet_groupme_requires_restart|bool" + when: "matrix_mx_puppet_groupme_requires_restart | bool" diff --git a/roles/matrix-bridge-mx-puppet-groupme/tasks/setup_uninstall.yml b/roles/matrix-bridge-mx-puppet-groupme/tasks/setup_uninstall.yml index faf5ac0a..5ded6107 100644 --- a/roles/matrix-bridge-mx-puppet-groupme/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-mx-puppet-groupme/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-mx-puppet-groupme service - stat: + ansible.builtin.stat: path: "/etc/systemd/system/matrix-mx-puppet-groupme.service" register: matrix_mx_puppet_groupme_service_stat diff --git a/roles/matrix-bridge-mx-puppet-instagram/defaults/main.yml b/roles/matrix-bridge-mx-puppet-instagram/defaults/main.yml index c7c86e3c..8c68f980 100644 --- a/roles/matrix-bridge-mx-puppet-instagram/defaults/main.yml +++ b/roles/matrix-bridge-mx-puppet-instagram/defaults/main.yml @@ -77,11 +77,11 @@ matrix_mx_puppet_instagram_configuration_extension_yaml: | # If you need something more special, you can take full control by # completely redefining `matrix_mx_puppet_instagram_configuration_yaml`. -matrix_mx_puppet_instagram_configuration_extension: "{{ matrix_mx_puppet_instagram_configuration_extension_yaml|from_yaml if matrix_mx_puppet_instagram_configuration_extension_yaml|from_yaml is mapping else {} }}" +matrix_mx_puppet_instagram_configuration_extension: "{{ matrix_mx_puppet_instagram_configuration_extension_yaml | from_yaml if matrix_mx_puppet_instagram_configuration_extension_yaml | from_yaml is mapping else {} }}" # Holds the final configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_mx_puppet_instagram_configuration_yaml`. -matrix_mx_puppet_instagram_configuration: "{{ matrix_mx_puppet_instagram_configuration_yaml|from_yaml|combine(matrix_mx_puppet_instagram_configuration_extension, recursive=True) }}" +matrix_mx_puppet_instagram_configuration: "{{ matrix_mx_puppet_instagram_configuration_yaml | from_yaml|combine(matrix_mx_puppet_instagram_configuration_extension, recursive=True) }}" matrix_mx_puppet_instagram_registration_yaml: | as_token: "{{ matrix_mx_puppet_instagram_appservice_token }}" @@ -101,4 +101,4 @@ matrix_mx_puppet_instagram_registration_yaml: | url: {{ matrix_mx_puppet_instagram_appservice_address }} de.sorunome.msc2409.push_ephemeral: true -matrix_mx_puppet_instagram_registration: "{{ matrix_mx_puppet_instagram_registration_yaml|from_yaml }}" +matrix_mx_puppet_instagram_registration: "{{ matrix_mx_puppet_instagram_registration_yaml | from_yaml }}" diff --git a/roles/matrix-bridge-mx-puppet-instagram/tasks/init.yml b/roles/matrix-bridge-mx-puppet-instagram/tasks/init.yml index 3f2b98dc..5e89275c 100644 --- a/roles/matrix-bridge-mx-puppet-instagram/tasks/init.yml +++ b/roles/matrix-bridge-mx-puppet-instagram/tasks/init.yml @@ -8,21 +8,21 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mx-puppet-instagram.service'] }}" - when: matrix_mx_puppet_instagram_enabled|bool + when: matrix_mx_puppet_instagram_enabled | bool # If the matrix-synapse role is not used, these variables may not exist. - ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ - matrix_synapse_container_extra_arguments|default([]) + matrix_synapse_container_extra_arguments | default([]) + ["--mount type=bind,src={{ matrix_mx_puppet_instagram_config_path }}/registration.yaml,dst=/matrix-mx-puppet-instagram-registration.yaml,ro"] }} matrix_synapse_app_service_config_files: > {{ - matrix_synapse_app_service_config_files|default([]) + matrix_synapse_app_service_config_files | default([]) + ["/matrix-mx-puppet-instagram-registration.yaml"] }} - when: matrix_mx_puppet_instagram_enabled|bool + when: matrix_mx_puppet_instagram_enabled | bool diff --git a/roles/matrix-bridge-mx-puppet-instagram/tasks/main.yml b/roles/matrix-bridge-mx-puppet-instagram/tasks/main.yml index 6abb281f..978577cc 100644 --- a/roles/matrix-bridge-mx-puppet-instagram/tasks/main.yml +++ b/roles/matrix-bridge-mx-puppet-instagram/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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_mx_puppet_instagram_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_mx_puppet_instagram_enabled | bool" tags: - setup-all - setup-mx-puppet-instagram -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_mx_puppet_instagram_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_mx_puppet_instagram_enabled | bool" tags: - setup-all - setup-mx-puppet-instagram -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_mx_puppet_instagram_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_mx_puppet_instagram_enabled | bool" tags: - setup-all - setup-mx-puppet-instagram diff --git a/roles/matrix-bridge-mx-puppet-instagram/tasks/setup_install.yml b/roles/matrix-bridge-mx-puppet-instagram/tasks/setup_install.yml index 4048e175..9222266b 100644 --- a/roles/matrix-bridge-mx-puppet-instagram/tasks/setup_install.yml +++ b/roles/matrix-bridge-mx-puppet-instagram/tasks/setup_install.yml @@ -6,7 +6,7 @@ ansible.builtin.fail: msg: >- The matrix-bridge-mx-puppet-instagram role needs to execute before the matrix-synapse role. - when: "matrix_synapse_role_executed|default(False)" + when: "matrix_synapse_role_executed | default(False)" - ansible.builtin.set_fact: @@ -14,7 +14,7 @@ - block: - name: Check if an SQLite database already exists - stat: + ansible.builtin.stat: path: "{{ matrix_mx_puppet_instagram_sqlite_database_path_local }}" register: matrix_mx_puppet_instagram_sqlite_database_path_local_stat_result @@ -23,16 +23,16 @@ matrix_postgres_db_migration_request: src: "{{ matrix_mx_puppet_instagram_sqlite_database_path_local }}" dst: "{{ matrix_mx_puppet_instagram_database_connection_string }}" - caller: "{{ role_path|basename }}" + caller: "{{ role_path | basename }}" engine_variable_name: 'matrix_mx_puppet_instagram_database_engine' engine_old: 'sqlite' systemd_services_to_stop: ['matrix-mx-puppet-instagram.service'] - - 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_mx_puppet_instagram_requires_restart: true - when: "matrix_mx_puppet_instagram_sqlite_database_path_local_stat_result.stat.exists|bool" + when: "matrix_mx_puppet_instagram_sqlite_database_path_local_stat_result.stat.exists | bool" when: "matrix_mx_puppet_instagram_database_engine == 'postgres'" - name: Ensure mx-puppet-instagram image is pulled @@ -41,7 +41,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_mx_puppet_instagram_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_mx_puppet_instagram_docker_image_force_pull }}" - when: matrix_mx_puppet_instagram_enabled|bool and not matrix_mx_puppet_instagram_container_image_self_build + when: matrix_mx_puppet_instagram_enabled | bool and not matrix_mx_puppet_instagram_container_image_self_build register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -59,7 +59,7 @@ - {path: "{{ matrix_mx_puppet_instagram_config_path }}", when: true} - {path: "{{ matrix_mx_puppet_instagram_data_path }}", when: true} - {path: "{{ matrix_mx_puppet_instagram_docker_src_files_path }}", when: "{{ matrix_mx_puppet_instagram_container_image_self_build }}"} - when: matrix_mx_puppet_instagram_enabled|bool and item.when|bool + when: matrix_mx_puppet_instagram_enabled | bool and item.when | bool - name: Ensure mx-puppet-instagram repository is present on self build ansible.builtin.git: @@ -69,7 +69,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_mx_puppet_instagram_git_pull_results - when: "matrix_mx_puppet_instagram_enabled|bool and matrix_mx_puppet_instagram_container_image_self_build|bool" + when: "matrix_mx_puppet_instagram_enabled | bool and matrix_mx_puppet_instagram_container_image_self_build | bool" - name: Ensure mx-puppet-instagram Docker image is built docker_image: @@ -81,11 +81,11 @@ dockerfile: Dockerfile path: "{{ matrix_mx_puppet_instagram_docker_src_files_path }}" pull: true - when: "matrix_mx_puppet_instagram_enabled|bool and matrix_mx_puppet_instagram_container_image_self_build|bool" + when: "matrix_mx_puppet_instagram_enabled | bool and matrix_mx_puppet_instagram_container_image_self_build | bool" - name: Ensure mx-puppet-instagram config.yaml installed ansible.builtin.copy: - content: "{{ matrix_mx_puppet_instagram_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_mx_puppet_instagram_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mx_puppet_instagram_config_path }}/config.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -93,7 +93,7 @@ - name: Ensure mx-puppet-instagram-registration.yaml installed ansible.builtin.copy: - content: "{{ matrix_mx_puppet_instagram_registration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_mx_puppet_instagram_registration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mx_puppet_instagram_config_path }}/registration.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -115,4 +115,4 @@ ansible.builtin.service: name: "matrix-mx-puppet-instagram.service" state: restarted - when: "matrix_mx_puppet_instagram_requires_restart|bool" + when: "matrix_mx_puppet_instagram_requires_restart | bool" diff --git a/roles/matrix-bridge-mx-puppet-instagram/tasks/setup_uninstall.yml b/roles/matrix-bridge-mx-puppet-instagram/tasks/setup_uninstall.yml index cb876e2a..2d5a98aa 100644 --- a/roles/matrix-bridge-mx-puppet-instagram/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-mx-puppet-instagram/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-mx-puppet-instagram service - stat: + ansible.builtin.stat: path: "/etc/systemd/system/matrix-mx-puppet-instagram.service" register: matrix_mx_puppet_instagram_service_stat diff --git a/roles/matrix-bridge-mx-puppet-slack/defaults/main.yml b/roles/matrix-bridge-mx-puppet-slack/defaults/main.yml index 294b18cf..cc437ad8 100644 --- a/roles/matrix-bridge-mx-puppet-slack/defaults/main.yml +++ b/roles/matrix-bridge-mx-puppet-slack/defaults/main.yml @@ -92,11 +92,11 @@ matrix_mx_puppet_slack_configuration_extension_yaml: | # If you need something more special, you can take full control by # completely redefining `matrix_mx_puppet_slack_configuration_yaml`. -matrix_mx_puppet_slack_configuration_extension: "{{ matrix_mx_puppet_slack_configuration_extension_yaml|from_yaml if matrix_mx_puppet_slack_configuration_extension_yaml|from_yaml is mapping else {} }}" +matrix_mx_puppet_slack_configuration_extension: "{{ matrix_mx_puppet_slack_configuration_extension_yaml | from_yaml if matrix_mx_puppet_slack_configuration_extension_yaml | from_yaml is mapping else {} }}" # Holds the final configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_mx_puppet_slack_configuration_yaml`. -matrix_mx_puppet_slack_configuration: "{{ matrix_mx_puppet_slack_configuration_yaml|from_yaml|combine(matrix_mx_puppet_slack_configuration_extension, recursive=True) }}" +matrix_mx_puppet_slack_configuration: "{{ matrix_mx_puppet_slack_configuration_yaml | from_yaml|combine(matrix_mx_puppet_slack_configuration_extension, recursive=True) }}" matrix_mx_puppet_slack_registration_yaml: | as_token: "{{ matrix_mx_puppet_slack_appservice_token }}" @@ -116,4 +116,4 @@ matrix_mx_puppet_slack_registration_yaml: | url: {{ matrix_mx_puppet_slack_appservice_address }} de.sorunome.msc2409.push_ephemeral: true -matrix_mx_puppet_slack_registration: "{{ matrix_mx_puppet_slack_registration_yaml|from_yaml }}" +matrix_mx_puppet_slack_registration: "{{ matrix_mx_puppet_slack_registration_yaml | from_yaml }}" diff --git a/roles/matrix-bridge-mx-puppet-slack/tasks/init.yml b/roles/matrix-bridge-mx-puppet-slack/tasks/init.yml index 74a6ed44..fd9d62ae 100644 --- a/roles/matrix-bridge-mx-puppet-slack/tasks/init.yml +++ b/roles/matrix-bridge-mx-puppet-slack/tasks/init.yml @@ -8,24 +8,24 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mx-puppet-slack.service'] }}" - when: matrix_mx_puppet_slack_enabled|bool + when: matrix_mx_puppet_slack_enabled | bool # If the matrix-synapse role is not used, these variables may not exist. - ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ - matrix_synapse_container_extra_arguments|default([]) + matrix_synapse_container_extra_arguments | default([]) + ["--mount type=bind,src={{ matrix_mx_puppet_slack_config_path }}/registration.yaml,dst=/matrix-mx-puppet-slack-registration.yaml,ro"] }} matrix_synapse_app_service_config_files: > {{ - matrix_synapse_app_service_config_files|default([]) + matrix_synapse_app_service_config_files | default([]) + ["/matrix-mx-puppet-slack-registration.yaml"] }} - when: matrix_mx_puppet_slack_enabled|bool + when: matrix_mx_puppet_slack_enabled | bool - block: - name: Fail if matrix-nginx-proxy role already executed @@ -35,13 +35,13 @@ but it's pointless since the matrix-nginx-proxy role had already executed. To fix this, please change the order of roles in your playbook, so that the matrix-nginx-proxy role would run after the matrix-mx-puppet-slack role. - when: matrix_nginx_proxy_role_executed|default(False)|bool + when: matrix_nginx_proxy_role_executed | default(False) | bool - name: Generate Matrix MX Puppet Slack proxying configuration for matrix-nginx-proxy ansible.builtin.set_fact: matrix_mx_puppet_slack_matrix_nginx_proxy_configuration: | location {{ matrix_mx_puppet_slack_redirect_path }} { - {% if matrix_nginx_proxy_enabled|default(False) %} + {% if matrix_nginx_proxy_enabled | default(False) %} {# Use the embedded DNS resolver in Docker containers to discover the service #} resolver 127.0.0.11 valid=5s; set $backend "{{ matrix_mx_puppet_slack_appservice_address }}"; @@ -56,13 +56,13 @@ ansible.builtin.set_fact: matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: | {{ - matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([]) + matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks | default([]) + [matrix_mx_puppet_slack_matrix_nginx_proxy_configuration] }} tags: - always - when: matrix_mx_puppet_slack_enabled|bool + when: matrix_mx_puppet_slack_enabled | bool - name: Warn about reverse-proxying if matrix-nginx-proxy not used ansible.builtin.debug: @@ -72,4 +72,4 @@ Please make sure that you're proxying the `{{ matrix_mx_puppet_slack_redirect_path }}` URL endpoint to the matrix-mx-puppet-slack container. You can expose the container's port using the `matrix_appservice_slack_container_http_host_bind_port` variable. - when: "matrix_mx_puppet_slack_enabled|bool and not matrix_nginx_proxy_enabled|default(False)|bool" + when: "matrix_mx_puppet_slack_enabled | bool and not matrix_nginx_proxy_enabled | default(False) | bool" diff --git a/roles/matrix-bridge-mx-puppet-slack/tasks/main.yml b/roles/matrix-bridge-mx-puppet-slack/tasks/main.yml index 0e886d45..869afc49 100644 --- a/roles/matrix-bridge-mx-puppet-slack/tasks/main.yml +++ b/roles/matrix-bridge-mx-puppet-slack/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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_mx_puppet_slack_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_mx_puppet_slack_enabled | bool" tags: - setup-all - setup-mx-puppet-slack -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_mx_puppet_slack_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_mx_puppet_slack_enabled | bool" tags: - setup-all - setup-mx-puppet-slack -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_mx_puppet_slack_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_mx_puppet_slack_enabled | bool" tags: - setup-all - setup-mx-puppet-slack diff --git a/roles/matrix-bridge-mx-puppet-slack/tasks/setup_install.yml b/roles/matrix-bridge-mx-puppet-slack/tasks/setup_install.yml index 48408b5a..5dab3c4a 100644 --- a/roles/matrix-bridge-mx-puppet-slack/tasks/setup_install.yml +++ b/roles/matrix-bridge-mx-puppet-slack/tasks/setup_install.yml @@ -6,7 +6,7 @@ ansible.builtin.fail: msg: >- The matrix-bridge-mx-puppet-slack role needs to execute before the matrix-synapse role. - when: "matrix_synapse_role_executed|default(False)" + when: "matrix_synapse_role_executed | default(False)" - name: Ensure MX Puppet Slack paths exist ansible.builtin.file: @@ -20,10 +20,10 @@ - {path: "{{ matrix_mx_puppet_slack_config_path }}", when: true} - {path: "{{ matrix_mx_puppet_slack_data_path }}", when: true} - {path: "{{ matrix_mx_puppet_slack_docker_src_files_path }}", when: "{{ matrix_mx_puppet_slack_container_image_self_build }}"} - when: matrix_mx_puppet_slack_enabled|bool and item.when|bool + when: matrix_mx_puppet_slack_enabled | bool and item.when | bool - name: Check if an old database file already exists - stat: + ansible.builtin.stat: path: "{{ matrix_mx_puppet_slack_base_path }}/database.db" register: matrix_mx_puppet_slack_stat_database @@ -41,7 +41,7 @@ - block: - name: Check if an SQLite database already exists - stat: + ansible.builtin.stat: path: "{{ matrix_mx_puppet_slack_sqlite_database_path_local }}" register: matrix_mx_puppet_slack_sqlite_database_path_local_stat_result @@ -50,16 +50,16 @@ matrix_postgres_db_migration_request: src: "{{ matrix_mx_puppet_slack_sqlite_database_path_local }}" dst: "{{ matrix_mx_puppet_slack_database_connection_string }}" - caller: "{{ role_path|basename }}" + caller: "{{ role_path | basename }}" engine_variable_name: 'matrix_mx_puppet_slack_database_engine' engine_old: 'sqlite' systemd_services_to_stop: ['matrix-mx-puppet-slack.service'] - - 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_mx_puppet_slack_requires_restart: true - when: "matrix_mx_puppet_slack_sqlite_database_path_local_stat_result.stat.exists|bool" + when: "matrix_mx_puppet_slack_sqlite_database_path_local_stat_result.stat.exists | bool" when: "matrix_mx_puppet_slack_database_engine == 'postgres'" - name: Ensure MX Puppet Slack image is pulled @@ -68,7 +68,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_mx_puppet_slack_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_mx_puppet_slack_docker_image_force_pull }}" - when: matrix_mx_puppet_slack_enabled|bool and not matrix_mx_puppet_slack_container_image_self_build + when: matrix_mx_puppet_slack_enabled | bool and not matrix_mx_puppet_slack_container_image_self_build register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -83,7 +83,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_mx_puppet_slack_git_pull_results - when: "matrix_mx_puppet_slack_enabled|bool and matrix_mx_puppet_slack_container_image_self_build" + when: "matrix_mx_puppet_slack_enabled | bool and matrix_mx_puppet_slack_container_image_self_build" - name: Ensure MX Puppet Slack Docker image is built docker_image: @@ -95,7 +95,7 @@ dockerfile: "{{ matrix_mx_puppet_slack_container_image_self_build_dockerfile_path }}" path: "{{ matrix_mx_puppet_slack_docker_src_files_path }}" pull: true - when: "matrix_mx_puppet_slack_enabled|bool and matrix_mx_puppet_slack_container_image_self_build" + when: "matrix_mx_puppet_slack_enabled | bool and matrix_mx_puppet_slack_container_image_self_build" - name: (Data relocation) Move mx-puppet-slack database file to ./data directory ansible.builtin.command: "mv {{ matrix_mx_puppet_slack_base_path }}/database.db {{ matrix_mx_puppet_slack_data_path }}/database.db" @@ -103,7 +103,7 @@ - name: Ensure mx-puppet-slack config.yaml installed ansible.builtin.copy: - content: "{{ matrix_mx_puppet_slack_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_mx_puppet_slack_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mx_puppet_slack_config_path }}/config.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -111,7 +111,7 @@ - name: Ensure mx-puppet-slack slack-registration.yaml installed ansible.builtin.copy: - content: "{{ matrix_mx_puppet_slack_registration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_mx_puppet_slack_registration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mx_puppet_slack_config_path }}/registration.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -133,4 +133,4 @@ ansible.builtin.service: name: "matrix-mx-puppet-slack.service" state: restarted - when: "matrix_mx_puppet_slack_requires_restart|bool" + when: "matrix_mx_puppet_slack_requires_restart | bool" diff --git a/roles/matrix-bridge-mx-puppet-slack/tasks/setup_uninstall.yml b/roles/matrix-bridge-mx-puppet-slack/tasks/setup_uninstall.yml index 835e20d7..3f91b467 100644 --- a/roles/matrix-bridge-mx-puppet-slack/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-mx-puppet-slack/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-mx-puppet-slack service - stat: + ansible.builtin.stat: path: "/etc/systemd/system/matrix-mx-puppet-slack.service" register: matrix_mx_puppet_slack_service_stat diff --git a/roles/matrix-bridge-mx-puppet-steam/defaults/main.yml b/roles/matrix-bridge-mx-puppet-steam/defaults/main.yml index 430dc90f..933b043c 100644 --- a/roles/matrix-bridge-mx-puppet-steam/defaults/main.yml +++ b/roles/matrix-bridge-mx-puppet-steam/defaults/main.yml @@ -83,11 +83,11 @@ matrix_mx_puppet_steam_configuration_extension_yaml: | # If you need something more special, you can take full control by # completely redefining `matrix_mx_puppet_steam_configuration_yaml`. -matrix_mx_puppet_steam_configuration_extension: "{{ matrix_mx_puppet_steam_configuration_extension_yaml|from_yaml if matrix_mx_puppet_steam_configuration_extension_yaml|from_yaml is mapping else {} }}" +matrix_mx_puppet_steam_configuration_extension: "{{ matrix_mx_puppet_steam_configuration_extension_yaml | from_yaml if matrix_mx_puppet_steam_configuration_extension_yaml | from_yaml is mapping else {} }}" # Holds the final configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_mx_puppet_steam_configuration_yaml`. -matrix_mx_puppet_steam_configuration: "{{ matrix_mx_puppet_steam_configuration_yaml|from_yaml|combine(matrix_mx_puppet_steam_configuration_extension, recursive=True) }}" +matrix_mx_puppet_steam_configuration: "{{ matrix_mx_puppet_steam_configuration_yaml | from_yaml|combine(matrix_mx_puppet_steam_configuration_extension, recursive=True) }}" matrix_mx_puppet_steam_registration_yaml: | as_token: "{{ matrix_mx_puppet_steam_appservice_token }}" @@ -107,4 +107,4 @@ matrix_mx_puppet_steam_registration_yaml: | url: {{ matrix_mx_puppet_steam_appservice_address }} de.sorunome.msc2409.push_ephemeral: true -matrix_mx_puppet_steam_registration: "{{ matrix_mx_puppet_steam_registration_yaml|from_yaml }}" +matrix_mx_puppet_steam_registration: "{{ matrix_mx_puppet_steam_registration_yaml | from_yaml }}" diff --git a/roles/matrix-bridge-mx-puppet-steam/tasks/init.yml b/roles/matrix-bridge-mx-puppet-steam/tasks/init.yml index 7c5487f4..6c9a9a4f 100644 --- a/roles/matrix-bridge-mx-puppet-steam/tasks/init.yml +++ b/roles/matrix-bridge-mx-puppet-steam/tasks/init.yml @@ -8,21 +8,21 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mx-puppet-steam.service'] }}" - when: matrix_mx_puppet_steam_enabled|bool + when: matrix_mx_puppet_steam_enabled | bool # If the matrix-synapse role is not used, these variables may not exist. - ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ - matrix_synapse_container_extra_arguments|default([]) + matrix_synapse_container_extra_arguments | default([]) + ["--mount type=bind,src={{ matrix_mx_puppet_steam_config_path }}/registration.yaml,dst=/matrix-mx-puppet-steam-registration.yaml,ro"] }} matrix_synapse_app_service_config_files: > {{ - matrix_synapse_app_service_config_files|default([]) + matrix_synapse_app_service_config_files | default([]) + ["/matrix-mx-puppet-steam-registration.yaml"] }} - when: matrix_mx_puppet_steam_enabled|bool + when: matrix_mx_puppet_steam_enabled | bool diff --git a/roles/matrix-bridge-mx-puppet-steam/tasks/main.yml b/roles/matrix-bridge-mx-puppet-steam/tasks/main.yml index 733cfa90..236a7009 100644 --- a/roles/matrix-bridge-mx-puppet-steam/tasks/main.yml +++ b/roles/matrix-bridge-mx-puppet-steam/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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_mx_puppet_steam_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_mx_puppet_steam_enabled | bool" tags: - setup-all - setup-mx-puppet-steam -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_mx_puppet_steam_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_mx_puppet_steam_enabled | bool" tags: - setup-all - setup-mx-puppet-steam -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_mx_puppet_steam_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_mx_puppet_steam_enabled | bool" tags: - setup-all - setup-mx-puppet-steam diff --git a/roles/matrix-bridge-mx-puppet-steam/tasks/setup_install.yml b/roles/matrix-bridge-mx-puppet-steam/tasks/setup_install.yml index dfb7c6c9..87c2a424 100644 --- a/roles/matrix-bridge-mx-puppet-steam/tasks/setup_install.yml +++ b/roles/matrix-bridge-mx-puppet-steam/tasks/setup_install.yml @@ -6,7 +6,7 @@ ansible.builtin.fail: msg: >- The matrix-bridge-mx-puppet-steam role needs to execute before the matrix-synapse role. - when: "matrix_synapse_role_executed|default(False)" + when: "matrix_synapse_role_executed | default(False)" - name: Ensure MX Puppet Steam paths exist ansible.builtin.file: @@ -20,10 +20,10 @@ - {path: "{{ matrix_mx_puppet_steam_config_path }}", when: true} - {path: "{{ matrix_mx_puppet_steam_data_path }}", when: true} - {path: "{{ matrix_mx_puppet_steam_docker_src_files_path }}", when: "{{ matrix_mx_puppet_steam_container_image_self_build }}"} - when: matrix_mx_puppet_steam_enabled|bool and item.when|bool + when: matrix_mx_puppet_steam_enabled | bool and item.when | bool - name: Check if an old database file already exists - stat: + ansible.builtin.stat: path: "{{ matrix_mx_puppet_steam_base_path }}/database.db" register: matrix_mx_puppet_steam_stat_database @@ -45,7 +45,7 @@ - block: - name: Check if an SQLite database already exists - stat: + ansible.builtin.stat: path: "{{ matrix_mx_puppet_steam_sqlite_database_path_local }}" register: matrix_mx_puppet_steam_sqlite_database_path_local_stat_result @@ -54,16 +54,16 @@ matrix_postgres_db_migration_request: src: "{{ matrix_mx_puppet_steam_sqlite_database_path_local }}" dst: "{{ matrix_mx_puppet_steam_database_connection_string }}" - caller: "{{ role_path|basename }}" + caller: "{{ role_path | basename }}" engine_variable_name: 'matrix_mx_puppet_steam_database_engine' engine_old: 'sqlite' systemd_services_to_stop: ['matrix-mx-puppet-steam.service'] - - 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_mx_puppet_steam_requires_restart: true - when: "matrix_mx_puppet_steam_sqlite_database_path_local_stat_result.stat.exists|bool" + when: "matrix_mx_puppet_steam_sqlite_database_path_local_stat_result.stat.exists | bool" when: "matrix_mx_puppet_steam_database_engine == 'postgres'" - name: Ensure MX Puppet Steam image is pulled @@ -72,7 +72,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_mx_puppet_steam_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_mx_puppet_steam_docker_image_force_pull }}" - when: matrix_mx_puppet_steam_enabled|bool and not matrix_mx_puppet_steam_container_image_self_build + when: matrix_mx_puppet_steam_enabled | bool and not matrix_mx_puppet_steam_container_image_self_build register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -86,7 +86,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_mx_puppet_steam_git_pull_results - when: "matrix_mx_puppet_steam_enabled|bool and matrix_mx_puppet_steam_container_image_self_build" + when: "matrix_mx_puppet_steam_enabled | bool and matrix_mx_puppet_steam_container_image_self_build" - name: Ensure MX Puppet Steam Docker image is built docker_image: @@ -98,11 +98,11 @@ dockerfile: Dockerfile path: "{{ matrix_mx_puppet_steam_docker_src_files_path }}" pull: true - when: "matrix_mx_puppet_steam_enabled|bool and matrix_mx_puppet_steam_container_image_self_build" + when: "matrix_mx_puppet_steam_enabled | bool and matrix_mx_puppet_steam_container_image_self_build" - name: Ensure mx-puppet-steam config.yaml installed ansible.builtin.copy: - content: "{{ matrix_mx_puppet_steam_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_mx_puppet_steam_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mx_puppet_steam_config_path }}/config.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -110,7 +110,7 @@ - name: Ensure mx-puppet-steam steam-registration.yaml installed ansible.builtin.copy: - content: "{{ matrix_mx_puppet_steam_registration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_mx_puppet_steam_registration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mx_puppet_steam_config_path }}/registration.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -132,4 +132,4 @@ ansible.builtin.service: name: "matrix-mx-puppet-steam.service" state: restarted - when: "matrix_mx_puppet_steam_requires_restart|bool" + when: "matrix_mx_puppet_steam_requires_restart | bool" diff --git a/roles/matrix-bridge-mx-puppet-steam/tasks/setup_uninstall.yml b/roles/matrix-bridge-mx-puppet-steam/tasks/setup_uninstall.yml index 7ec8245d..d88e5472 100644 --- a/roles/matrix-bridge-mx-puppet-steam/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-mx-puppet-steam/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-mx-puppet-steam service - stat: + ansible.builtin.stat: path: "/etc/systemd/system/matrix-mx-puppet-steam.service" register: matrix_mx_puppet_steam_service_stat diff --git a/roles/matrix-bridge-mx-puppet-twitter/defaults/main.yml b/roles/matrix-bridge-mx-puppet-twitter/defaults/main.yml index c1b46071..bcd6b4ff 100644 --- a/roles/matrix-bridge-mx-puppet-twitter/defaults/main.yml +++ b/roles/matrix-bridge-mx-puppet-twitter/defaults/main.yml @@ -93,11 +93,11 @@ matrix_mx_puppet_twitter_configuration_extension_yaml: | # If you need something more special, you can take full control by # completely redefining `matrix_mx_puppet_twitter_configuration_yaml`. -matrix_mx_puppet_twitter_configuration_extension: "{{ matrix_mx_puppet_twitter_configuration_extension_yaml|from_yaml if matrix_mx_puppet_twitter_configuration_extension_yaml|from_yaml is mapping else {} }}" +matrix_mx_puppet_twitter_configuration_extension: "{{ matrix_mx_puppet_twitter_configuration_extension_yaml | from_yaml if matrix_mx_puppet_twitter_configuration_extension_yaml | from_yaml is mapping else {} }}" # Holds the final configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_mx_puppet_twitter_configuration_yaml`. -matrix_mx_puppet_twitter_configuration: "{{ matrix_mx_puppet_twitter_configuration_yaml|from_yaml|combine(matrix_mx_puppet_twitter_configuration_extension, recursive=True) }}" +matrix_mx_puppet_twitter_configuration: "{{ matrix_mx_puppet_twitter_configuration_yaml | from_yaml|combine(matrix_mx_puppet_twitter_configuration_extension, recursive=True) }}" # The prefix for user IDs and aliases matrix_mx_puppet_twitter_namespace_prefix: _twitterpuppet_ @@ -121,4 +121,4 @@ matrix_mx_puppet_twitter_registration_yaml: | url: {{ matrix_mx_puppet_twitter_appservice_address }} de.sorunome.msc2409.push_ephemeral: true -matrix_mx_puppet_twitter_registration: "{{ matrix_mx_puppet_twitter_registration_yaml|from_yaml }}" +matrix_mx_puppet_twitter_registration: "{{ matrix_mx_puppet_twitter_registration_yaml | from_yaml }}" diff --git a/roles/matrix-bridge-mx-puppet-twitter/tasks/init.yml b/roles/matrix-bridge-mx-puppet-twitter/tasks/init.yml index 53e2f2f5..3667ebc7 100644 --- a/roles/matrix-bridge-mx-puppet-twitter/tasks/init.yml +++ b/roles/matrix-bridge-mx-puppet-twitter/tasks/init.yml @@ -8,24 +8,24 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mx-puppet-twitter.service'] }}" - when: matrix_mx_puppet_twitter_enabled|bool + when: matrix_mx_puppet_twitter_enabled | bool # If the matrix-synapse role is not used, these variables may not exist. - ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ - matrix_synapse_container_extra_arguments|default([]) + matrix_synapse_container_extra_arguments | default([]) + ["--mount type=bind,src={{ matrix_mx_puppet_twitter_config_path }}/registration.yaml,dst=/matrix-mx-puppet-twitter-registration.yaml,ro"] }} matrix_synapse_app_service_config_files: > {{ - matrix_synapse_app_service_config_files|default([]) + matrix_synapse_app_service_config_files | default([]) + ["/matrix-mx-puppet-twitter-registration.yaml"] }} - when: matrix_mx_puppet_twitter_enabled|bool + when: matrix_mx_puppet_twitter_enabled | bool - block: - name: Fail if matrix-nginx-proxy role already executed @@ -35,13 +35,13 @@ but it's pointless since the matrix-nginx-proxy role had already executed. To fix this, please change the order of roles in your playbook, so that the matrix-nginx-proxy role would run after the matrix-mx-puppet-twitter role. - when: matrix_nginx_proxy_role_executed|default(False)|bool + when: matrix_nginx_proxy_role_executed | default(False) | bool - name: Generate Matrix MX Puppet Twitter proxying configuration for matrix-nginx-proxy ansible.builtin.set_fact: matrix_mx_puppet_twitter_matrix_nginx_proxy_configuration: | location {{ matrix_mx_puppet_twitter_webhook_path }} { - {% if matrix_nginx_proxy_enabled|default(False) %} + {% if matrix_nginx_proxy_enabled | default(False) %} {# Use the embedded DNS resolver in Docker containers to discover the service #} resolver 127.0.0.11 valid=5s; set $backend "{{ matrix_mx_puppet_twitter_appservice_address }}"; @@ -56,13 +56,13 @@ ansible.builtin.set_fact: matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: | {{ - matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([]) + matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks | default([]) + [matrix_mx_puppet_twitter_matrix_nginx_proxy_configuration] }} tags: - always - when: matrix_mx_puppet_twitter_enabled|bool + when: matrix_mx_puppet_twitter_enabled | bool - name: Warn about reverse-proxying if matrix-nginx-proxy not used ansible.builtin.debug: @@ -72,4 +72,4 @@ Please make sure that you're proxying the `{{ matrix_mx_puppet_twitter_redirect_path }}` URL endpoint to the matrix-mx-puppet-twitter container. You can expose the container's port using the `matrix_mx_puppet_twitter_container_http_host_bind_port` variable. - when: "matrix_mx_puppet_twitter_enabled|bool and not matrix_nginx_proxy_enabled|default(False)|bool" + when: "matrix_mx_puppet_twitter_enabled | bool and not matrix_nginx_proxy_enabled | default(False) | bool" diff --git a/roles/matrix-bridge-mx-puppet-twitter/tasks/main.yml b/roles/matrix-bridge-mx-puppet-twitter/tasks/main.yml index 7d65257c..20e4f686 100644 --- a/roles/matrix-bridge-mx-puppet-twitter/tasks/main.yml +++ b/roles/matrix-bridge-mx-puppet-twitter/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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_mx_puppet_twitter_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_mx_puppet_twitter_enabled | bool" tags: - setup-all - setup-mx-puppet-twitter -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_mx_puppet_twitter_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_mx_puppet_twitter_enabled | bool" tags: - setup-all - setup-mx-puppet-twitter -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_mx_puppet_twitter_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_mx_puppet_twitter_enabled | bool" tags: - setup-all - setup-mx-puppet-twitter diff --git a/roles/matrix-bridge-mx-puppet-twitter/tasks/setup_install.yml b/roles/matrix-bridge-mx-puppet-twitter/tasks/setup_install.yml index 34d522f5..23d4a3a6 100644 --- a/roles/matrix-bridge-mx-puppet-twitter/tasks/setup_install.yml +++ b/roles/matrix-bridge-mx-puppet-twitter/tasks/setup_install.yml @@ -6,7 +6,7 @@ ansible.builtin.fail: msg: >- The matrix-bridge-mx-puppet-twitter role needs to execute before the matrix-synapse role. - when: "matrix_synapse_role_executed|default(False)" + when: "matrix_synapse_role_executed | default(False)" - name: Ensure MX Puppet Twitter paths exist ansible.builtin.file: @@ -20,10 +20,10 @@ - {path: "{{ matrix_mx_puppet_twitter_config_path }}", when: true} - {path: "{{ matrix_mx_puppet_twitter_data_path }}", when: true} - {path: "{{ matrix_mx_puppet_twitter_docker_src_files_path }}", when: "{{ matrix_mx_puppet_twitter_container_image_self_build }}"} - when: matrix_mx_puppet_twitter_enabled|bool and item.when|bool + when: matrix_mx_puppet_twitter_enabled | bool and item.when | bool - name: Check if an old database file already exists - stat: + ansible.builtin.stat: path: "{{ matrix_mx_puppet_twitter_base_path }}/database.db" register: matrix_mx_puppet_twitter_stat_database @@ -45,7 +45,7 @@ - block: - name: Check if an SQLite database already exists - stat: + ansible.builtin.stat: path: "{{ matrix_mx_puppet_twitter_sqlite_database_path_local }}" register: matrix_mx_puppet_twitter_sqlite_database_path_local_stat_result @@ -54,16 +54,16 @@ matrix_postgres_db_migration_request: src: "{{ matrix_mx_puppet_twitter_sqlite_database_path_local }}" dst: "{{ matrix_mx_puppet_twitter_database_connection_string }}" - caller: "{{ role_path|basename }}" + caller: "{{ role_path | basename }}" engine_variable_name: 'matrix_mx_puppet_twitter_database_engine' engine_old: 'sqlite' systemd_services_to_stop: ['matrix-mx-puppet-twitter.service'] - - 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_mx_puppet_twitter_requires_restart: true - when: "matrix_mx_puppet_twitter_sqlite_database_path_local_stat_result.stat.exists|bool" + when: "matrix_mx_puppet_twitter_sqlite_database_path_local_stat_result.stat.exists | bool" when: "matrix_mx_puppet_twitter_database_engine == 'postgres'" - name: Ensure MX Puppet Twitter image is pulled @@ -72,7 +72,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_mx_puppet_twitter_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_mx_puppet_twitter_docker_image_force_pull }}" - when: matrix_mx_puppet_twitter_enabled|bool and not matrix_mx_puppet_twitter_container_image_self_build + when: matrix_mx_puppet_twitter_enabled | bool and not matrix_mx_puppet_twitter_container_image_self_build register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -86,7 +86,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_mx_puppet_twitter_git_pull_results - when: "matrix_mx_puppet_twitter_enabled|bool and matrix_mx_puppet_twitter_container_image_self_build" + when: "matrix_mx_puppet_twitter_enabled | bool and matrix_mx_puppet_twitter_container_image_self_build" - name: Ensure MX Puppet Twitter Docker image is built docker_image: @@ -98,11 +98,11 @@ dockerfile: Dockerfile path: "{{ matrix_mx_puppet_twitter_docker_src_files_path }}" pull: true - when: "matrix_mx_puppet_twitter_enabled|bool and matrix_mx_puppet_twitter_container_image_self_build" + when: "matrix_mx_puppet_twitter_enabled | bool and matrix_mx_puppet_twitter_container_image_self_build" - name: Ensure mx-puppet-twitter config.yaml installed ansible.builtin.copy: - content: "{{ matrix_mx_puppet_twitter_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_mx_puppet_twitter_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mx_puppet_twitter_config_path }}/config.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -110,7 +110,7 @@ - name: Ensure mx-puppet-twitter twitter-registration.yaml installed ansible.builtin.copy: - content: "{{ matrix_mx_puppet_twitter_registration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_mx_puppet_twitter_registration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mx_puppet_twitter_config_path }}/registration.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -132,4 +132,4 @@ ansible.builtin.service: name: "matrix-mx-puppet-twitter.service" state: restarted - when: "matrix_mx_puppet_twitter_requires_restart|bool" + when: "matrix_mx_puppet_twitter_requires_restart | bool" diff --git a/roles/matrix-bridge-mx-puppet-twitter/tasks/setup_uninstall.yml b/roles/matrix-bridge-mx-puppet-twitter/tasks/setup_uninstall.yml index 2718634d..6db13de0 100644 --- a/roles/matrix-bridge-mx-puppet-twitter/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-mx-puppet-twitter/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-mx-puppet-twitter service - stat: + ansible.builtin.stat: path: "/etc/systemd/system/matrix-mx-puppet-twitter.service" register: matrix_mx_puppet_twitter_service_stat diff --git a/roles/matrix-bridge-sms/defaults/main.yml b/roles/matrix-bridge-sms/defaults/main.yml index 8a640f86..28a88e31 100644 --- a/roles/matrix-bridge-sms/defaults/main.yml +++ b/roles/matrix-bridge-sms/defaults/main.yml @@ -104,9 +104,9 @@ matrix_sms_bridge_configuration_extension_yaml: | # If you need something more special, you can take full control by # completely redefining `matrix_sms_bridge_configuration_yaml`. -matrix_sms_bridge_configuration_extension: "{{ matrix_sms_bridge_configuration_extension_yaml|from_yaml if matrix_sms_bridge_configuration_extension_yaml|from_yaml is mapping else {} }}" +matrix_sms_bridge_configuration_extension: "{{ matrix_sms_bridge_configuration_extension_yaml | from_yaml if matrix_sms_bridge_configuration_extension_yaml | from_yaml is mapping else {} }}" -matrix_sms_bridge_configuration: "{{ matrix_sms_bridge_configuration_yaml|from_yaml|combine(matrix_sms_bridge_configuration_extension, recursive=True) }}" +matrix_sms_bridge_configuration: "{{ matrix_sms_bridge_configuration_yaml | from_yaml|combine(matrix_sms_bridge_configuration_extension, recursive=True) }}" matrix_sms_bridge_registration_yaml: | id: sms @@ -123,4 +123,4 @@ matrix_sms_bridge_registration_yaml: | sender_localpart: smsbot rate_limited: false -matrix_sms_bridge_registration: "{{ matrix_sms_bridge_registration_yaml|from_yaml }}" +matrix_sms_bridge_registration: "{{ matrix_sms_bridge_registration_yaml | from_yaml }}" diff --git a/roles/matrix-bridge-sms/tasks/init.yml b/roles/matrix-bridge-sms/tasks/init.yml index 4a3d1719..85684b81 100644 --- a/roles/matrix-bridge-sms/tasks/init.yml +++ b/roles/matrix-bridge-sms/tasks/init.yml @@ -6,25 +6,25 @@ ansible.builtin.fail: msg: >- The matrix-sms-bridge role needs to execute before the matrix-synapse role. - when: "matrix_sms_bridge_enabled and matrix_synapse_role_executed|default(False)" + when: "matrix_sms_bridge_enabled and matrix_synapse_role_executed | default(False)" - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-sms-bridge.service'] }}" - when: matrix_sms_bridge_enabled|bool + when: matrix_sms_bridge_enabled | bool # If the matrix-synapse role is not used, these variables may not exist. - ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ - matrix_synapse_container_extra_arguments|default([]) + matrix_synapse_container_extra_arguments | default([]) + ["--mount type=bind,src={{ matrix_sms_bridge_config_path }}/registration.yaml,dst=/matrix-sms-bridge-registration.yaml,ro"] }} matrix_synapse_app_service_config_files: > {{ - matrix_synapse_app_service_config_files|default([]) + matrix_synapse_app_service_config_files | default([]) + ["/matrix-sms-bridge-registration.yaml"] }} - when: matrix_sms_bridge_enabled|bool + when: matrix_sms_bridge_enabled | bool diff --git a/roles/matrix-bridge-sms/tasks/main.yml b/roles/matrix-bridge-sms/tasks/main.yml index b06e1a54..1a6b964b 100644 --- a/roles/matrix-bridge-sms/tasks/main.yml +++ b/roles/matrix-bridge-sms/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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_sms_bridge_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_sms_bridge_enabled | bool" tags: - setup-all - setup-matrix-sms-bridge -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_sms_bridge_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_sms_bridge_enabled | bool" tags: - setup-all - setup-matrix-sms-bridge -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_sms_bridge_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_sms_bridge_enabled | bool" tags: - setup-all - setup-matrix-sms-bridge diff --git a/roles/matrix-bridge-sms/tasks/setup_install.yml b/roles/matrix-bridge-sms/tasks/setup_install.yml index ad6a9185..dcc317ba 100644 --- a/roles/matrix-bridge-sms/tasks/setup_install.yml +++ b/roles/matrix-bridge-sms/tasks/setup_install.yml @@ -23,7 +23,7 @@ - name: Ensure matrix-sms-bridge application.yml installed ansible.builtin.copy: - content: "{{ matrix_sms_bridge_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_sms_bridge_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_sms_bridge_config_path }}/application.yml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -31,7 +31,7 @@ - name: Ensure matrix-sms-bridge registration.yaml installed ansible.builtin.copy: - content: "{{ matrix_sms_bridge_registration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_sms_bridge_registration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_sms_bridge_config_path }}/registration.yaml" mode: 0644 owner: "{{ matrix_user_username }}" diff --git a/roles/matrix-bridge-sms/tasks/setup_uninstall.yml b/roles/matrix-bridge-sms/tasks/setup_uninstall.yml index f0f966b2..322190f9 100644 --- a/roles/matrix-bridge-sms/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-sms/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-sms-bridge service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-sms-bridge.service" register: matrix_sms_bridge_service_stat diff --git a/roles/matrix-client-cinny/tasks/init.yml b/roles/matrix-client-cinny/tasks/init.yml index 4d1190dc..00e46dc8 100644 --- a/roles/matrix-client-cinny/tasks/init.yml +++ b/roles/matrix-client-cinny/tasks/init.yml @@ -8,4 +8,4 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-client-cinny.service'] }}" - when: matrix_client_cinny_enabled|bool + when: matrix_client_cinny_enabled | bool diff --git a/roles/matrix-client-cinny/tasks/main.yml b/roles/matrix-client-cinny/tasks/main.yml index 5c37d38e..9eb00781 100644 --- a/roles/matrix-client-cinny/tasks/main.yml +++ b/roles/matrix-client-cinny/tasks/main.yml @@ -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_client_cinny_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_client_cinny_enabled | bool" tags: - setup-all - setup-client-cinny -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_client_cinny_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_client_cinny_enabled | bool" tags: - setup-all - setup-client-cinny -- import_tasks: "{{ role_path }}/tasks/self_check.yml" +- 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_cinny_enabled|bool" + when: "run_self_check | bool and matrix_client_cinny_enabled | bool" tags: - self-check -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_client_cinny_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_client_cinny_enabled | bool" tags: - setup-all - setup-client-cinny diff --git a/roles/matrix-client-cinny/tasks/setup_install.yml b/roles/matrix-client-cinny/tasks/setup_install.yml index 3689586f..0159ea35 100644 --- a/roles/matrix-client-cinny/tasks/setup_install.yml +++ b/roles/matrix-client-cinny/tasks/setup_install.yml @@ -9,7 +9,7 @@ with_items: - {path: "{{ matrix_client_cinny_data_path }}", when: true} - {path: "{{ matrix_client_cinny_docker_src_files_path }}", when: "{{ matrix_client_cinny_container_image_self_build }}"} - when: "item.when|bool" + when: "item.when | bool" - name: Ensure Cinny Docker image is pulled docker_image: @@ -17,7 +17,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_client_cinny_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_client_cinny_docker_image_force_pull }}" - when: "not matrix_client_cinny_container_image_self_build|bool" + when: "not matrix_client_cinny_container_image_self_build | bool" register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -32,7 +32,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_client_cinny_git_pull_results - when: "matrix_client_cinny_container_image_self_build|bool" + when: "matrix_client_cinny_container_image_self_build | bool" - name: Ensure Cinny configuration installed ansible.builtin.copy: @@ -62,7 +62,7 @@ dockerfile: Dockerfile path: "{{ matrix_client_cinny_docker_src_files_path }}" pull: true - when: "matrix_client_cinny_container_image_self_build|bool" + when: "matrix_client_cinny_container_image_self_build | bool" - name: Ensure matrix-client-cinny.service installed ansible.builtin.template: @@ -74,4 +74,4 @@ - name: Ensure systemd reloaded after matrix-client-cinny.service installation ansible.builtin.service: daemon_reload: true - when: "matrix_client_cinny_systemd_service_result.changed|bool" + when: "matrix_client_cinny_systemd_service_result.changed | bool" diff --git a/roles/matrix-client-cinny/tasks/setup_uninstall.yml b/roles/matrix-client-cinny/tasks/setup_uninstall.yml index 866308dd..e6f71b0b 100644 --- a/roles/matrix-client-cinny/tasks/setup_uninstall.yml +++ b/roles/matrix-client-cinny/tasks/setup_uninstall.yml @@ -1,6 +1,6 @@ --- - name: Check existence of matrix-client-cinny.service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-client-cinny.service" register: matrix_client_cinny_service_stat @@ -11,18 +11,18 @@ enabled: false daemon_reload: true register: stopping_result - when: "matrix_client_cinny_service_stat.stat.exists|bool" + when: "matrix_client_cinny_service_stat.stat.exists | bool" - name: Ensure matrix-client-cinny.service doesn't exist ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-client-cinny.service" state: absent - when: "matrix_client_cinny_service_stat.stat.exists|bool" + when: "matrix_client_cinny_service_stat.stat.exists | bool" - name: Ensure systemd reloaded after matrix-client-cinny.service removal ansible.builtin.service: daemon_reload: true - when: "matrix_client_cinny_service_stat.stat.exists|bool" + when: "matrix_client_cinny_service_stat.stat.exists | bool" - name: Ensure Cinny paths doesn't exist ansible.builtin.file: diff --git a/roles/matrix-client-element/tasks/init.yml b/roles/matrix-client-element/tasks/init.yml index 65edf53a..7bdad9e1 100644 --- a/roles/matrix-client-element/tasks/init.yml +++ b/roles/matrix-client-element/tasks/init.yml @@ -2,7 +2,7 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-client-element.service'] }}" - when: matrix_client_element_enabled|bool + when: matrix_client_element_enabled | bool # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 diff --git a/roles/matrix-client-element/tasks/main.yml b/roles/matrix-client-element/tasks/main.yml index 28e23e8a..53a25afb 100644 --- a/roles/matrix-client-element/tasks/main.yml +++ b/roles/matrix-client-element/tasks/main.yml @@ -1,42 +1,42 @@ --- -- 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_client_element_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_client_element_enabled | bool" tags: - setup-all - setup-client-element -- import_tasks: "{{ role_path }}/tasks/prepare_themes.yml" - when: run_setup|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/prepare_themes.yml" + when: run_setup | bool tags: - setup-all - setup-client-element -- import_tasks: "{{ role_path }}/tasks/migrate_riot_web.yml" - when: run_setup|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/migrate_riot_web.yml" + when: run_setup | bool tags: - setup-all - setup-client-element -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_client_element_enabled|bool" +- 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 -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_client_element_enabled|bool" +- 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 -- import_tasks: "{{ role_path }}/tasks/self_check.yml" +- 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" + when: "run_self_check | bool and matrix_client_element_enabled | bool" tags: - self-check diff --git a/roles/matrix-client-element/tasks/migrate_riot_web.yml b/roles/matrix-client-element/tasks/migrate_riot_web.yml index b570d892..23011e93 100644 --- a/roles/matrix-client-element/tasks/migrate_riot_web.yml +++ b/roles/matrix-client-element/tasks/migrate_riot_web.yml @@ -1,10 +1,10 @@ --- - name: Check existence of matrix-riot-web.service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-riot-web.service" register: matrix_client_riot_web_service_stat - when: "matrix_client_element_enabled|bool" + when: "matrix_client_element_enabled | bool" - name: Ensure matrix-riot-web is stopped ansible.builtin.service: @@ -13,25 +13,25 @@ enabled: false daemon_reload: true register: stopping_result - when: "matrix_client_element_enabled|bool and matrix_client_riot_web_service_stat.stat.exists" + 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: "{{ matrix_systemd_path }}/matrix-riot-web.service" state: absent - when: "matrix_client_element_enabled|bool and matrix_client_riot_web_service_stat.stat.exists" + 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" + when: "matrix_client_element_enabled | bool and matrix_client_riot_web_service_stat.stat.exists" - name: Check existence of /matrix/riot-web - stat: + ansible.builtin.stat: path: "/matrix/riot-web" register: matrix_client_riot_web_dir_stat - when: "matrix_client_element_enabled|bool" + 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" + when: "matrix_client_element_enabled | bool and matrix_client_riot_web_dir_stat.stat.exists" diff --git a/roles/matrix-client-element/tasks/prepare_themes.yml b/roles/matrix-client-element/tasks/prepare_themes.yml index 7d5c1019..4ba38943 100644 --- a/roles/matrix-client-element/tasks/prepare_themes.yml +++ b/roles/matrix-client-element/tasks/prepare_themes.yml @@ -11,7 +11,7 @@ dest: "{{ role_path }}/files/scratchpad/themes" - name: Find all Element theme files - find: + ansible.builtin.find: paths: "{{ role_path }}/files/scratchpad/themes" patterns: "*.json" recurse: true @@ -31,7 +31,7 @@ run_once: true delegate_to: 127.0.0.1 become: false - when: matrix_client_element_themes_enabled|bool + when: matrix_client_element_themes_enabled | bool # @@ -45,4 +45,4 @@ run_once: true delegate_to: 127.0.0.1 become: false - when: "not matrix_client_element_themes_enabled|bool" + when: "not matrix_client_element_themes_enabled | bool" diff --git a/roles/matrix-client-element/tasks/setup_install.yml b/roles/matrix-client-element/tasks/setup_install.yml index 6a4fe3f3..356d5342 100644 --- a/roles/matrix-client-element/tasks/setup_install.yml +++ b/roles/matrix-client-element/tasks/setup_install.yml @@ -10,7 +10,7 @@ with_items: - {path: "{{ matrix_client_element_data_path }}", when: true} - {path: "{{ matrix_client_element_docker_src_files_path }}", when: "{{ matrix_client_element_container_image_self_build }}"} - when: "item.when|bool" + when: "item.when | bool" - name: Ensure Element Docker image is pulled docker_image: @@ -18,7 +18,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_client_element_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_client_element_docker_image_force_pull }}" - when: "not matrix_client_element_container_image_self_build|bool" + when: "not matrix_client_element_container_image_self_build | bool" register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -33,7 +33,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_client_element_git_pull_results - when: "matrix_client_element_container_image_self_build|bool" + when: "matrix_client_element_container_image_self_build | bool" # See: # - https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1357 @@ -47,7 +47,7 @@ owner: root ansible.builtin.group: root mode: '0644' - when: "matrix_client_element_container_image_self_build|bool and matrix_client_element_container_image_self_build_low_memory_system_patch_enabled|bool" + when: "matrix_client_element_container_image_self_build | bool and matrix_client_element_container_image_self_build_low_memory_system_patch_enabled | bool" - name: Ensure Element Docker image is built docker_image: @@ -59,7 +59,7 @@ dockerfile: Dockerfile path: "{{ matrix_client_element_docker_src_files_path }}" pull: true - when: "matrix_client_element_container_image_self_build|bool" + when: "matrix_client_element_container_image_self_build | bool" - name: Ensure Element configuration installed ansible.builtin.copy: @@ -100,4 +100,4 @@ - name: Ensure systemd reloaded after matrix-client-element.service installation ansible.builtin.service: daemon_reload: true - when: "matrix_client_element_systemd_service_result.changed|bool" + when: "matrix_client_element_systemd_service_result.changed | bool" diff --git a/roles/matrix-client-element/tasks/setup_uninstall.yml b/roles/matrix-client-element/tasks/setup_uninstall.yml index 83b4a795..b3cdd05e 100644 --- a/roles/matrix-client-element/tasks/setup_uninstall.yml +++ b/roles/matrix-client-element/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-client-element.service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-client-element.service" register: matrix_client_element_service_stat @@ -12,18 +12,18 @@ enabled: false daemon_reload: true register: stopping_result - when: "matrix_client_element_service_stat.stat.exists|bool" + when: "matrix_client_element_service_stat.stat.exists | bool" - name: Ensure matrix-client-element.service doesn't exist ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-client-element.service" state: absent - when: "matrix_client_element_service_stat.stat.exists|bool" + when: "matrix_client_element_service_stat.stat.exists | bool" - name: Ensure systemd reloaded after matrix-client-element.service removal ansible.builtin.service: daemon_reload: true - when: "matrix_client_element_service_stat.stat.exists|bool" + when: "matrix_client_element_service_stat.stat.exists | bool" - name: Ensure Element paths doesn't exist ansible.builtin.file: diff --git a/roles/matrix-client-hydrogen/tasks/init.yml b/roles/matrix-client-hydrogen/tasks/init.yml index 70454d92..561018e1 100644 --- a/roles/matrix-client-hydrogen/tasks/init.yml +++ b/roles/matrix-client-hydrogen/tasks/init.yml @@ -8,4 +8,4 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-client-hydrogen.service'] }}" - when: matrix_client_hydrogen_enabled|bool + when: matrix_client_hydrogen_enabled | bool diff --git a/roles/matrix-client-hydrogen/tasks/main.yml b/roles/matrix-client-hydrogen/tasks/main.yml index d027fe66..89133364 100644 --- a/roles/matrix-client-hydrogen/tasks/main.yml +++ b/roles/matrix-client-hydrogen/tasks/main.yml @@ -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_client_hydrogen_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_client_hydrogen_enabled | bool" tags: - setup-all - setup-client-hydrogen -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_client_hydrogen_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_client_hydrogen_enabled | bool" tags: - setup-all - setup-client-hydrogen -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_client_hydrogen_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_client_hydrogen_enabled | bool" tags: - setup-all - setup-client-hydrogen -- import_tasks: "{{ role_path }}/tasks/self_check.yml" +- 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_hydrogen_enabled|bool" + when: "run_self_check | bool and matrix_client_hydrogen_enabled | bool" tags: - self-check diff --git a/roles/matrix-client-hydrogen/tasks/setup_install.yml b/roles/matrix-client-hydrogen/tasks/setup_install.yml index b7a63fb7..37877b87 100644 --- a/roles/matrix-client-hydrogen/tasks/setup_install.yml +++ b/roles/matrix-client-hydrogen/tasks/setup_install.yml @@ -10,7 +10,7 @@ with_items: - {path: "{{ matrix_client_hydrogen_data_path }}", when: true} - {path: "{{ matrix_client_hydrogen_docker_src_files_path }}", when: "{{ matrix_client_hydrogen_container_image_self_build }}"} - when: "item.when|bool" + when: "item.when | bool" - name: Ensure Hydrogen Docker image is pulled docker_image: @@ -18,7 +18,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_client_hydrogen_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_client_hydrogen_docker_image_force_pull }}" - when: "not matrix_client_hydrogen_container_image_self_build|bool" + when: "not matrix_client_hydrogen_container_image_self_build | bool" register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -33,7 +33,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_client_hydrogen_git_pull_results - when: "matrix_client_hydrogen_container_image_self_build|bool" + when: "matrix_client_hydrogen_container_image_self_build | bool" - name: Ensure Hydrogen configuration installed ansible.builtin.copy: @@ -42,7 +42,7 @@ mode: 0644 owner: "{{ matrix_user_username }}" group: "{{ matrix_user_groupname }}" - when: "matrix_client_hydrogen_container_image_self_build|bool" + when: "matrix_client_hydrogen_container_image_self_build | bool" - name: Ensure Hydrogen additional config files installed ansible.builtin.template: @@ -66,7 +66,7 @@ dockerfile: Dockerfile path: "{{ matrix_client_hydrogen_docker_src_files_path }}" pull: true - when: "matrix_client_hydrogen_container_image_self_build|bool" + when: "matrix_client_hydrogen_container_image_self_build | bool" - name: Ensure matrix-client-hydrogen.service installed ansible.builtin.template: @@ -78,4 +78,4 @@ - name: Ensure systemd reloaded after matrix-client-hydrogen.service installation ansible.builtin.service: daemon_reload: true - when: "matrix_client_hydrogen_systemd_service_result.changed|bool" + when: "matrix_client_hydrogen_systemd_service_result.changed | bool" diff --git a/roles/matrix-client-hydrogen/tasks/setup_uninstall.yml b/roles/matrix-client-hydrogen/tasks/setup_uninstall.yml index ac0c11c7..d543cbb3 100644 --- a/roles/matrix-client-hydrogen/tasks/setup_uninstall.yml +++ b/roles/matrix-client-hydrogen/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-client-hydrogen.service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-client-hydrogen.service" register: matrix_client_hydrogen_service_stat @@ -12,18 +12,18 @@ enabled: false daemon_reload: true register: stopping_result - when: "matrix_client_hydrogen_service_stat.stat.exists|bool" + when: "matrix_client_hydrogen_service_stat.stat.exists | bool" - name: Ensure matrix-client-hydrogen.service doesn't exist ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-client-hydrogen.service" state: absent - when: "matrix_client_hydrogen_service_stat.stat.exists|bool" + when: "matrix_client_hydrogen_service_stat.stat.exists | bool" - name: Ensure systemd reloaded after matrix-client-hydrogen.service removal ansible.builtin.service: daemon_reload: true - when: "matrix_client_hydrogen_service_stat.stat.exists|bool" + when: "matrix_client_hydrogen_service_stat.stat.exists | bool" - name: Ensure Hydrogen paths doesn't exist ansible.builtin.file: diff --git a/roles/matrix-client-hydrogen/tasks/validate_config.yml b/roles/matrix-client-hydrogen/tasks/validate_config.yml index 4188acba..65b0e14f 100644 --- a/roles/matrix-client-hydrogen/tasks/validate_config.yml +++ b/roles/matrix-client-hydrogen/tasks/validate_config.yml @@ -4,6 +4,6 @@ ansible.builtin.fail: msg: > You need to define a required configuration setting (`{{ item }}`) to use Hydrogen. - when: "(vars[item] == '' or vars[item] is none) and matrix_client_hydrogen_container_image_self_build|bool" + when: "(vars[item] == '' or vars[item] is none) and matrix_client_hydrogen_container_image_self_build | bool" with_items: - "matrix_client_hydrogen_default_hs_url" diff --git a/roles/matrix-common-after/tasks/main.yml b/roles/matrix-common-after/tasks/main.yml index f3ccf3a5..1b360698 100644 --- a/roles/matrix-common-after/tasks/main.yml +++ b/roles/matrix-common-after/tasks/main.yml @@ -1,19 +1,19 @@ --- -- import_tasks: "{{ role_path }}/tasks/start.yml" - when: run_start|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/start.yml" + when: run_start | bool tags: - start -- import_tasks: "{{ role_path }}/tasks/stop.yml" - when: run_stop|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/stop.yml" + when: run_stop | bool tags: - stop -- import_tasks: "{{ role_path }}/tasks/dump_runtime_results.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/dump_runtime_results.yml" tags: - always -- import_tasks: "{{ role_path }}/tasks/run_docker_prune.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/run_docker_prune.yml" tags: - run-docker-prune diff --git a/roles/matrix-common-after/tasks/start.yml b/roles/matrix-common-after/tasks/start.yml index 35126fc1..890eabfa 100644 --- a/roles/matrix-common-after/tasks/start.yml +++ b/roles/matrix-common-after/tasks/start.yml @@ -2,7 +2,7 @@ - name: Determine whether we should make services autostart ansible.builtin.set_fact: - matrix_services_autostart_enabled_bool: "{{ true if matrix_services_autostart_enabled|default('') == '' else matrix_services_autostart_enabled|bool }}" + matrix_services_autostart_enabled_bool: "{{ true if matrix_services_autostart_enabled | default('') == '' else matrix_services_autostart_enabled | bool }}" - name: Ensure systemd is reloaded ansible.builtin.service: @@ -29,14 +29,14 @@ # Waiting too long (30s) may not work for a similar reason, # as we may run into systemd's automatic restart logic retrying the service. - name: Wait a bit, so that services can start (or fail) - wait_for: + ansible.builtin.wait_for: timeout: "{{ matrix_common_after_systemd_service_start_wait_for_timeout_seconds }}" delegate_to: 127.0.0.1 become: false - block: - name: Populate service facts - service_facts: + ansible.builtin.service_facts: - name: Fail if service isn't detected to be running ansible.builtin.fail: diff --git a/roles/matrix-corporal/tasks/init.yml b/roles/matrix-corporal/tasks/init.yml index 08ef7c88..c6686a37 100644 --- a/roles/matrix-corporal/tasks/init.yml +++ b/roles/matrix-corporal/tasks/init.yml @@ -8,4 +8,4 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-corporal.service'] }}" - when: matrix_corporal_enabled|bool + when: matrix_corporal_enabled | bool diff --git a/roles/matrix-corporal/tasks/main.yml b/roles/matrix-corporal/tasks/main.yml index 7ff359d0..1699262b 100644 --- a/roles/matrix-corporal/tasks/main.yml +++ b/roles/matrix-corporal/tasks/main.yml @@ -1,24 +1,24 @@ --- -- 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_corporal_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_corporal_enabled | bool" tags: - setup-all - setup-corporal -- import_tasks: "{{ role_path }}/tasks/setup_corporal.yml" - when: run_setup|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_corporal.yml" + when: run_setup | bool tags: - setup-all - setup-corporal -- import_tasks: "{{ role_path }}/tasks/self_check_corporal.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/self_check_corporal.yml" delegate_to: 127.0.0.1 become: false - when: "run_self_check|bool and matrix_corporal_enabled|bool" + when: "run_self_check | bool and matrix_corporal_enabled | bool" tags: - self-check diff --git a/roles/matrix-corporal/tasks/setup_corporal.yml b/roles/matrix-corporal/tasks/setup_corporal.yml index 58039bf4..2f745502 100644 --- a/roles/matrix-corporal/tasks/setup_corporal.yml +++ b/roles/matrix-corporal/tasks/setup_corporal.yml @@ -15,7 +15,7 @@ - "{{ matrix_corporal_config_dir_path }}" - "{{ matrix_corporal_cache_dir_path }}" - "{{ matrix_corporal_var_dir_path }}" - when: matrix_corporal_enabled|bool + when: matrix_corporal_enabled | bool - name: Ensure Matrix Corporal repository is present on self-build ansible.builtin.git: @@ -26,7 +26,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_corporal_git_pull_results - when: "matrix_corporal_enabled|bool and matrix_corporal_container_image_self_build|bool" + when: "matrix_corporal_enabled | bool and matrix_corporal_container_image_self_build | bool" - name: Ensure Matrix Corporal Docker image is built docker_image: @@ -38,7 +38,7 @@ dockerfile: etc/docker/Dockerfile path: "{{ matrix_corporal_container_src_files_path }}" pull: true - when: "matrix_corporal_enabled|bool and matrix_corporal_container_image_self_build|bool" + when: "matrix_corporal_enabled | bool and matrix_corporal_container_image_self_build | bool" - name: Ensure Matrix Corporal Docker image is pulled docker_image: @@ -46,7 +46,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_corporal_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_corporal_docker_image_force_pull }}" - when: "matrix_corporal_enabled|bool and not matrix_corporal_container_image_self_build|bool" + when: "matrix_corporal_enabled | bool and not matrix_corporal_container_image_self_build | bool" register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -59,7 +59,7 @@ mode: 0644 owner: "{{ matrix_user_username }}" group: "{{ matrix_user_groupname }}" - when: matrix_corporal_enabled|bool + when: matrix_corporal_enabled | bool - name: Ensure matrix-corporal.service installed ansible.builtin.template: @@ -67,12 +67,12 @@ dest: "{{ matrix_systemd_path }}/matrix-corporal.service" mode: 0644 register: matrix_corporal_systemd_service_result - when: matrix_corporal_enabled|bool + when: matrix_corporal_enabled | bool - name: Ensure systemd reloaded after matrix-corporal.service installation ansible.builtin.service: daemon_reload: true - when: "matrix_corporal_enabled|bool and matrix_corporal_systemd_service_result.changed" + when: "matrix_corporal_enabled | bool and matrix_corporal_systemd_service_result.changed" # @@ -80,10 +80,10 @@ # - name: Check existence of matrix-corporal service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-corporal.service" register: matrix_corporal_service_stat - when: "not matrix_corporal_enabled|bool" + when: "not matrix_corporal_enabled | bool" - name: Ensure matrix-corporal is stopped ansible.builtin.service: @@ -92,18 +92,18 @@ enabled: false daemon_reload: true register: stopping_result - when: "not matrix_corporal_enabled|bool and matrix_corporal_service_stat.stat.exists" + when: "not matrix_corporal_enabled | bool and matrix_corporal_service_stat.stat.exists" - name: Ensure matrix-corporal.service doesn't exist ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-corporal.service" state: absent - when: "not matrix_corporal_enabled|bool and matrix_corporal_service_stat.stat.exists" + when: "not matrix_corporal_enabled | bool and matrix_corporal_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-corporal.service removal ansible.builtin.service: daemon_reload: true - when: "not matrix_corporal_enabled|bool and matrix_corporal_service_stat.stat.exists" + when: "not matrix_corporal_enabled | bool and matrix_corporal_service_stat.stat.exists" - name: Ensure matrix-corporal files don't exist ansible.builtin.file: @@ -112,10 +112,10 @@ with_items: - "{{ matrix_systemd_path }}/matrix-corporal.service" - "{{ matrix_corporal_config_dir_path }}/config.json" - when: "not matrix_corporal_enabled|bool" + when: "not matrix_corporal_enabled | bool" - name: Ensure Matrix Corporal Docker image doesn't exist docker_image: name: "{{ matrix_corporal_docker_image }}" state: absent - when: "not matrix_corporal_enabled|bool" + when: "not matrix_corporal_enabled | bool" diff --git a/roles/matrix-corporal/tasks/validate_config.yml b/roles/matrix-corporal/tasks/validate_config.yml index 50848810..26d16c6d 100644 --- a/roles/matrix-corporal/tasks/validate_config.yml +++ b/roles/matrix-corporal/tasks/validate_config.yml @@ -14,7 +14,7 @@ - name: Fail if HTTP API enabled, but no token set ansible.builtin.fail: msg: "The Matrix Corporal HTTP API is enabled (`matrix_corporal_http_api_enabled`), but no auth token has been set in `matrix_corporal_http_api_auth_token`" - when: "matrix_corporal_http_api_enabled|bool and matrix_corporal_http_api_auth_token == ''" + when: "matrix_corporal_http_api_enabled | bool and matrix_corporal_http_api_auth_token == ''" - name: (Deprecation) Catch and report renamed corporal variables ansible.builtin.fail: diff --git a/roles/matrix-coturn/tasks/init.yml b/roles/matrix-coturn/tasks/init.yml index 726e3065..60a77264 100644 --- a/roles/matrix-coturn/tasks/init.yml +++ b/roles/matrix-coturn/tasks/init.yml @@ -8,8 +8,8 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-coturn.service'] }}" - when: matrix_coturn_enabled|bool + when: matrix_coturn_enabled | bool - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-coturn-reload.timer'] }}" - when: "matrix_coturn_enabled|bool and matrix_coturn_tls_enabled|bool" + when: "matrix_coturn_enabled | bool and matrix_coturn_tls_enabled | bool" diff --git a/roles/matrix-coturn/tasks/main.yml b/roles/matrix-coturn/tasks/main.yml index 76352df1..78f712f0 100644 --- a/roles/matrix-coturn/tasks/main.yml +++ b/roles/matrix-coturn/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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_coturn_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_coturn_enabled | bool" tags: - setup-all - setup-coturn -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_coturn_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_coturn_enabled | bool" tags: - setup-all - setup-coturn -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_coturn_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_coturn_enabled | bool" tags: - setup-all - setup-coturn diff --git a/roles/matrix-coturn/tasks/setup_install.yml b/roles/matrix-coturn/tasks/setup_install.yml index d24e4313..2a1af731 100644 --- a/roles/matrix-coturn/tasks/setup_install.yml +++ b/roles/matrix-coturn/tasks/setup_install.yml @@ -15,7 +15,7 @@ group: "{{ matrix_user_groupname }}" with_items: - {path: "{{ matrix_coturn_docker_src_files_path }}", when: "{{ matrix_coturn_container_image_self_build }}"} - when: "item.when|bool" + when: "item.when | bool" - name: Ensure Coturn image is pulled docker_image: @@ -23,7 +23,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_coturn_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_coturn_docker_image_force_pull }}" - when: "not matrix_coturn_container_image_self_build|bool" + when: "not matrix_coturn_container_image_self_build | bool" register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -50,7 +50,7 @@ dockerfile: "{{ matrix_coturn_container_image_self_build_repo_dockerfile_path }}" path: "{{ matrix_coturn_docker_src_files_path }}" pull: true - when: "matrix_coturn_container_image_self_build|bool" + when: "matrix_coturn_container_image_self_build | bool" - name: Ensure Coturn configuration path exists ansible.builtin.file: @@ -89,7 +89,7 @@ dest: "{{ matrix_systemd_path }}/{{ item }}" mode: 0644 register: "matrix_coturn_systemd_service_change_results" - when: "matrix_coturn_tls_enabled|bool" + when: "matrix_coturn_tls_enabled | bool" with_items: - matrix-coturn-reload.service - matrix-coturn-reload.timer @@ -100,7 +100,7 @@ path: "{{ item }}" state: absent register: "matrix_coturn_systemd_service_change_results" - when: "not matrix_coturn_tls_enabled|bool" + when: "not matrix_coturn_tls_enabled | bool" with_items: - matrix-coturn-reload.service - matrix-coturn-reload.timer diff --git a/roles/matrix-coturn/tasks/setup_uninstall.yml b/roles/matrix-coturn/tasks/setup_uninstall.yml index b3d77e40..5dd2788e 100644 --- a/roles/matrix-coturn/tasks/setup_uninstall.yml +++ b/roles/matrix-coturn/tasks/setup_uninstall.yml @@ -1,10 +1,10 @@ --- - name: Check existence of matrix-coturn service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-coturn.service" register: matrix_coturn_service_stat - when: "not matrix_coturn_enabled|bool" + when: "not matrix_coturn_enabled | bool" - name: Ensure matrix-coturn is stopped ansible.builtin.service: @@ -12,7 +12,7 @@ state: stopped enabled: false daemon_reload: true - when: "matrix_coturn_service_stat.stat.exists|bool" + when: "matrix_coturn_service_stat.stat.exists | bool" - name: Ensure matrix-coturn-reload.timer is stopped ansible.builtin.service: @@ -21,7 +21,7 @@ enabled: false daemon_reload: true failed_when: false - when: "matrix_coturn_service_stat.stat.exists|bool" + when: "matrix_coturn_service_stat.stat.exists | bool" - name: Ensure systemd units don't exist ansible.builtin.file: @@ -36,7 +36,7 @@ - name: Ensure systemd reloaded after unit removal ansible.builtin.service: daemon_reload: true - when: "matrix_coturn_systemd_unit_uninstallation_result.changed|bool" + when: "matrix_coturn_systemd_unit_uninstallation_result.changed | bool" - name: Ensure Matrix coturn paths don't exist ansible.builtin.file: diff --git a/roles/matrix-dendrite/defaults/main.yml b/roles/matrix-dendrite/defaults/main.yml index 450ae632..d790fcc9 100644 --- a/roles/matrix-dendrite/defaults/main.yml +++ b/roles/matrix-dendrite/defaults/main.yml @@ -167,8 +167,8 @@ matrix_dendrite_configuration_extension_yaml: | # system_mxid_avatar_url: "mxc://server.com/oumMVlgDnLYFaPVkExemNVVZ" # room_name: "Server Notices" -matrix_dendrite_configuration_extension: "{{ matrix_dendrite_configuration_extension_yaml|from_yaml if matrix_dendrite_configuration_extension_yaml|from_yaml is mapping else {} }}" +matrix_dendrite_configuration_extension: "{{ matrix_dendrite_configuration_extension_yaml | from_yaml if matrix_dendrite_configuration_extension_yaml | from_yaml is mapping else {} }}" # Holds the final Dendrite configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_dendrite_configuration_yaml`. -matrix_dendrite_configuration: "{{ matrix_dendrite_configuration_yaml|from_yaml|combine(matrix_dendrite_configuration_extension, recursive=True) }}" +matrix_dendrite_configuration: "{{ matrix_dendrite_configuration_yaml | from_yaml|combine(matrix_dendrite_configuration_extension, recursive=True) }}" diff --git a/roles/matrix-dendrite/tasks/dendrite/setup.yml b/roles/matrix-dendrite/tasks/dendrite/setup.yml index f988d918..1a849729 100644 --- a/roles/matrix-dendrite/tasks/dendrite/setup.yml +++ b/roles/matrix-dendrite/tasks/dendrite/setup.yml @@ -1,7 +1,7 @@ --- -- import_tasks: "{{ role_path }}/tasks/dendrite/setup_install.yml" - when: matrix_dendrite_enabled|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/dendrite/setup_install.yml" + when: matrix_dendrite_enabled | bool -- import_tasks: "{{ role_path }}/tasks/dendrite/setup_uninstall.yml" - when: "not matrix_dendrite_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/dendrite/setup_uninstall.yml" + when: "not matrix_dendrite_enabled | bool" diff --git a/roles/matrix-dendrite/tasks/dendrite/setup_install.yml b/roles/matrix-dendrite/tasks/dendrite/setup_install.yml index 47cf5513..3052e101 100644 --- a/roles/matrix-dendrite/tasks/dendrite/setup_install.yml +++ b/roles/matrix-dendrite/tasks/dendrite/setup_install.yml @@ -1,7 +1,7 @@ --- # This will throw a Permission Denied error if already mounted using fuse - name: Check Dendrite media store path - stat: + ansible.builtin.stat: path: "{{ matrix_dendrite_media_store_path }}" register: local_path_media_store_stat ignore_errors: true @@ -29,7 +29,7 @@ until: result is not failed - name: Check if a Dendrite signing key exists - stat: + ansible.builtin.stat: path: "{{ matrix_dendrite_config_dir_path }}/{{ matrix_server_fqn_matrix }}.signing.pem" register: matrix_dendrite_signing_key_stat @@ -56,7 +56,7 @@ - name: Ensure Dendrite configuration installed ansible.builtin.copy: - content: "{{ matrix_dendrite_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_dendrite_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_dendrite_config_dir_path }}/dendrite.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -72,7 +72,7 @@ - name: Ensure systemd reloaded after matrix-dendrite.service installation ansible.builtin.service: daemon_reload: true - when: "matrix_dendrite_systemd_service_result.changed|bool" + when: "matrix_dendrite_systemd_service_result.changed | bool" - name: Ensure matrix-dendrite-create-account script created ansible.builtin.template: diff --git a/roles/matrix-dendrite/tasks/dendrite/setup_uninstall.yml b/roles/matrix-dendrite/tasks/dendrite/setup_uninstall.yml index 88122256..b6d8cfac 100644 --- a/roles/matrix-dendrite/tasks/dendrite/setup_uninstall.yml +++ b/roles/matrix-dendrite/tasks/dendrite/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-dendrite service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-dendrite.service" register: matrix_dendrite_service_stat diff --git a/roles/matrix-dendrite/tasks/init.yml b/roles/matrix-dendrite/tasks/init.yml index 20e34ef5..4ce641e9 100644 --- a/roles/matrix-dendrite/tasks/init.yml +++ b/roles/matrix-dendrite/tasks/init.yml @@ -2,4 +2,4 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-dendrite.service'] }}" - when: matrix_dendrite_enabled|bool + when: matrix_dendrite_enabled | bool diff --git a/roles/matrix-dendrite/tasks/main.yml b/roles/matrix-dendrite/tasks/main.yml index a08f45bd..d14beb15 100644 --- a/roles/matrix-dendrite/tasks/main.yml +++ b/roles/matrix-dendrite/tasks/main.yml @@ -1,37 +1,37 @@ --- -- 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 +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: run_setup | bool tags: - setup-all - setup-dendrite -- import_tasks: "{{ role_path }}/tasks/setup_dendrite.yml" - when: run_setup|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_dendrite.yml" + when: run_setup | bool tags: - setup-all - setup-dendrite -- import_tasks: "{{ role_path }}/tasks/register_user.yml" - when: run_dendrite_register_user|bool and matrix_dendrite_enabled|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/register_user.yml" + when: run_dendrite_register_user | bool and matrix_dendrite_enabled | bool tags: - register-user -- import_tasks: "{{ role_path }}/tasks/self_check_client_api.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/self_check_client_api.yml" delegate_to: 127.0.0.1 become: false - when: run_self_check|bool and matrix_dendrite_enabled|bool + when: run_self_check | bool and matrix_dendrite_enabled | bool tags: - self-check -- import_tasks: "{{ role_path }}/tasks/self_check_federation_api.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/self_check_federation_api.yml" delegate_to: 127.0.0.1 become: false - when: run_self_check|bool and matrix_dendrite_enabled|bool + when: run_self_check | bool and matrix_dendrite_enabled | bool tags: - self-check diff --git a/roles/matrix-dendrite/tasks/register_user.yml b/roles/matrix-dendrite/tasks/register_user.yml index e18af138..d1ac111e 100644 --- a/roles/matrix-dendrite/tasks/register_user.yml +++ b/roles/matrix-dendrite/tasks/register_user.yml @@ -17,7 +17,7 @@ register: start_result - name: Wait a while, so that Dendrite can manage to start - pause: + ansible.builtin.pause: seconds: 7 when: "start_result.changed" diff --git a/roles/matrix-dendrite/tasks/self_check_federation_api.yml b/roles/matrix-dendrite/tasks/self_check_federation_api.yml index 0d817afe..25b2871c 100644 --- a/roles/matrix-dendrite/tasks/self_check_federation_api.yml +++ b/roles/matrix-dendrite/tasks/self_check_federation_api.yml @@ -11,14 +11,14 @@ - name: Fail if Matrix Federation API not working ansible.builtin.fail: msg: "Failed checking Matrix Federation API is up at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_dendrite_federation_api_url_endpoint_public }}`). Is Dendrite running? Is port {{ matrix_federation_public_port }} open in your firewall? Full error: {{ result_matrix_dendrite_federation_api }}" - when: "matrix_dendrite_federation_enabled|bool and (result_matrix_dendrite_federation_api.failed or 'json' not in result_matrix_dendrite_federation_api)" + when: "matrix_dendrite_federation_enabled | bool and (result_matrix_dendrite_federation_api.failed or 'json' not in result_matrix_dendrite_federation_api)" - name: Fail if Matrix Federation API unexpectedly enabled ansible.builtin.fail: msg: "Matrix Federation API is up at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_dendrite_federation_api_url_endpoint_public }}`) despite being disabled." - when: "not matrix_dendrite_federation_enabled|bool and not result_matrix_dendrite_federation_api.failed" + when: "not matrix_dendrite_federation_enabled | bool and not result_matrix_dendrite_federation_api.failed" - name: Report working Matrix Federation API ansible.builtin.debug: msg: "The Matrix Federation API at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_dendrite_federation_api_url_endpoint_public }}`) is working" - when: "matrix_dendrite_federation_enabled|bool" + when: "matrix_dendrite_federation_enabled | bool" diff --git a/roles/matrix-dendrite/tasks/setup_dendrite.yml b/roles/matrix-dendrite/tasks/setup_dendrite.yml index 792e9c4f..f74f08c2 100644 --- a/roles/matrix-dendrite/tasks/setup_dendrite.yml +++ b/roles/matrix-dendrite/tasks/setup_dendrite.yml @@ -10,6 +10,6 @@ - {path: "{{ matrix_dendrite_config_dir_path }}", when: true} - {path: "{{ matrix_dendrite_ext_path }}", when: true} - {path: "{{ matrix_dendrite_nats_storage_path }}", when: true} - when: "matrix_dendrite_enabled|bool and item.when" + when: "matrix_dendrite_enabled | bool and item.when" -- import_tasks: "{{ role_path }}/tasks/dendrite/setup.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/dendrite/setup.yml" diff --git a/roles/matrix-dendrite/vars/main.yml b/roles/matrix-dendrite/vars/main.yml index 60d5f4eb..d0c07c0c 100644 --- a/roles/matrix-dendrite/vars/main.yml +++ b/roles/matrix-dendrite/vars/main.yml @@ -6,6 +6,6 @@ matrix_dendrite_federation_api_url_endpoint_public: "https://{{ matrix_server_fq matrix_dendrite_role_executed: false matrix_dendrite_media_store_parent_path: "{{ matrix_dendrite_media_store_path|dirname }}" -matrix_dendrite_media_store_directory_name: "{{ matrix_dendrite_media_store_path|basename }}" +matrix_dendrite_media_store_directory_name: "{{ matrix_dendrite_media_store_path | basename }}" -matrix_dendrite_signing_key_file_name: "{{ matrix_dendrite_signing_key|basename }}" +matrix_dendrite_signing_key_file_name: "{{ matrix_dendrite_signing_key | basename }}" diff --git a/roles/matrix-dimension/defaults/main.yml b/roles/matrix-dimension/defaults/main.yml index 68bd7908..1af7f293 100644 --- a/roles/matrix-dimension/defaults/main.yml +++ b/roles/matrix-dimension/defaults/main.yml @@ -93,8 +93,8 @@ matrix_dimension_configuration_extension_yaml: | # botToken: "YourTokenHere" # -matrix_dimension_configuration_extension: "{{ matrix_dimension_configuration_extension_yaml|from_yaml if matrix_dimension_configuration_extension_yaml|from_yaml is mapping else {} }}" +matrix_dimension_configuration_extension: "{{ matrix_dimension_configuration_extension_yaml | from_yaml if matrix_dimension_configuration_extension_yaml | from_yaml is mapping else {} }}" # Holds the final Dimension configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_dimension_configuration_yaml`. -matrix_dimension_configuration: "{{ matrix_dimension_configuration_yaml|from_yaml|combine(matrix_dimension_configuration_extension, recursive=True) }}" +matrix_dimension_configuration: "{{ matrix_dimension_configuration_yaml | from_yaml|combine(matrix_dimension_configuration_extension, recursive=True) }}" diff --git a/roles/matrix-dimension/tasks/init.yml b/roles/matrix-dimension/tasks/init.yml index 4ee1bb0e..c60a2fe2 100644 --- a/roles/matrix-dimension/tasks/init.yml +++ b/roles/matrix-dimension/tasks/init.yml @@ -1,4 +1,4 @@ --- - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-dimension.service'] }}" - when: matrix_dimension_enabled|bool + when: matrix_dimension_enabled | bool diff --git a/roles/matrix-dimension/tasks/main.yml b/roles/matrix-dimension/tasks/main.yml index c2f01399..6eef50d6 100644 --- a/roles/matrix-dimension/tasks/main.yml +++ b/roles/matrix-dimension/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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 +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: run_setup | bool tags: - setup-all - setup-dimension -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: run_setup|bool and matrix_dimension_enabled|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: run_setup | bool and matrix_dimension_enabled | bool tags: - setup-all - setup-dimension -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: run_setup|bool and not matrix_dimension_enabled|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: run_setup | bool and not matrix_dimension_enabled | bool tags: - setup-all - setup-dimension diff --git a/roles/matrix-dimension/tasks/setup_install.yml b/roles/matrix-dimension/tasks/setup_install.yml index 01bab7cf..c5456174 100644 --- a/roles/matrix-dimension/tasks/setup_install.yml +++ b/roles/matrix-dimension/tasks/setup_install.yml @@ -5,7 +5,7 @@ - block: - name: Check if an SQLite database already exists - stat: + ansible.builtin.stat: path: "{{ matrix_dimension_sqlite_database_path_local }}" register: matrix_dimension_sqlite_database_path_local_stat_result @@ -53,7 +53,7 @@ matrix_postgres_db_migration_request: src: "{{ matrix_dimension_sqlite_database_path_local }}" dst: "{{ matrix_dimension_database_connection_string }}" - caller: "{{ role_path|basename }}" + caller: "{{ role_path | basename }}" engine_variable_name: 'matrix_dimension_database_engine' engine_old: 'sqlite' systemd_services_to_stop: ['matrix-dimension.service'] @@ -61,11 +61,11 @@ additional_psql_statements_list: "{{ matrix_dimension_pgloader_additional_psql_statements_list }}" additional_psql_statements_db_name: "{{ matrix_dimension_database_name }}" - - 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_dimension_requires_restart: true - when: "matrix_dimension_sqlite_database_path_local_stat_result.stat.exists|bool" + when: "matrix_dimension_sqlite_database_path_local_stat_result.stat.exists | bool" when: "matrix_dimension_database_engine == 'postgres'" - name: Ensure Dimension base path exists @@ -78,7 +78,7 @@ - name: Ensure Dimension config installed ansible.builtin.copy: - content: "{{ matrix_dimension_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_dimension_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_dimension_base_path }}/config.yaml" mode: 0640 owner: "{{ matrix_user_username }}" @@ -90,7 +90,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_dimension_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_dimension_docker_image_force_pull }}" - when: "not matrix_dimension_container_image_self_build|bool" + when: "not matrix_dimension_container_image_self_build | bool" register: matrix_dimension_pull_results retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -104,7 +104,7 @@ force: "yes" become: true become_user: "{{ matrix_user_username }}" - when: "matrix_dimension_container_image_self_build|bool" + when: "matrix_dimension_container_image_self_build | bool" register: matrix_dimension_git_pull_results - name: Ensure Dimension Docker image is built @@ -117,7 +117,7 @@ dockerfile: Dockerfile path: "{{ matrix_dimension_docker_src_files_path }}" pull: true - when: "matrix_dimension_container_image_self_build|bool" + when: "matrix_dimension_container_image_self_build | bool" - name: Ensure matrix-dimension.service installed ansible.builtin.template: @@ -129,10 +129,10 @@ - name: Ensure systemd reloaded after matrix-dimension.service installation ansible.builtin.service: daemon_reload: true - when: "matrix_dimension_systemd_service_result.changed|bool" + when: "matrix_dimension_systemd_service_result.changed | bool" - name: Ensure matrix-dimension.service restarted, if necessary ansible.builtin.service: name: "matrix-dimension.service" state: restarted - when: "matrix_dimension_requires_restart|bool" + when: "matrix_dimension_requires_restart | bool" diff --git a/roles/matrix-dimension/tasks/setup_uninstall.yml b/roles/matrix-dimension/tasks/setup_uninstall.yml index 5a181893..3e2026a1 100644 --- a/roles/matrix-dimension/tasks/setup_uninstall.yml +++ b/roles/matrix-dimension/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-dimension service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-dimension.service" register: matrix_dimension_service_stat @@ -12,18 +12,18 @@ enabled: false daemon_reload: true register: stopping_result - when: "matrix_dimension_service_stat.stat.exists|bool" + when: "matrix_dimension_service_stat.stat.exists | bool" - name: Ensure matrix-dimension.service doesn't exist ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-dimension.service" state: absent - when: "matrix_dimension_service_stat.stat.exists|bool" + when: "matrix_dimension_service_stat.stat.exists | bool" - name: Ensure systemd reloaded after matrix-dimension.service removal ansible.builtin.service: daemon_reload: true - when: "matrix_dimension_service_stat.stat.exists|bool" + when: "matrix_dimension_service_stat.stat.exists | bool" - name: Ensure Dimension base directory doesn't exist ansible.builtin.file: diff --git a/roles/matrix-dimension/vars/main.yml b/roles/matrix-dimension/vars/main.yml index 131024cc..0415989f 100644 --- a/roles/matrix-dimension/vars/main.yml +++ b/roles/matrix-dimension/vars/main.yml @@ -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_dimension_configuration`) will fail later. -matrix_dimension_configuration_extension: "{{ matrix_dimension_configuration_extension_yaml|from_yaml if matrix_dimension_configuration_extension_yaml|from_yaml else {} }}" +matrix_dimension_configuration_extension: "{{ matrix_dimension_configuration_extension_yaml | from_yaml if matrix_dimension_configuration_extension_yaml | from_yaml else {} }}" diff --git a/roles/matrix-dynamic-dns/tasks/init.yml b/roles/matrix-dynamic-dns/tasks/init.yml index 2604270e..1cd6170e 100644 --- a/roles/matrix-dynamic-dns/tasks/init.yml +++ b/roles/matrix-dynamic-dns/tasks/init.yml @@ -8,4 +8,4 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-dynamic-dns.service'] }}" - when: "matrix_dynamic_dns_enabled|bool" + when: "matrix_dynamic_dns_enabled | bool" diff --git a/roles/matrix-dynamic-dns/tasks/install.yml b/roles/matrix-dynamic-dns/tasks/install.yml index 664f1854..8c7f3fc7 100644 --- a/roles/matrix-dynamic-dns/tasks/install.yml +++ b/roles/matrix-dynamic-dns/tasks/install.yml @@ -6,7 +6,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_dynamic_dns_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_dynamic_dns_docker_image_force_pull }}" - when: matrix_dynamic_dns_enabled|bool and not matrix_dynamic_dns_container_image_self_build + when: matrix_dynamic_dns_enabled | bool and not matrix_dynamic_dns_container_image_self_build register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -23,7 +23,7 @@ - {path: "{{ matrix_dynamic_dns_base_path }}", when: true} - {path: "{{ matrix_dynamic_dns_config_path }}", when: true} - {path: "{{ matrix_dynamic_dns_docker_src_files_path }}", when: "{{ matrix_dynamic_dns_container_image_self_build }}"} - when: matrix_dynamic_dns_enabled|bool and item.when|bool + when: matrix_dynamic_dns_enabled | bool and item.when | bool - name: Ensure Dynamic DNS repository is present on self build ansible.builtin.git: @@ -33,7 +33,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_dynamic_dns_git_pull_results - when: "matrix_dynamic_dns_enabled|bool and matrix_dynamic_dns_container_image_self_build|bool" + when: "matrix_dynamic_dns_enabled | bool and matrix_dynamic_dns_container_image_self_build | bool" - name: Ensure Dynamic DNS Docker image is built docker_image: @@ -45,7 +45,7 @@ dockerfile: Dockerfile path: "{{ matrix_dynamic_dns_docker_src_files_path }}" pull: true - when: "matrix_dynamic_dns_enabled|bool and matrix_dynamic_dns_container_image_self_build|bool" + when: "matrix_dynamic_dns_enabled | bool and matrix_dynamic_dns_container_image_self_build | bool" - name: Ensure Dynamic DNS ddclient.conf installed ansible.builtin.template: diff --git a/roles/matrix-dynamic-dns/tasks/main.yml b/roles/matrix-dynamic-dns/tasks/main.yml index 8b8b306c..2f33af86 100644 --- a/roles/matrix-dynamic-dns/tasks/main.yml +++ b/roles/matrix-dynamic-dns/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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_dynamic_dns_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_dynamic_dns_enabled | bool" tags: - setup-all - setup-dynamic-dns -- import_tasks: "{{ role_path }}/tasks/install.yml" - when: "run_setup|bool and matrix_dynamic_dns_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/install.yml" + when: "run_setup | bool and matrix_dynamic_dns_enabled | bool" tags: - setup-all - setup-dynamic-dns -- import_tasks: "{{ role_path }}/tasks/uninstall.yml" - when: "run_setup|bool and not matrix_dynamic_dns_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/uninstall.yml" + when: "run_setup | bool and not matrix_dynamic_dns_enabled | bool" tags: - setup-all - setup-dynamic-dns diff --git a/roles/matrix-dynamic-dns/tasks/uninstall.yml b/roles/matrix-dynamic-dns/tasks/uninstall.yml index 1583344d..5e6b429c 100644 --- a/roles/matrix-dynamic-dns/tasks/uninstall.yml +++ b/roles/matrix-dynamic-dns/tasks/uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-dynamic-dns service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-dynamic-dns.service" register: matrix_dynamic_dns_service_stat diff --git a/roles/matrix-email2matrix/tasks/init.yml b/roles/matrix-email2matrix/tasks/init.yml index 5e81b40a..02dbc9ee 100644 --- a/roles/matrix-email2matrix/tasks/init.yml +++ b/roles/matrix-email2matrix/tasks/init.yml @@ -2,4 +2,4 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-email2matrix.service'] }}" - when: matrix_email2matrix_enabled|bool + when: matrix_email2matrix_enabled | bool diff --git a/roles/matrix-email2matrix/tasks/main.yml b/roles/matrix-email2matrix/tasks/main.yml index 35bda4fa..3adbc646 100644 --- a/roles/matrix-email2matrix/tasks/main.yml +++ b/roles/matrix-email2matrix/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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_email2matrix_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_email2matrix_enabled | bool" tags: - setup-all - setup-email2matrix -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_email2matrix_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_email2matrix_enabled | bool" tags: - setup-all - setup-email2matrix -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_email2matrix_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_email2matrix_enabled | bool" tags: - setup-all - setup-email2matrix diff --git a/roles/matrix-email2matrix/tasks/setup_install.yml b/roles/matrix-email2matrix/tasks/setup_install.yml index 3828e36e..2a782a1a 100644 --- a/roles/matrix-email2matrix/tasks/setup_install.yml +++ b/roles/matrix-email2matrix/tasks/setup_install.yml @@ -11,7 +11,7 @@ - {path: "{{ matrix_email2matrix_base_path }}", when: true} - {path: "{{ matrix_email2matrix_config_dir_path }}", when: true} - {path: "{{ matrix_email2matrix_docker_src_files_path }}", when: "{{ matrix_email2matrix_container_image_self_build }}"} - when: "item.when|bool" + when: "item.when | bool" - name: Ensure Email2Matrix configuration file created ansible.builtin.template: @@ -27,7 +27,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_email2matrix_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_email2matrix_docker_image_force_pull }}" - when: "not matrix_email2matrix_container_image_self_build|bool" + when: "not matrix_email2matrix_container_image_self_build | bool" register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -42,7 +42,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_email2matrix_git_pull_results - when: "matrix_email2matrix_container_image_self_build|bool" + when: "matrix_email2matrix_container_image_self_build | bool" - name: Ensure Email2Matrix Docker image is built docker_image: @@ -54,7 +54,7 @@ dockerfile: etc/docker/Dockerfile path: "{{ matrix_email2matrix_docker_src_files_path }}" pull: true - when: "matrix_email2matrix_container_image_self_build|bool" + when: "matrix_email2matrix_container_image_self_build | bool" - name: Ensure matrix-email2matrix.service installed ansible.builtin.template: @@ -66,4 +66,4 @@ - name: Ensure systemd reloaded after matrix-email2matrix.service installation ansible.builtin.service: daemon_reload: true - when: "matrix_email2matrix_systemd_service_result.changed|bool" + when: "matrix_email2matrix_systemd_service_result.changed | bool" diff --git a/roles/matrix-email2matrix/tasks/setup_uninstall.yml b/roles/matrix-email2matrix/tasks/setup_uninstall.yml index 4b76adcc..a713a65a 100644 --- a/roles/matrix-email2matrix/tasks/setup_uninstall.yml +++ b/roles/matrix-email2matrix/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-email2matrix service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-email2matrix.service" register: matrix_email2matrix_service_stat @@ -12,18 +12,18 @@ enabled: false daemon_reload: true register: stopping_result - when: "matrix_email2matrix_service_stat.stat.exists|bool" + when: "matrix_email2matrix_service_stat.stat.exists | bool" - name: Ensure matrix-email2matrix.service doesn't exist ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-email2matrix.service" state: absent - when: "matrix_email2matrix_service_stat.stat.exists|bool" + when: "matrix_email2matrix_service_stat.stat.exists | bool" - name: Ensure systemd reloaded after matrix-email2matrix.service removal ansible.builtin.service: daemon_reload: true - when: "matrix_email2matrix_service_stat.stat.exists|bool" + when: "matrix_email2matrix_service_stat.stat.exists | bool" - name: Ensure Email2Matrix data path doesn't exist ansible.builtin.file: diff --git a/roles/matrix-etherpad/tasks/init.yml b/roles/matrix-etherpad/tasks/init.yml index a3cda068..e16b78dd 100644 --- a/roles/matrix-etherpad/tasks/init.yml +++ b/roles/matrix-etherpad/tasks/init.yml @@ -2,7 +2,7 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-etherpad.service'] }}" - when: matrix_etherpad_enabled|bool + when: matrix_etherpad_enabled | bool - block: - name: Fail if matrix-nginx-proxy role already executed @@ -12,7 +12,7 @@ but it's pointless since the matrix-nginx-proxy role had already executed. To fix this, please change the order of roles in your playbook, so that the matrix-nginx-proxy role would run after the matrix-etherpad role. - when: matrix_nginx_proxy_role_executed|default(False)|bool + when: matrix_nginx_proxy_role_executed | default(False) | bool - name: Generate Etherpad proxying configuration for matrix-nginx-proxy ansible.builtin.set_fact: @@ -20,7 +20,7 @@ rewrite ^{{ matrix_etherpad_public_endpoint }}$ {{ matrix_nginx_proxy_x_forwarded_proto_value }}://$server_name{{ matrix_etherpad_public_endpoint }}/ permanent; location {{ matrix_etherpad_public_endpoint }}/ { - {% if matrix_nginx_proxy_enabled|default(False) %} + {% if matrix_nginx_proxy_enabled | default(False) %} {# Use the embedded DNS resolver in Docker containers to discover the service #} resolver 127.0.0.11 valid=5s; proxy_pass http://matrix-etherpad:9001/; @@ -45,13 +45,13 @@ ansible.builtin.set_fact: matrix_nginx_proxy_proxy_dimension_additional_server_configuration_blocks: | {{ - matrix_nginx_proxy_proxy_dimension_additional_server_configuration_blocks|default([]) + matrix_nginx_proxy_proxy_dimension_additional_server_configuration_blocks | default([]) + [matrix_etherpad_matrix_nginx_proxy_configuration] }} tags: - always - when: matrix_etherpad_enabled|bool + when: matrix_etherpad_enabled | bool - name: Warn about reverse-proxying if matrix-nginx-proxy not used ansible.builtin.debug: @@ -61,4 +61,4 @@ Please make sure that you're proxying the `{{ matrix_etherpad_public_endpoint }}` URL endpoint to the matrix-etherpad container. You can expose the container's port using the `matrix_etherpad_container_http_host_bind_port` variable. - when: "matrix_etherpad_enabled|bool and not matrix_nginx_proxy_enabled|default(False)|bool" + when: "matrix_etherpad_enabled | bool and not matrix_nginx_proxy_enabled | default(False) | bool" diff --git a/roles/matrix-etherpad/tasks/main.yml b/roles/matrix-etherpad/tasks/main.yml index bf59d838..b1c8ab55 100644 --- a/roles/matrix-etherpad/tasks/main.yml +++ b/roles/matrix-etherpad/tasks/main.yml @@ -1,23 +1,23 @@ --- -- import_tasks: "{{ role_path }}/tasks/init.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/init.yml" tags: - always -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: run_setup|bool and matrix_etherpad_enabled|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: run_setup | bool and matrix_etherpad_enabled | bool tags: - setup-all - setup-etherpad -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: run_setup|bool and not matrix_etherpad_enabled|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: run_setup | bool and not matrix_etherpad_enabled | bool tags: - setup-all - setup-etherpad -- import_tasks: "{{ role_path }}/tasks/validate_config.yml" - when: run_setup|bool and matrix_etherpad_enabled|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: run_setup | bool and matrix_etherpad_enabled | bool tags: - setup-all - setup-etherpad diff --git a/roles/matrix-etherpad/tasks/setup_install.yml b/roles/matrix-etherpad/tasks/setup_install.yml index d11545a5..e3b1397f 100644 --- a/roles/matrix-etherpad/tasks/setup_install.yml +++ b/roles/matrix-etherpad/tasks/setup_install.yml @@ -37,4 +37,4 @@ - name: Ensure systemd reloaded after matrix-etherpad.service installation ansible.builtin.service: daemon_reload: true - when: "matrix_etherpad_systemd_service_result.changed|bool" + when: "matrix_etherpad_systemd_service_result.changed | bool" diff --git a/roles/matrix-etherpad/tasks/setup_uninstall.yml b/roles/matrix-etherpad/tasks/setup_uninstall.yml index b72b70bc..38697366 100644 --- a/roles/matrix-etherpad/tasks/setup_uninstall.yml +++ b/roles/matrix-etherpad/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-etherpad service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-etherpad.service" register: matrix_etherpad_service_stat @@ -12,18 +12,18 @@ enabled: false daemon_reload: true register: stopping_result - when: "matrix_etherpad_service_stat.stat.exists|bool" + when: "matrix_etherpad_service_stat.stat.exists | bool" - name: Ensure matrix-etherpad.service doesn't exist ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-etherpad.service" state: absent - when: "matrix_etherpad_service_stat.stat.exists|bool" + when: "matrix_etherpad_service_stat.stat.exists | bool" - name: Ensure systemd reloaded after matrix-etherpad.service removal ansible.builtin.service: daemon_reload: true - when: "matrix_etherpad_service_stat.stat.exists|bool" + when: "matrix_etherpad_service_stat.stat.exists | bool" - name: Ensure Etherpad base directory doesn't exist ansible.builtin.file: diff --git a/roles/matrix-etherpad/tasks/validate_config.yml b/roles/matrix-etherpad/tasks/validate_config.yml index 07194d65..bf78c36f 100644 --- a/roles/matrix-etherpad/tasks/validate_config.yml +++ b/roles/matrix-etherpad/tasks/validate_config.yml @@ -4,7 +4,7 @@ ansible.builtin.fail: msg: >- To integrate Etherpad notes with Matrix rooms you need to set "matrix_dimension_enabled" to true - when: "not matrix_dimension_enabled|bool" + when: "not matrix_dimension_enabled | bool" - name: Fail if no database is configured for Etherpad ansible.builtin.fail: diff --git a/roles/matrix-grafana/tasks/init.yml b/roles/matrix-grafana/tasks/init.yml index e01743b7..7b363ee7 100644 --- a/roles/matrix-grafana/tasks/init.yml +++ b/roles/matrix-grafana/tasks/init.yml @@ -2,4 +2,4 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-grafana.service'] }}" - when: matrix_grafana_enabled|bool + when: matrix_grafana_enabled | bool diff --git a/roles/matrix-grafana/tasks/main.yml b/roles/matrix-grafana/tasks/main.yml index c93fd500..34a3f415 100644 --- a/roles/matrix-grafana/tasks/main.yml +++ b/roles/matrix-grafana/tasks/main.yml @@ -1,16 +1,16 @@ --- -- 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_grafana_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_grafana_enabled | bool" tags: - setup-all - setup-grafana -- import_tasks: "{{ role_path }}/tasks/setup.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup.yml" tags: - setup-all - setup-grafana diff --git a/roles/matrix-grafana/tasks/setup.yml b/roles/matrix-grafana/tasks/setup.yml index da25db59..591c0222 100644 --- a/roles/matrix-grafana/tasks/setup.yml +++ b/roles/matrix-grafana/tasks/setup.yml @@ -10,7 +10,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_grafana_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_grafana_docker_image_force_pull }}" - when: "matrix_grafana_enabled|bool" + when: "matrix_grafana_enabled | bool" register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -31,7 +31,7 @@ - "{{ matrix_grafana_config_path }}/provisioning/dashboards" - "{{ matrix_grafana_config_path }}/dashboards" - "{{ matrix_grafana_data_path }}" - when: matrix_grafana_enabled|bool + when: matrix_grafana_enabled | bool - name: Ensure grafana.ini present ansible.builtin.template: @@ -40,7 +40,7 @@ mode: 0440 owner: "{{ matrix_user_username }}" group: "{{ matrix_user_groupname }}" - when: matrix_grafana_enabled|bool + when: matrix_grafana_enabled | bool - name: Ensure provisioning/datasources/default.yaml present ansible.builtin.template: @@ -49,7 +49,7 @@ mode: 0440 owner: "{{ matrix_user_username }}" group: "{{ matrix_user_groupname }}" - when: matrix_grafana_enabled|bool + when: matrix_grafana_enabled | bool - name: Ensure provisioning/dashboards/default.yaml present ansible.builtin.template: @@ -58,7 +58,7 @@ mode: 0440 owner: "{{ matrix_user_username }}" group: "{{ matrix_user_groupname }}" - when: matrix_grafana_enabled|bool + when: matrix_grafana_enabled | bool - name: Ensure dashboard(s) downloaded ansible.builtin.get_url: @@ -69,7 +69,7 @@ owner: "{{ matrix_user_username }}" group: "{{ matrix_user_groupname }}" with_items: "{{ matrix_grafana_dashboard_download_urls_all }}" - when: matrix_grafana_enabled|bool + when: matrix_grafana_enabled | bool register: result retries: "{{ matrix_geturl_retries_count }}" delay: "{{ matrix_geturl_retries_delay }}" @@ -81,19 +81,19 @@ dest: "{{ matrix_systemd_path }}/matrix-grafana.service" mode: 0644 register: matrix_grafana_systemd_service_result - when: matrix_grafana_enabled|bool + when: matrix_grafana_enabled | bool - name: Ensure systemd reloaded after matrix-grafana.service installation ansible.builtin.service: daemon_reload: true - when: "matrix_grafana_enabled|bool and matrix_grafana_systemd_service_result.changed" + when: "matrix_grafana_enabled | bool and matrix_grafana_systemd_service_result.changed" # # Tasks related to getting rid of matrix-grafana (if it was previously enabled) # - name: Check existence of matrix-grafana service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-grafana.service" register: matrix_grafana_service_stat @@ -104,15 +104,15 @@ enabled: false daemon_reload: true register: stopping_result - when: "not matrix_grafana_enabled|bool and matrix_grafana_service_stat.stat.exists" + when: "not matrix_grafana_enabled | bool and matrix_grafana_service_stat.stat.exists" - name: Ensure matrix-grafana.service doesn't exist ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-grafana.service" state: absent - when: "not matrix_grafana_enabled|bool and matrix_grafana_service_stat.stat.exists" + when: "not matrix_grafana_enabled | bool and matrix_grafana_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-grafana.service removal ansible.builtin.service: daemon_reload: true - when: "not matrix_grafana_enabled|bool and matrix_grafana_service_stat.stat.exists" + when: "not matrix_grafana_enabled | bool and matrix_grafana_service_stat.stat.exists" diff --git a/roles/matrix-jitsi/tasks/init.yml b/roles/matrix-jitsi/tasks/init.yml index 9a64ac63..8606c4b3 100644 --- a/roles/matrix-jitsi/tasks/init.yml +++ b/roles/matrix-jitsi/tasks/init.yml @@ -2,9 +2,9 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-jitsi-web.service', 'matrix-jitsi-prosody.service', 'matrix-jitsi-jicofo.service', 'matrix-jitsi-jvb.service'] }}" - when: matrix_jitsi_enabled|bool + when: matrix_jitsi_enabled | bool - name: Fail if on an unsupported architecture ansible.builtin.fail: msg: "Jitsi only supports the amd64 architecture right now. See https://github.com/jitsi/docker-jitsi-meet/issues/1069 and https://github.com/jitsi/docker-jitsi-meet/issues/1214" - when: matrix_jitsi_enabled|bool and matrix_architecture not in ['amd64', 'arm64'] + when: matrix_jitsi_enabled | bool and matrix_architecture not in ['amd64', 'arm64'] diff --git a/roles/matrix-jitsi/tasks/main.yml b/roles/matrix-jitsi/tasks/main.yml index fe9da205..7da6ebf9 100644 --- a/roles/matrix-jitsi/tasks/main.yml +++ b/roles/matrix-jitsi/tasks/main.yml @@ -1,41 +1,41 @@ --- -- 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_jitsi_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_jitsi_enabled | bool" tags: - setup-all - setup-jitsi -- import_tasks: "{{ role_path }}/tasks/setup_jitsi_base.yml" - when: run_setup|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_jitsi_base.yml" + when: run_setup | bool tags: - setup-all - setup-jitsi -- import_tasks: "{{ role_path }}/tasks/setup_jitsi_web.yml" - when: run_setup|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_jitsi_web.yml" + when: run_setup | bool tags: - setup-all - setup-jitsi -- import_tasks: "{{ role_path }}/tasks/setup_jitsi_prosody.yml" - when: run_setup|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_jitsi_prosody.yml" + when: run_setup | bool tags: - setup-all - setup-jitsi -- import_tasks: "{{ role_path }}/tasks/setup_jitsi_jicofo.yml" - when: run_setup|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_jitsi_jicofo.yml" + when: run_setup | bool tags: - setup-all - setup-jitsi -- import_tasks: "{{ role_path }}/tasks/setup_jitsi_jvb.yml" - when: run_setup|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_jitsi_jvb.yml" + when: run_setup | bool tags: - setup-all - setup-jitsi diff --git a/roles/matrix-jitsi/tasks/setup_jitsi_base.yml b/roles/matrix-jitsi/tasks/setup_jitsi_base.yml index a945450e..a91949e1 100644 --- a/roles/matrix-jitsi/tasks/setup_jitsi_base.yml +++ b/roles/matrix-jitsi/tasks/setup_jitsi_base.yml @@ -1,6 +1,6 @@ --- -- import_tasks: "{{ role_path }}/../matrix-base/tasks/util/ensure_openssl_installed.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/../matrix-base/tasks/util/ensure_openssl_installed.yml" # # Tasks related to setting up jitsi @@ -15,7 +15,7 @@ group: "{{ matrix_user_groupname }}" with_items: - {path: "{{ matrix_jitsi_base_path }}", when: true} - when: matrix_jitsi_enabled|bool and item.when + when: matrix_jitsi_enabled | bool and item.when # # Tasks related to getting rid of jitsi (if it was previously enabled) diff --git a/roles/matrix-jitsi/tasks/setup_jitsi_jicofo.yml b/roles/matrix-jitsi/tasks/setup_jitsi_jicofo.yml index 98569a13..8b2ec6a7 100644 --- a/roles/matrix-jitsi/tasks/setup_jitsi_jicofo.yml +++ b/roles/matrix-jitsi/tasks/setup_jitsi_jicofo.yml @@ -14,7 +14,7 @@ with_items: - {path: "{{ matrix_jitsi_jicofo_base_path }}", when: true} - {path: "{{ matrix_jitsi_jicofo_config_path }}", when: true} - when: matrix_jitsi_enabled|bool and item.when + when: matrix_jitsi_enabled | bool and item.when - name: Ensure jitsi-jicofo Docker image is pulled docker_image: @@ -22,7 +22,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_jitsi_jicofo_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_jitsi_jicofo_docker_image_force_pull }}" - when: matrix_jitsi_enabled|bool + when: matrix_jitsi_enabled | bool register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -35,7 +35,7 @@ owner: "{{ matrix_user_username }}" group: "{{ matrix_user_groupname }}" mode: 0640 - when: matrix_jitsi_enabled|bool + when: matrix_jitsi_enabled | bool - name: Ensure jitsi-jicofo configuration files created ansible.builtin.template: @@ -47,7 +47,7 @@ with_items: - sip-communicator.properties - logging.properties - when: matrix_jitsi_enabled|bool + when: matrix_jitsi_enabled | bool - name: Ensure matrix-jitsi-jicofo.service installed ansible.builtin.template: @@ -55,7 +55,7 @@ dest: "{{ matrix_systemd_path }}/matrix-jitsi-jicofo.service" mode: 0644 register: matrix_jitsi_jicofo_systemd_service_result - when: matrix_jitsi_enabled|bool + when: matrix_jitsi_enabled | bool - name: Ensure systemd reloaded after matrix-jitsi-jicofo.service installation ansible.builtin.service: @@ -67,10 +67,10 @@ # - name: Check existence of matrix-jitsi-jicofo service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-jitsi-jicofo.service" register: matrix_jitsi_jicofo_service_stat - when: "not matrix_jitsi_enabled|bool" + when: "not matrix_jitsi_enabled | bool" - name: Ensure matrix-jitsi-jicofo is stopped ansible.builtin.service: @@ -79,24 +79,24 @@ enabled: false daemon_reload: true register: stopping_result - when: "not matrix_jitsi_enabled|bool and matrix_jitsi_jicofo_service_stat.stat.exists" + when: "not matrix_jitsi_enabled | bool and matrix_jitsi_jicofo_service_stat.stat.exists" - name: Ensure matrix-jitsi-jicofo.service doesn't exist ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-jitsi-jicofo.service" state: absent - when: "not matrix_jitsi_enabled|bool and matrix_jitsi_jicofo_service_stat.stat.exists" + when: "not matrix_jitsi_enabled | bool and matrix_jitsi_jicofo_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-jitsi-jicofo.service removal ansible.builtin.service: daemon_reload: true - when: "not matrix_jitsi_enabled|bool and matrix_jitsi_jicofo_service_stat.stat.exists" + when: "not matrix_jitsi_enabled | bool and matrix_jitsi_jicofo_service_stat.stat.exists" - name: Ensure Matrix jitsi-jicofo paths doesn't exist ansible.builtin.file: path: "{{ matrix_jitsi_jicofo_base_path }}" state: absent - when: "not matrix_jitsi_enabled|bool" + when: "not matrix_jitsi_enabled | bool" # Intentionally not removing the Docker image when uninstalling. # We can't be sure it had been pulled by us in the first place. diff --git a/roles/matrix-jitsi/tasks/setup_jitsi_jvb.yml b/roles/matrix-jitsi/tasks/setup_jitsi_jvb.yml index 94425dc5..cdb94ebd 100644 --- a/roles/matrix-jitsi/tasks/setup_jitsi_jvb.yml +++ b/roles/matrix-jitsi/tasks/setup_jitsi_jvb.yml @@ -14,7 +14,7 @@ with_items: - {path: "{{ matrix_jitsi_jvb_base_path }}", when: true} - {path: "{{ matrix_jitsi_jvb_config_path }}", when: true} - when: matrix_jitsi_enabled|bool and item.when + when: matrix_jitsi_enabled | bool and item.when - name: Ensure jitsi-jvb Docker image is pulled docker_image: @@ -22,7 +22,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_jitsi_jvb_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_jitsi_jvb_docker_image_force_pull }}" - when: matrix_jitsi_enabled|bool + when: matrix_jitsi_enabled | bool register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -38,7 +38,7 @@ with_items: - custom-sip-communicator.properties - logging.properties - when: matrix_jitsi_enabled|bool + when: matrix_jitsi_enabled | bool - name: Ensure jitsi-jvb environment variables file created ansible.builtin.template: @@ -47,7 +47,7 @@ owner: "{{ matrix_user_username }}" group: "{{ matrix_user_groupname }}" mode: 0640 - when: matrix_jitsi_enabled|bool + when: matrix_jitsi_enabled | bool - name: Ensure matrix-jitsi-jvb.service installed ansible.builtin.template: @@ -55,7 +55,7 @@ dest: "{{ matrix_systemd_path }}/matrix-jitsi-jvb.service" mode: 0644 register: matrix_jitsi_jvb_systemd_service_result - when: matrix_jitsi_enabled|bool + when: matrix_jitsi_enabled | bool - name: Ensure systemd reloaded after matrix-jitsi-jvb.service installation ansible.builtin.service: @@ -67,10 +67,10 @@ # - name: Check existence of matrix-jitsi-jvb service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-jitsi-jvb.service" register: matrix_jitsi_jvb_service_stat - when: "not matrix_jitsi_enabled|bool" + when: "not matrix_jitsi_enabled | bool" - name: Ensure matrix-jitsi-jvb is stopped ansible.builtin.service: @@ -79,24 +79,24 @@ enabled: false daemon_reload: true register: stopping_result - when: "not matrix_jitsi_enabled|bool and matrix_jitsi_jvb_service_stat.stat.exists" + when: "not matrix_jitsi_enabled | bool and matrix_jitsi_jvb_service_stat.stat.exists" - name: Ensure matrix-jitsi-jvb.service doesn't exist ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-jitsi-jvb.service" state: absent - when: "not matrix_jitsi_enabled|bool and matrix_jitsi_jvb_service_stat.stat.exists" + when: "not matrix_jitsi_enabled | bool and matrix_jitsi_jvb_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-jitsi-jvb.service removal ansible.builtin.service: daemon_reload: true - when: "not matrix_jitsi_enabled|bool and matrix_jitsi_jvb_service_stat.stat.exists" + when: "not matrix_jitsi_enabled | bool and matrix_jitsi_jvb_service_stat.stat.exists" - name: Ensure Matrix jitsi-jvb paths doesn't exist ansible.builtin.file: path: "{{ matrix_jitsi_jvb_base_path }}" state: absent - when: "not matrix_jitsi_enabled|bool" + when: "not matrix_jitsi_enabled | bool" # Intentionally not removing the Docker image when uninstalling. # We can't be sure it had been pulled by us in the first place. diff --git a/roles/matrix-jitsi/tasks/setup_jitsi_prosody.yml b/roles/matrix-jitsi/tasks/setup_jitsi_prosody.yml index 17122231..92715e6b 100644 --- a/roles/matrix-jitsi/tasks/setup_jitsi_prosody.yml +++ b/roles/matrix-jitsi/tasks/setup_jitsi_prosody.yml @@ -15,7 +15,7 @@ - {path: "{{ matrix_jitsi_prosody_base_path }}", when: true} - {path: "{{ matrix_jitsi_prosody_config_path }}", when: true} - {path: "{{ matrix_jitsi_prosody_plugins_path }}", when: true} - when: matrix_jitsi_enabled|bool and item.when + when: matrix_jitsi_enabled | bool and item.when - name: Ensure jitsi-prosody Docker image is pulled docker_image: @@ -23,7 +23,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_jitsi_prosody_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_jitsi_prosody_docker_image_force_pull }}" - when: matrix_jitsi_enabled|bool + when: matrix_jitsi_enabled | bool register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -36,7 +36,7 @@ owner: "{{ matrix_user_username }}" group: "{{ matrix_user_groupname }}" mode: 0640 - when: matrix_jitsi_enabled|bool + when: matrix_jitsi_enabled | bool - name: Ensure matrix-jitsi-prosody.service file is installed ansible.builtin.template: @@ -44,7 +44,7 @@ dest: "{{ matrix_systemd_path }}/matrix-jitsi-prosody.service" mode: 0644 register: matrix_jitsi_prosody_systemd_service_result - when: matrix_jitsi_enabled|bool + when: matrix_jitsi_enabled | bool - name: Ensure systemd service is reloaded after matrix-jitsi-prosody.service installation ansible.builtin.service: @@ -52,11 +52,11 @@ when: "matrix_jitsi_enabled and matrix_jitsi_prosody_systemd_service_result.changed" - name: Ensure authentication is properly configured - include_tasks: + ansible.builtin.include_tasks: ansible.builtin.file: "{{ role_path }}/tasks/util/setup_jitsi_auth.yml" when: - - matrix_jitsi_enabled|bool - - matrix_jitsi_enable_auth|bool + - matrix_jitsi_enabled | bool + - matrix_jitsi_enable_auth | bool # @@ -64,10 +64,10 @@ # - name: Ensure matrix-jitsi-prosody.service file exists - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-jitsi-prosody.service" register: matrix_jitsi_prosody_service_stat - when: "not matrix_jitsi_enabled|bool" + when: "not matrix_jitsi_enabled | bool" - name: Ensure matrix-jitsi-prosody is stopped ansible.builtin.service: @@ -76,24 +76,24 @@ enabled: false daemon_reload: true register: stopping_result - when: "not matrix_jitsi_enabled|bool and matrix_jitsi_prosody_service_stat.stat.exists" + when: "not matrix_jitsi_enabled | bool and matrix_jitsi_prosody_service_stat.stat.exists" - name: Ensure matrix-jitsi-prosody.service file doesn't exist ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-jitsi-prosody.service" state: absent - when: "not matrix_jitsi_enabled|bool and matrix_jitsi_prosody_service_stat.stat.exists" + when: "not matrix_jitsi_enabled | bool and matrix_jitsi_prosody_service_stat.stat.exists" - name: Ensure systemd is reloaded after matrix-jitsi-prosody.service removal ansible.builtin.service: daemon_reload: true - when: "not matrix_jitsi_enabled|bool and matrix_jitsi_prosody_service_stat.stat.exists" + when: "not matrix_jitsi_enabled | bool and matrix_jitsi_prosody_service_stat.stat.exists" - name: Ensure Matrix jitsi-prosody paths doesn't exist ansible.builtin.file: path: "{{ matrix_jitsi_prosody_base_path }}" state: absent - when: "not matrix_jitsi_enabled|bool" + when: "not matrix_jitsi_enabled | bool" # Intentionally not removing the Docker image when uninstalling. # We can't be sure it had been pulled by us in the first place. diff --git a/roles/matrix-jitsi/tasks/setup_jitsi_web.yml b/roles/matrix-jitsi/tasks/setup_jitsi_web.yml index 586f703a..1c7daa4b 100644 --- a/roles/matrix-jitsi/tasks/setup_jitsi_web.yml +++ b/roles/matrix-jitsi/tasks/setup_jitsi_web.yml @@ -16,7 +16,7 @@ - {path: "{{ matrix_jitsi_web_config_path }}", when: true} - {path: "{{ matrix_jitsi_web_transcripts_path }}", when: true} - {path: "{{ matrix_jitsi_web_crontabs_path }}", when: true} - when: matrix_jitsi_enabled|bool and item.when + when: matrix_jitsi_enabled | bool and item.when - name: Ensure jitsi-web Docker image is pulled docker_image: @@ -24,7 +24,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_jitsi_web_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_jitsi_web_docker_image_force_pull }}" - when: matrix_jitsi_enabled|bool + when: matrix_jitsi_enabled | bool register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -37,7 +37,7 @@ owner: "{{ matrix_user_username }}" group: "{{ matrix_user_groupname }}" mode: 0640 - when: matrix_jitsi_enabled|bool + when: matrix_jitsi_enabled | bool - name: Ensure jitsi-web configuration files created ansible.builtin.template: @@ -49,7 +49,7 @@ with_items: - custom-config.js - custom-interface_config.js - when: matrix_jitsi_enabled|bool + when: matrix_jitsi_enabled | bool - name: Ensure matrix-jitsi-web.service installed ansible.builtin.template: @@ -57,7 +57,7 @@ dest: "{{ matrix_systemd_path }}/matrix-jitsi-web.service" mode: 0644 register: matrix_jitsi_web_systemd_service_result - when: matrix_jitsi_enabled|bool + when: matrix_jitsi_enabled | bool - name: Ensure systemd reloaded after matrix-jitsi-web.service installation ansible.builtin.service: @@ -69,10 +69,10 @@ # - name: Check existence of matrix-jitsi-web service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-jitsi-web.service" register: matrix_jitsi_web_service_stat - when: "not matrix_jitsi_enabled|bool" + when: "not matrix_jitsi_enabled | bool" - name: Ensure matrix-jitsi-web is stopped ansible.builtin.service: @@ -81,24 +81,24 @@ enabled: false daemon_reload: true register: stopping_result - when: "not matrix_jitsi_enabled|bool and matrix_jitsi_web_service_stat.stat.exists" + when: "not matrix_jitsi_enabled | bool and matrix_jitsi_web_service_stat.stat.exists" - name: Ensure matrix-jitsi-web.service doesn't exist ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-jitsi-web.service" state: absent - when: "not matrix_jitsi_enabled|bool and matrix_jitsi_web_service_stat.stat.exists" + when: "not matrix_jitsi_enabled | bool and matrix_jitsi_web_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-jitsi-web.service removal ansible.builtin.service: daemon_reload: true - when: "not matrix_jitsi_enabled|bool and matrix_jitsi_web_service_stat.stat.exists" + when: "not matrix_jitsi_enabled | bool and matrix_jitsi_web_service_stat.stat.exists" - name: Ensure Matrix jitsi-web paths doesn't exist ansible.builtin.file: path: "{{ matrix_jitsi_web_base_path }}" state: absent - when: "not matrix_jitsi_enabled|bool" + when: "not matrix_jitsi_enabled | bool" # Intentionally not removing the Docker image when uninstalling. # We can't be sure it had been pulled by us in the first place. diff --git a/roles/matrix-jitsi/tasks/util/setup_jitsi_auth.yml b/roles/matrix-jitsi/tasks/util/setup_jitsi_auth.yml index 5176a7c0..8c25fa3a 100644 --- a/roles/matrix-jitsi/tasks/util/setup_jitsi_auth.yml +++ b/roles/matrix-jitsi/tasks/util/setup_jitsi_auth.yml @@ -36,4 +36,4 @@ ansible.builtin.systemd: state: stopped name: matrix-jitsi-prosody - when: matrix_jitsi_prosody_start_result.changed|bool + when: matrix_jitsi_prosody_start_result.changed | bool diff --git a/roles/matrix-jitsi/tasks/validate_config.yml b/roles/matrix-jitsi/tasks/validate_config.yml index 5655ea45..df87b758 100644 --- a/roles/matrix-jitsi/tasks/validate_config.yml +++ b/roles/matrix-jitsi/tasks/validate_config.yml @@ -27,7 +27,7 @@ If you're setting up Jitsi for the first time, you may have missed a step. Refer to our setup instructions (docs/configuring-playbook-jitsi.md). when: - - matrix_jitsi_enable_auth|bool + - matrix_jitsi_enable_auth | bool - matrix_jitsi_auth_type == 'internal' - matrix_jitsi_prosody_auth_internal_accounts|length == 0 diff --git a/roles/matrix-ma1sd/defaults/main.yml b/roles/matrix-ma1sd/defaults/main.yml index 19aaf189..b62225e7 100644 --- a/roles/matrix-ma1sd/defaults/main.yml +++ b/roles/matrix-ma1sd/defaults/main.yml @@ -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) }}" diff --git a/roles/matrix-ma1sd/tasks/init.yml b/roles/matrix-ma1sd/tasks/init.yml index f3059bb4..1d425006 100644 --- a/roles/matrix-ma1sd/tasks/init.yml +++ b/roles/matrix-ma1sd/tasks/init.yml @@ -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 diff --git a/roles/matrix-ma1sd/tasks/main.yml b/roles/matrix-ma1sd/tasks/main.yml index 2902c05d..f55e7891 100644 --- a/roles/matrix-ma1sd/tasks/main.yml +++ b/roles/matrix-ma1sd/tasks/main.yml @@ -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 diff --git a/roles/matrix-ma1sd/tasks/migrate_mxisd.yml b/roles/matrix-ma1sd/tasks/migrate_mxisd.yml index 36ca8959..f80af0fd 100644 --- a/roles/matrix-ma1sd/tasks/migrate_mxisd.yml +++ b/roles/matrix-ma1sd/tasks/migrate_mxisd.yml @@ -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 diff --git a/roles/matrix-ma1sd/tasks/setup_install.yml b/roles/matrix-ma1sd/tasks/setup_install.yml index 2233067a..3995da24 100644 --- a/roles/matrix-ma1sd/tasks/setup_install.yml +++ b/roles/matrix-ma1sd/tasks/setup_install.yml @@ -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" diff --git a/roles/matrix-ma1sd/tasks/setup_uninstall.yml b/roles/matrix-ma1sd/tasks/setup_uninstall.yml index d50cd613..2bc505b0 100644 --- a/roles/matrix-ma1sd/tasks/setup_uninstall.yml +++ b/roles/matrix-ma1sd/tasks/setup_uninstall.yml @@ -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: diff --git a/roles/matrix-ma1sd/vars/main.yml b/roles/matrix-ma1sd/vars/main.yml index b6c97a59..3adc735e 100644 --- a/roles/matrix-ma1sd/vars/main.yml +++ b/roles/matrix-ma1sd/vars/main.yml @@ -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 {} }}" diff --git a/roles/matrix-mailer/tasks/init.yml b/roles/matrix-mailer/tasks/init.yml index c0afe962..e83902d7 100644 --- a/roles/matrix-mailer/tasks/init.yml +++ b/roles/matrix-mailer/tasks/init.yml @@ -8,4 +8,4 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mailer.service'] }}" - when: matrix_mailer_enabled|bool + when: matrix_mailer_enabled | bool diff --git a/roles/matrix-mailer/tasks/main.yml b/roles/matrix-mailer/tasks/main.yml index c69dad20..e49ff26d 100644 --- a/roles/matrix-mailer/tasks/main.yml +++ b/roles/matrix-mailer/tasks/main.yml @@ -1,11 +1,11 @@ --- -- import_tasks: "{{ role_path }}/tasks/init.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/init.yml" tags: - always -- import_tasks: "{{ role_path }}/tasks/setup_mailer.yml" - when: run_setup|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_mailer.yml" + when: run_setup | bool tags: - setup-all - setup-mailer diff --git a/roles/matrix-mailer/tasks/setup_mailer.yml b/roles/matrix-mailer/tasks/setup_mailer.yml index aa1e725a..2ab39df5 100644 --- a/roles/matrix-mailer/tasks/setup_mailer.yml +++ b/roles/matrix-mailer/tasks/setup_mailer.yml @@ -14,14 +14,14 @@ with_items: - {path: "{{ matrix_mailer_base_path }}", when: true} - {path: "{{ matrix_mailer_container_image_self_build_src_files_path }}", when: "{{ matrix_mailer_container_image_self_build }}"} - when: "matrix_mailer_enabled|bool and item.when" + when: "matrix_mailer_enabled | bool and item.when" - name: Ensure mailer environment variables file created ansible.builtin.template: src: "{{ role_path }}/templates/env-mailer.j2" dest: "{{ matrix_mailer_base_path }}/env-mailer" mode: 0640 - when: matrix_mailer_enabled|bool + when: matrix_mailer_enabled | bool - name: Ensure exim-relay repository is present on self-build ansible.builtin.git: @@ -32,7 +32,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_mailer_git_pull_results - when: "matrix_mailer_enabled|bool and matrix_mailer_container_image_self_build|bool" + when: "matrix_mailer_enabled | bool and matrix_mailer_container_image_self_build | bool" - name: Ensure exim-relay Docker image is built docker_image: @@ -44,7 +44,7 @@ dockerfile: Dockerfile path: "{{ matrix_mailer_container_image_self_build_src_files_path }}" pull: true - when: "matrix_mailer_enabled|bool and matrix_mailer_container_image_self_build|bool" + when: "matrix_mailer_enabled | bool and matrix_mailer_container_image_self_build | bool" - name: Ensure exim-relay image is pulled docker_image: @@ -52,7 +52,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_mailer_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_mailer_docker_image_force_pull }}" - when: "matrix_mailer_enabled|bool and not matrix_mailer_container_image_self_build|bool" + when: "matrix_mailer_enabled | bool and not matrix_mailer_container_image_self_build | bool" register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -64,22 +64,22 @@ dest: "{{ matrix_systemd_path }}/matrix-mailer.service" mode: 0644 register: matrix_mailer_systemd_service_result - when: matrix_mailer_enabled|bool + when: matrix_mailer_enabled | bool - name: Ensure systemd reloaded after matrix-mailer.service installation ansible.builtin.service: daemon_reload: true - when: "matrix_mailer_enabled|bool and matrix_mailer_systemd_service_result.changed" + when: "matrix_mailer_enabled | bool and matrix_mailer_systemd_service_result.changed" # # Tasks related to getting rid of the mailer (if it was previously enabled) # - name: Check existence of matrix-mailer service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-mailer.service" register: matrix_mailer_service_stat - when: "not matrix_mailer_enabled|bool" + when: "not matrix_mailer_enabled | bool" - name: Ensure matrix-mailer is stopped ansible.builtin.service: @@ -88,27 +88,27 @@ enabled: false daemon_reload: true register: stopping_result - when: "not matrix_mailer_enabled|bool and matrix_mailer_service_stat.stat.exists" + when: "not matrix_mailer_enabled | bool and matrix_mailer_service_stat.stat.exists" - name: Ensure matrix-mailer.service doesn't exist ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-mailer.service" state: absent - when: "not matrix_mailer_enabled|bool and matrix_mailer_service_stat.stat.exists" + when: "not matrix_mailer_enabled | bool and matrix_mailer_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-mailer.service removal ansible.builtin.service: daemon_reload: true - when: "not matrix_mailer_enabled|bool and matrix_mailer_service_stat.stat.exists" + when: "not matrix_mailer_enabled | bool and matrix_mailer_service_stat.stat.exists" - name: Ensure Matrix mailer environment variables path doesn't exist ansible.builtin.file: path: "{{ matrix_mailer_base_path }}" state: absent - when: "not matrix_mailer_enabled|bool" + when: "not matrix_mailer_enabled | bool" - name: Ensure mailer Docker image doesn't exist docker_image: name: "{{ matrix_mailer_docker_image }}" state: absent - when: "not matrix_mailer_enabled|bool" + when: "not matrix_mailer_enabled | bool" diff --git a/roles/matrix-nginx-proxy/tasks/init.yml b/roles/matrix-nginx-proxy/tasks/init.yml index 3f31470c..eb4249cb 100644 --- a/roles/matrix-nginx-proxy/tasks/init.yml +++ b/roles/matrix-nginx-proxy/tasks/init.yml @@ -1,9 +1,9 @@ --- - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-nginx-proxy.service'] }}" - when: matrix_nginx_proxy_enabled|bool + when: matrix_nginx_proxy_enabled | bool - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + [item.name] }}" - when: "item.applicable|bool and item.enableable|bool" + when: "item.applicable | bool and item.enableable | bool" with_items: "{{ matrix_ssl_renewal_systemd_units_list }}" diff --git a/roles/matrix-nginx-proxy/tasks/main.yml b/roles/matrix-nginx-proxy/tasks/main.yml index 066e62d3..9c34d1f5 100644 --- a/roles/matrix-nginx-proxy/tasks/main.yml +++ b/roles/matrix-nginx-proxy/tasks/main.yml @@ -1,34 +1,34 @@ --- -- import_tasks: "{{ role_path }}/tasks/init.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/init.yml" tags: - always # Always validating the configuration, even if `matrix_nginx_proxy: false`. # This role performs actions even if the role is disabled, so we need # to ensure there's a valid configuration in any case. -- import_tasks: "{{ role_path }}/tasks/validate_config.yml" - when: run_setup|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: run_setup | bool tags: - setup-all - setup-nginx-proxy -- import_tasks: "{{ role_path }}/tasks/ssl/main.yml" - when: run_setup|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ssl/main.yml" + when: run_setup | bool tags: - setup-all - setup-nginx-proxy - setup-ssl -- import_tasks: "{{ role_path }}/tasks/setup_nginx_proxy.yml" - when: run_setup|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_nginx_proxy.yml" + when: run_setup | bool tags: - setup-all - setup-nginx-proxy -- import_tasks: "{{ role_path }}/tasks/self_check_well_known.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/self_check_well_known.yml" delegate_to: 127.0.0.1 become: false - when: run_self_check|bool + when: run_self_check | bool tags: - self-check diff --git a/roles/matrix-nginx-proxy/tasks/self_check_well_known.yml b/roles/matrix-nginx-proxy/tasks/self_check_well_known.yml index ad53084d..2a5042d5 100644 --- a/roles/matrix-nginx-proxy/tasks/self_check_well_known.yml +++ b/roles/matrix-nginx-proxy/tasks/self_check_well_known.yml @@ -21,10 +21,10 @@ - name: Determine domains that we require certificates for (ma1sd) ansible.builtin.set_fact: well_known_file_checks: "{{ well_known_file_checks + [well_known_file_check_matrix_server] }}" - when: matrix_well_known_matrix_server_enabled|bool + when: matrix_well_known_matrix_server_enabled | bool - name: Perform well-known checks - include_tasks: "{{ role_path }}/tasks/self_check_well_known_file.yml" + ansible.builtin.include_tasks: "{{ role_path }}/tasks/self_check_well_known_file.yml" with_items: "{{ well_known_file_checks }}" loop_control: loop_var: well_known_file_check diff --git a/roles/matrix-nginx-proxy/tasks/setup_nginx_proxy.yml b/roles/matrix-nginx-proxy/tasks/setup_nginx_proxy.yml index 7a71c739..e2d3c36e 100644 --- a/roles/matrix-nginx-proxy/tasks/setup_nginx_proxy.yml +++ b/roles/matrix-nginx-proxy/tasks/setup_nginx_proxy.yml @@ -22,128 +22,128 @@ - {path: "{{ matrix_nginx_proxy_data_path }}", when: true} - {path: "{{ matrix_nginx_proxy_confd_path }}", when: true} - {path: "{{ matrix_nginx_proxy_synapse_cache_path }}", when: "{{ matrix_nginx_proxy_synapse_cache_enabled and not matrix_nginx_proxy_enabled }}"} - when: item.when|bool + when: item.when | bool - name: Ensure Matrix nginx-proxy configured (main config override) ansible.builtin.template: src: "{{ role_path }}/templates/nginx/nginx.conf.j2" dest: "{{ matrix_nginx_proxy_base_path }}/nginx.conf" mode: 0644 - when: matrix_nginx_proxy_enabled|bool + when: matrix_nginx_proxy_enabled | bool - name: Setup metrics - include_tasks: "{{ role_path }}/tasks/nginx-proxy/setup_metrics_auth.yml" - when: matrix_nginx_proxy_proxy_matrix_metrics_enabled|bool and matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_enabled|bool + ansible.builtin.include_tasks: "{{ role_path }}/tasks/nginx-proxy/setup_metrics_auth.yml" + when: matrix_nginx_proxy_proxy_matrix_metrics_enabled | bool and matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_enabled | bool - name: Ensure Matrix nginx-proxy configured (generic) ansible.builtin.template: src: "{{ role_path }}/templates/nginx/conf.d/nginx-http.conf.j2" dest: "{{ matrix_nginx_proxy_confd_path }}/nginx-http.conf" mode: 0644 - when: matrix_nginx_proxy_enabled|bool + when: matrix_nginx_proxy_enabled | bool - name: Ensure Matrix nginx-proxy configuration for matrix-synapse exists ansible.builtin.template: src: "{{ role_path }}/templates/nginx/conf.d/matrix-synapse.conf.j2" dest: "{{ matrix_nginx_proxy_confd_path }}/matrix-synapse.conf" mode: 0644 - when: matrix_nginx_proxy_proxy_synapse_enabled|bool + when: matrix_nginx_proxy_proxy_synapse_enabled | bool - name: Ensure Matrix nginx-proxy configuration for matrix-synapse deleted ansible.builtin.file: path: "{{ matrix_nginx_proxy_confd_path }}/matrix-synapse.conf" state: absent - when: "not matrix_nginx_proxy_proxy_synapse_enabled|bool" + when: "not matrix_nginx_proxy_proxy_synapse_enabled | bool" - name: Ensure Matrix nginx-proxy configuration for matrix-dendrite exists ansible.builtin.template: src: "{{ role_path }}/templates/nginx/conf.d/matrix-dendrite.conf.j2" dest: "{{ matrix_nginx_proxy_confd_path }}/matrix-dendrite.conf" mode: 0644 - when: matrix_nginx_proxy_proxy_dendrite_enabled|bool + when: matrix_nginx_proxy_proxy_dendrite_enabled | bool - name: Ensure Matrix nginx-proxy configuration for matrix-dendrite deleted ansible.builtin.file: path: "{{ matrix_nginx_proxy_confd_path }}/matrix-dendrite.conf" state: absent - when: "not matrix_nginx_proxy_proxy_dendrite_enabled|bool" + when: "not matrix_nginx_proxy_proxy_dendrite_enabled | bool" - name: Ensure Matrix nginx-proxy configuration for Element domain exists ansible.builtin.template: src: "{{ role_path }}/templates/nginx/conf.d/matrix-client-element.conf.j2" dest: "{{ matrix_nginx_proxy_confd_path }}/matrix-client-element.conf" mode: 0644 - when: matrix_nginx_proxy_proxy_element_enabled|bool + when: matrix_nginx_proxy_proxy_element_enabled | bool - name: Ensure Matrix nginx-proxy configuration for riot domain exists ansible.builtin.template: src: "{{ role_path }}/templates/nginx/conf.d/matrix-riot-web.conf.j2" dest: "{{ matrix_nginx_proxy_confd_path }}/matrix-riot-web.conf" mode: 0644 - when: matrix_nginx_proxy_proxy_riot_compat_redirect_enabled|bool + when: matrix_nginx_proxy_proxy_riot_compat_redirect_enabled | bool - name: Ensure Matrix nginx-proxy configuration for Hydrogen domain exists ansible.builtin.template: src: "{{ role_path }}/templates/nginx/conf.d/matrix-client-hydrogen.conf.j2" dest: "{{ matrix_nginx_proxy_confd_path }}/matrix-client-hydrogen.conf" mode: 0644 - when: matrix_nginx_proxy_proxy_hydrogen_enabled|bool + when: matrix_nginx_proxy_proxy_hydrogen_enabled | bool - name: Ensure Matrix nginx-proxy configuration for Cinny domain exists ansible.builtin.template: src: "{{ role_path }}/templates/nginx/conf.d/matrix-client-cinny.conf.j2" dest: "{{ matrix_nginx_proxy_confd_path }}/matrix-client-cinny.conf" mode: 0644 - when: matrix_nginx_proxy_proxy_cinny_enabled|bool + when: matrix_nginx_proxy_proxy_cinny_enabled | bool - name: Ensure Matrix nginx-proxy configuration for buscarron domain exists ansible.builtin.template: src: "{{ role_path }}/templates/nginx/conf.d/matrix-bot-buscarron.conf.j2" dest: "{{ matrix_nginx_proxy_confd_path }}/matrix-bot-buscarron.conf" mode: 0644 - when: matrix_nginx_proxy_proxy_buscarron_enabled|bool + when: matrix_nginx_proxy_proxy_buscarron_enabled | bool - name: Ensure Matrix nginx-proxy configuration for dimension domain exists ansible.builtin.template: src: "{{ role_path }}/templates/nginx/conf.d/matrix-dimension.conf.j2" dest: "{{ matrix_nginx_proxy_confd_path }}/matrix-dimension.conf" mode: 0644 - when: matrix_nginx_proxy_proxy_dimension_enabled|bool + when: matrix_nginx_proxy_proxy_dimension_enabled | bool - name: Ensure Matrix nginx-proxy configuration for goneb domain exists ansible.builtin.template: src: "{{ role_path }}/templates/nginx/conf.d/matrix-bot-go-neb.conf.j2" dest: "{{ matrix_nginx_proxy_confd_path }}/matrix-bot-go-neb.conf" mode: 0644 - when: matrix_nginx_proxy_proxy_bot_go_neb_enabled|bool + when: matrix_nginx_proxy_proxy_bot_go_neb_enabled | bool - name: Ensure Matrix nginx-proxy configuration for jitsi domain exists ansible.builtin.template: src: "{{ role_path }}/templates/nginx/conf.d/matrix-jitsi.conf.j2" dest: "{{ matrix_nginx_proxy_confd_path }}/matrix-jitsi.conf" mode: 0644 - when: matrix_nginx_proxy_proxy_jitsi_enabled|bool + when: matrix_nginx_proxy_proxy_jitsi_enabled | bool - name: Ensure Matrix nginx-proxy configuration for grafana domain exists ansible.builtin.template: src: "{{ role_path }}/templates/nginx/conf.d/matrix-grafana.conf.j2" dest: "{{ matrix_nginx_proxy_confd_path }}/matrix-grafana.conf" mode: 0644 - when: matrix_nginx_proxy_proxy_grafana_enabled|bool + when: matrix_nginx_proxy_proxy_grafana_enabled | bool - name: Ensure Matrix nginx-proxy configuration for sygnal domain exists ansible.builtin.template: src: "{{ role_path }}/templates/nginx/conf.d/matrix-sygnal.conf.j2" dest: "{{ matrix_nginx_proxy_confd_path }}/matrix-sygnal.conf" mode: 0644 - when: matrix_nginx_proxy_proxy_sygnal_enabled|bool + when: matrix_nginx_proxy_proxy_sygnal_enabled | bool - name: Ensure Matrix nginx-proxy configuration for ntfy domain exists ansible.builtin.template: src: "{{ role_path }}/templates/nginx/conf.d/matrix-ntfy.conf.j2" dest: "{{ matrix_nginx_proxy_confd_path }}/matrix-ntfy.conf" mode: 0644 - when: matrix_nginx_proxy_proxy_ntfy_enabled|bool + when: matrix_nginx_proxy_proxy_ntfy_enabled | bool - name: Ensure Matrix nginx-proxy configuration for Matrix domain exists ansible.builtin.template: @@ -158,7 +158,7 @@ mode: 0750 owner: "{{ matrix_user_username }}" group: "{{ matrix_user_groupname }}" - when: matrix_nginx_proxy_base_domain_serving_enabled|bool and matrix_nginx_proxy_base_domain_create_directory|bool + when: matrix_nginx_proxy_base_domain_serving_enabled | bool and matrix_nginx_proxy_base_domain_create_directory | bool - name: Ensure Matrix nginx-proxy homepage for base domain exists ansible.builtin.copy: @@ -167,14 +167,14 @@ mode: 0644 owner: "{{ matrix_user_username }}" group: "{{ matrix_user_groupname }}" - when: matrix_nginx_proxy_base_domain_serving_enabled|bool and matrix_nginx_proxy_base_domain_homepage_enabled|bool and matrix_nginx_proxy_base_domain_create_directory|bool + when: matrix_nginx_proxy_base_domain_serving_enabled | bool and matrix_nginx_proxy_base_domain_homepage_enabled | bool and matrix_nginx_proxy_base_domain_create_directory | bool - name: Ensure Matrix nginx-proxy configuration for base domain exists ansible.builtin.template: src: "{{ role_path }}/templates/nginx/conf.d/matrix-base-domain.conf.j2" dest: "{{ matrix_nginx_proxy_confd_path }}/matrix-base-domain.conf" mode: 0644 - when: matrix_nginx_proxy_base_domain_serving_enabled|bool + when: matrix_nginx_proxy_base_domain_serving_enabled | bool # # Tasks related to setting up matrix-nginx-proxy @@ -185,7 +185,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_nginx_proxy_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_nginx_proxy_docker_image_force_pull }}" - when: matrix_nginx_proxy_enabled|bool + when: matrix_nginx_proxy_enabled | bool register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -197,7 +197,7 @@ dest: "{{ matrix_systemd_path }}/matrix-nginx-proxy.service" mode: 0644 register: matrix_nginx_proxy_systemd_service_result - when: matrix_nginx_proxy_enabled|bool + when: matrix_nginx_proxy_enabled | bool - name: Ensure systemd reloaded after matrix-nginx-proxy.service installation ansible.builtin.service: @@ -210,10 +210,10 @@ # - name: Check existence of matrix-nginx-proxy service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-nginx-proxy.service" register: matrix_nginx_proxy_service_stat - when: "not matrix_nginx_proxy_enabled|bool" + when: "not matrix_nginx_proxy_enabled | bool" - name: Ensure matrix-nginx-proxy is stopped ansible.builtin.service: @@ -222,102 +222,102 @@ enabled: false daemon_reload: true register: stopping_result - when: "not matrix_nginx_proxy_enabled|bool and matrix_nginx_proxy_service_stat.stat.exists" + when: "not matrix_nginx_proxy_enabled | bool and matrix_nginx_proxy_service_stat.stat.exists" - name: Ensure matrix-nginx-proxy.service doesn't exist ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-nginx-proxy.service" state: absent - when: "not matrix_nginx_proxy_enabled|bool and matrix_nginx_proxy_service_stat.stat.exists" + when: "not matrix_nginx_proxy_enabled | bool and matrix_nginx_proxy_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-nginx-proxy.service removal ansible.builtin.service: daemon_reload: true - when: "not matrix_nginx_proxy_enabled|bool and matrix_nginx_proxy_service_stat.stat.exists" + when: "not matrix_nginx_proxy_enabled | bool and matrix_nginx_proxy_service_stat.stat.exists" - name: Ensure Matrix nginx-proxy configuration for matrix domain deleted ansible.builtin.file: path: "{{ matrix_nginx_proxy_confd_path }}/matrix-domain.conf" state: absent - when: "not matrix_nginx_proxy_proxy_matrix_enabled|bool" + when: "not matrix_nginx_proxy_proxy_matrix_enabled | bool" - name: Ensure Matrix nginx-proxy configuration for riot domain deleted ansible.builtin.file: path: "{{ matrix_nginx_proxy_confd_path }}/matrix-riot-web.conf" state: absent - when: "not matrix_nginx_proxy_proxy_riot_compat_redirect_enabled|bool" + when: "not matrix_nginx_proxy_proxy_riot_compat_redirect_enabled | bool" - name: Ensure Matrix nginx-proxy configuration for Hydrogen domain deleted ansible.builtin.file: path: "{{ matrix_nginx_proxy_confd_path }}/matrix-client-hydrogen.conf" state: absent - when: "not matrix_nginx_proxy_proxy_hydrogen_enabled|bool" + when: "not matrix_nginx_proxy_proxy_hydrogen_enabled | bool" - name: Ensure Matrix nginx-proxy configuration for Cinny domain deleted ansible.builtin.file: path: "{{ matrix_nginx_proxy_confd_path }}/matrix-client-cinny.conf" state: absent - when: "not matrix_nginx_proxy_proxy_cinny_enabled|bool" + when: "not matrix_nginx_proxy_proxy_cinny_enabled | bool" - name: Ensure Matrix nginx-proxy configuration for buscarron domain deleted ansible.builtin.file: path: "{{ matrix_nginx_proxy_confd_path }}/matrix-bot-buscarron.conf" state: absent - when: "not matrix_nginx_proxy_proxy_buscarron_enabled|bool" + when: "not matrix_nginx_proxy_proxy_buscarron_enabled | bool" - name: Ensure Matrix nginx-proxy configuration for dimension domain deleted ansible.builtin.file: path: "{{ matrix_nginx_proxy_confd_path }}/matrix-dimension.conf" state: absent - when: "not matrix_nginx_proxy_proxy_dimension_enabled|bool" + when: "not matrix_nginx_proxy_proxy_dimension_enabled | bool" - name: Ensure Matrix nginx-proxy configuration for goneb domain deleted ansible.builtin.file: path: "{{ matrix_nginx_proxy_confd_path }}/matrix-bot-go-neb.conf" state: absent - when: "not matrix_nginx_proxy_proxy_bot_go_neb_enabled|bool" + when: "not matrix_nginx_proxy_proxy_bot_go_neb_enabled | bool" - name: Ensure Matrix nginx-proxy configuration for jitsi domain deleted ansible.builtin.file: path: "{{ matrix_nginx_proxy_confd_path }}/matrix-jitsi.conf" state: absent - when: "not matrix_nginx_proxy_proxy_jitsi_enabled|bool" + when: "not matrix_nginx_proxy_proxy_jitsi_enabled | bool" - name: Ensure Matrix nginx-proxy configuration for grafana domain deleted ansible.builtin.file: path: "{{ matrix_nginx_proxy_confd_path }}/matrix-grafana.conf" state: absent - when: "not matrix_nginx_proxy_proxy_grafana_enabled|bool" + when: "not matrix_nginx_proxy_proxy_grafana_enabled | bool" - name: Ensure Matrix nginx-proxy configuration for sygnal domain deleted ansible.builtin.file: path: "{{ matrix_nginx_proxy_confd_path }}/matrix-sygnal.conf" state: absent - when: "not matrix_nginx_proxy_proxy_sygnal_enabled|bool" + when: "not matrix_nginx_proxy_proxy_sygnal_enabled | bool" - name: Ensure Matrix nginx-proxy configuration for ntfy domain deleted ansible.builtin.file: path: "{{ matrix_nginx_proxy_confd_path }}/matrix-ntfy.conf" state: absent - when: "not matrix_nginx_proxy_proxy_ntfy_enabled|bool" + when: "not matrix_nginx_proxy_proxy_ntfy_enabled | bool" - name: Ensure Matrix nginx-proxy homepage for base domain deleted ansible.builtin.file: path: "{{ matrix_nginx_proxy_data_path }}/matrix-domain/index.html" state: absent - when: "not matrix_nginx_proxy_base_domain_serving_enabled|bool" + when: "not matrix_nginx_proxy_base_domain_serving_enabled | bool" - name: Ensure Matrix nginx-proxy configuration for base domain deleted ansible.builtin.file: path: "{{ matrix_nginx_proxy_confd_path }}/matrix-base-domain.conf" state: absent - when: "not matrix_nginx_proxy_base_domain_serving_enabled|bool" + when: "not matrix_nginx_proxy_base_domain_serving_enabled | bool" - name: Ensure Matrix nginx-proxy configuration for main config override deleted ansible.builtin.file: path: "{{ matrix_nginx_proxy_base_path }}/nginx.conf" state: absent - when: "not matrix_nginx_proxy_enabled|bool" + when: "not matrix_nginx_proxy_enabled | bool" - name: Ensure Matrix nginx-proxy htpasswd is deleted (protecting /_synapse/metrics URI) ansible.builtin.file: @@ -334,4 +334,4 @@ ansible.builtin.file: path: "{{ matrix_nginx_proxy_data_path }}/matrix-metrics-htpasswd" state: absent - when: "not matrix_nginx_proxy_proxy_matrix_metrics_enabled|bool or not matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_enabled|bool" + when: "not matrix_nginx_proxy_proxy_matrix_metrics_enabled | bool or not matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_enabled | bool" diff --git a/roles/matrix-nginx-proxy/tasks/ssl/main.yml b/roles/matrix-nginx-proxy/tasks/ssl/main.yml index d6a2627b..0fa735b4 100644 --- a/roles/matrix-nginx-proxy/tasks/ssl/main.yml +++ b/roles/matrix-nginx-proxy/tasks/ssl/main.yml @@ -29,8 +29,8 @@ # Method specific tasks follow -- import_tasks: tasks/ssl/setup_ssl_lets_encrypt.yml +- ansible.builtin.import_tasks: tasks/ssl/setup_ssl_lets_encrypt.yml -- import_tasks: tasks/ssl/setup_ssl_self_signed.yml +- ansible.builtin.import_tasks: tasks/ssl/setup_ssl_self_signed.yml -- import_tasks: tasks/ssl/setup_ssl_manually_managed.yml +- ansible.builtin.import_tasks: tasks/ssl/setup_ssl_manually_managed.yml diff --git a/roles/matrix-nginx-proxy/tasks/ssl/setup_ssl_lets_encrypt.yml b/roles/matrix-nginx-proxy/tasks/ssl/setup_ssl_lets_encrypt.yml index 46be689c..0e5339a9 100644 --- a/roles/matrix-nginx-proxy/tasks/ssl/setup_ssl_lets_encrypt.yml +++ b/roles/matrix-nginx-proxy/tasks/ssl/setup_ssl_lets_encrypt.yml @@ -25,7 +25,7 @@ force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_ssl_lets_encrypt_certbot_docker_image_force_pull }}" - name: Obtain Let's Encrypt certificates - include_tasks: "{{ role_path }}/tasks/ssl/setup_ssl_lets_encrypt_obtain_for_domain.yml" + ansible.builtin.include_tasks: "{{ role_path }}/tasks/ssl/setup_ssl_lets_encrypt_obtain_for_domain.yml" with_items: "{{ matrix_ssl_domains_to_obtain_certificates_for }}" loop_control: loop_var: domain_name @@ -41,7 +41,7 @@ src: "{{ role_path }}/templates/systemd/{{ item.name }}.j2" dest: "{{ matrix_systemd_path }}/{{ item.name }}" mode: 0644 - when: "item.applicable|bool" + when: "item.applicable | bool" with_items: "{{ matrix_ssl_renewal_systemd_units_list }}" when: "matrix_ssl_retrieval_method == 'lets-encrypt'" @@ -54,7 +54,7 @@ ansible.builtin.file: path: "{{ matrix_systemd_path }}/{{ item.name }}" state: absent - when: "not item.applicable|bool" + when: "not item.applicable | bool" with_items: "{{ matrix_ssl_renewal_systemd_units_list }}" - name: Ensure Let's Encrypt SSL renewal script removed diff --git a/roles/matrix-nginx-proxy/tasks/ssl/setup_ssl_lets_encrypt_obtain_for_domain.yml b/roles/matrix-nginx-proxy/tasks/ssl/setup_ssl_lets_encrypt_obtain_for_domain.yml index 02a137f3..18cae090 100644 --- a/roles/matrix-nginx-proxy/tasks/ssl/setup_ssl_lets_encrypt_obtain_for_domain.yml +++ b/roles/matrix-nginx-proxy/tasks/ssl/setup_ssl_lets_encrypt_obtain_for_domain.yml @@ -6,7 +6,7 @@ domain_name_certificate_path: "{{ matrix_ssl_config_dir_path }}/live/{{ domain_name }}/fullchain.pem" - name: Check if a certificate for the domain already exists - stat: + ansible.builtin.stat: path: "{{ domain_name_certificate_path }}" register: domain_name_certificate_path_stat @@ -21,10 +21,10 @@ register: matrix_ssl_pre_obtaining_required_service_start_result - name: Wait some time, so that the required service for obtaining can start - wait_for: + ansible.builtin.wait_for: timeout: "{{ matrix_ssl_pre_obtaining_required_service_start_wait_time_seconds }}" - when: "matrix_ssl_pre_obtaining_required_service_start_result.changed|bool" - when: "domain_name_needs_cert|bool and matrix_ssl_pre_obtaining_required_service_name != ''" + when: "matrix_ssl_pre_obtaining_required_service_start_result.changed | bool" + when: "domain_name_needs_cert | bool and matrix_ssl_pre_obtaining_required_service_name != ''" # This will fail if there is something running on port 80 (like matrix-nginx-proxy). # We suppress the error, as we'll try another method below. @@ -51,7 +51,7 @@ --agree-tos --email={{ matrix_ssl_lets_encrypt_support_email }} -d {{ domain_name }} - when: domain_name_needs_cert|bool + when: domain_name_needs_cert | bool register: result_certbot_direct ignore_errors: true diff --git a/roles/matrix-nginx-proxy/tasks/ssl/setup_ssl_manually_managed.yml b/roles/matrix-nginx-proxy/tasks/ssl/setup_ssl_manually_managed.yml index 7bcd3d74..f6fc5a81 100644 --- a/roles/matrix-nginx-proxy/tasks/ssl/setup_ssl_manually_managed.yml +++ b/roles/matrix-nginx-proxy/tasks/ssl/setup_ssl_manually_managed.yml @@ -1,7 +1,7 @@ --- - name: Verify certificates - include_tasks: "{{ role_path }}/tasks/ssl/setup_ssl_manually_managed_verify_for_domain.yml" + ansible.builtin.include_tasks: "{{ role_path }}/tasks/ssl/setup_ssl_manually_managed_verify_for_domain.yml" with_items: "{{ matrix_ssl_domains_to_obtain_certificates_for }}" loop_control: loop_var: domain_name diff --git a/roles/matrix-nginx-proxy/tasks/ssl/setup_ssl_manually_managed_verify_for_domain.yml b/roles/matrix-nginx-proxy/tasks/ssl/setup_ssl_manually_managed_verify_for_domain.yml index 8bab1128..ab0ffa2f 100644 --- a/roles/matrix-nginx-proxy/tasks/ssl/setup_ssl_manually_managed_verify_for_domain.yml +++ b/roles/matrix-nginx-proxy/tasks/ssl/setup_ssl_manually_managed_verify_for_domain.yml @@ -5,7 +5,7 @@ matrix_ssl_certificate_verification_cert_key_path: "{{ matrix_ssl_config_dir_path }}/live/{{ domain_name }}/privkey.pem" - name: Check if SSL certificate file exists - stat: + ansible.builtin.stat: path: "{{ matrix_ssl_certificate_verification_cert_path }}" register: matrix_ssl_certificate_verification_cert_path_stat_result @@ -14,7 +14,7 @@ when: "not matrix_ssl_certificate_verification_cert_path_stat_result.stat.exists" - name: Check if SSL certificate key file exists - stat: + ansible.builtin.stat: path: "{{ matrix_ssl_certificate_verification_cert_key_path }}" register: matrix_ssl_certificate_verification_cert_key_path_stat_result diff --git a/roles/matrix-nginx-proxy/tasks/ssl/setup_ssl_self_signed.yml b/roles/matrix-nginx-proxy/tasks/ssl/setup_ssl_self_signed.yml index 47ec40aa..3a7f1958 100644 --- a/roles/matrix-nginx-proxy/tasks/ssl/setup_ssl_self_signed.yml +++ b/roles/matrix-nginx-proxy/tasks/ssl/setup_ssl_self_signed.yml @@ -1,10 +1,10 @@ --- -- import_tasks: "{{ role_path }}/../matrix-base/tasks/util/ensure_openssl_installed.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/../matrix-base/tasks/util/ensure_openssl_installed.yml" when: "matrix_ssl_retrieval_method == 'self-signed'" - name: Generate self-signed certificates - include_tasks: "{{ role_path }}/tasks/ssl/setup_ssl_self_signed_obtain_for_domain.yml" + ansible.builtin.include_tasks: "{{ role_path }}/tasks/ssl/setup_ssl_self_signed_obtain_for_domain.yml" with_items: "{{ matrix_ssl_domains_to_obtain_certificates_for }}" loop_control: loop_var: domain_name diff --git a/roles/matrix-nginx-proxy/tasks/ssl/setup_ssl_self_signed_obtain_for_domain.yml b/roles/matrix-nginx-proxy/tasks/ssl/setup_ssl_self_signed_obtain_for_domain.yml index 873420c3..889a33ba 100644 --- a/roles/matrix-nginx-proxy/tasks/ssl/setup_ssl_self_signed_obtain_for_domain.yml +++ b/roles/matrix-nginx-proxy/tasks/ssl/setup_ssl_self_signed_obtain_for_domain.yml @@ -6,7 +6,7 @@ matrix_ssl_certificate_cert_key_path: "{{ matrix_ssl_config_dir_path }}/live/{{ domain_name }}/privkey.pem" - name: Check if SSL certificate file exists - stat: + ansible.builtin.stat: path: "{{ matrix_ssl_certificate_cert_path }}" register: matrix_ssl_certificate_cert_path_stat_result diff --git a/roles/matrix-nginx-proxy/tasks/validate_config.yml b/roles/matrix-nginx-proxy/tasks/validate_config.yml index 7e3b1ecc..6c87a4bb 100644 --- a/roles/matrix-nginx-proxy/tasks/validate_config.yml +++ b/roles/matrix-nginx-proxy/tasks/validate_config.yml @@ -33,7 +33,7 @@ Enabling Basic Auth for metrics (`matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_enabled`) requires: - either a username/password (provided in `matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_username` and `matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_password`) - or raw htpasswd content (provided in `matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_raw_content`) - when: "matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_enabled|bool and (matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_raw_content == '' and (matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_username == '' or matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_password == ''))" + when: "matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_enabled | bool and (matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_raw_content == '' and (matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_username == '' or matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_password == ''))" - block: - name: (Deprecation) Catch and report renamed settings diff --git a/roles/matrix-nginx-proxy/vars/main.yml b/roles/matrix-nginx-proxy/vars/main.yml index 5c51fe5b..1a9ed929 100644 --- a/roles/matrix-nginx-proxy/vars/main.yml +++ b/roles/matrix-nginx-proxy/vars/main.yml @@ -11,8 +11,8 @@ matrix_ssl_renewal_systemd_units_list: applicable: "{{ matrix_ssl_retrieval_method == 'lets-encrypt' }}" enableable: true - name: matrix-ssl-nginx-proxy-reload.service - applicable: "{{ matrix_ssl_retrieval_method == 'lets-encrypt' and matrix_nginx_proxy_enabled|bool }}" + applicable: "{{ matrix_ssl_retrieval_method == 'lets-encrypt' and matrix_nginx_proxy_enabled | bool }}" enableable: false - name: matrix-ssl-nginx-proxy-reload.timer - applicable: "{{ matrix_ssl_retrieval_method == 'lets-encrypt' and matrix_nginx_proxy_enabled|bool }}" + applicable: "{{ matrix_ssl_retrieval_method == 'lets-encrypt' and matrix_nginx_proxy_enabled | bool }}" enableable: true diff --git a/roles/matrix-ntfy/defaults/main.yml b/roles/matrix-ntfy/defaults/main.yml index 96e9e69d..9f0a6eb8 100644 --- a/roles/matrix-ntfy/defaults/main.yml +++ b/roles/matrix-ntfy/defaults/main.yml @@ -41,8 +41,8 @@ matrix_ntfy_configuration_extension_yaml: | # If you need something more special, you can take full control by # completely redefining `matrix_ntfy_configuration_yaml`. -matrix_ntfy_configuration_extension: "{{ matrix_ntfy_configuration_extension_yaml|from_yaml if matrix_ntfy_configuration_extension_yaml|from_yaml is mapping else {} }}" +matrix_ntfy_configuration_extension: "{{ matrix_ntfy_configuration_extension_yaml | from_yaml if matrix_ntfy_configuration_extension_yaml | from_yaml is mapping else {} }}" # Holds the final ntfy configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_ntfy_configuration_yaml`. -matrix_ntfy_configuration: "{{ matrix_ntfy_configuration_yaml|from_yaml|combine(matrix_ntfy_configuration_extension, recursive=True) }}" +matrix_ntfy_configuration: "{{ matrix_ntfy_configuration_yaml | from_yaml|combine(matrix_ntfy_configuration_extension, recursive=True) }}" diff --git a/roles/matrix-ntfy/tasks/init.yml b/roles/matrix-ntfy/tasks/init.yml index 997be03f..6222ada0 100644 --- a/roles/matrix-ntfy/tasks/init.yml +++ b/roles/matrix-ntfy/tasks/init.yml @@ -2,4 +2,4 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-ntfy.service'] }}" - when: matrix_ntfy_enabled|bool + when: matrix_ntfy_enabled | bool diff --git a/roles/matrix-ntfy/tasks/main.yml b/roles/matrix-ntfy/tasks/main.yml index 5dd0d172..200d38c4 100644 --- a/roles/matrix-ntfy/tasks/main.yml +++ b/roles/matrix-ntfy/tasks/main.yml @@ -1,24 +1,24 @@ --- -- import_tasks: "{{ role_path }}/tasks/init.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/init.yml" tags: - always -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_ntfy_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_ntfy_enabled | bool" tags: - setup-all - setup-ntfy -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_ntfy_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_ntfy_enabled | bool" tags: - setup-all - setup-ntfy -- import_tasks: "{{ role_path }}/tasks/self_check.yml" +- 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_ntfy_enabled|bool" + when: "run_self_check | bool and matrix_ntfy_enabled | bool" tags: - self-check diff --git a/roles/matrix-ntfy/tasks/setup_install.yml b/roles/matrix-ntfy/tasks/setup_install.yml index 510110c1..9afabc4c 100644 --- a/roles/matrix-ntfy/tasks/setup_install.yml +++ b/roles/matrix-ntfy/tasks/setup_install.yml @@ -25,7 +25,7 @@ - name: Ensure matrix-ntfy config installed ansible.builtin.copy: - content: "{{ matrix_ntfy_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_ntfy_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_ntfy_config_dir_path }}/server.yml" mode: 0644 owner: "{{ matrix_user_username }}" diff --git a/roles/matrix-ntfy/tasks/setup_uninstall.yml b/roles/matrix-ntfy/tasks/setup_uninstall.yml index 93ecad3d..f6d9cc8a 100644 --- a/roles/matrix-ntfy/tasks/setup_uninstall.yml +++ b/roles/matrix-ntfy/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-ntfy service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-ntfy.service" register: matrix_ntfy_service_stat diff --git a/roles/matrix-postgres-backup/tasks/init.yml b/roles/matrix-postgres-backup/tasks/init.yml index aea1c337..5ece870a 100644 --- a/roles/matrix-postgres-backup/tasks/init.yml +++ b/roles/matrix-postgres-backup/tasks/init.yml @@ -2,4 +2,4 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-postgres-backup.service'] }}" - when: matrix_postgres_backup_enabled|bool + when: matrix_postgres_backup_enabled | bool diff --git a/roles/matrix-postgres-backup/tasks/main.yml b/roles/matrix-postgres-backup/tasks/main.yml index 19e3db5b..1403fa5b 100644 --- a/roles/matrix-postgres-backup/tasks/main.yml +++ b/roles/matrix-postgres-backup/tasks/main.yml @@ -1,17 +1,17 @@ --- -- 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_postgres_backup_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_postgres_backup_enabled | bool" tags: - setup-all - setup-postgres-backup -- import_tasks: "{{ role_path }}/tasks/setup_postgres_backup.yml" - when: run_setup|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_postgres_backup.yml" + when: run_setup | bool tags: - setup-all - setup-postgres-backup diff --git a/roles/matrix-postgres-backup/tasks/setup_postgres_backup.yml b/roles/matrix-postgres-backup/tasks/setup_postgres_backup.yml index deb80d8e..d45c152c 100644 --- a/roles/matrix-postgres-backup/tasks/setup_postgres_backup.yml +++ b/roles/matrix-postgres-backup/tasks/setup_postgres_backup.yml @@ -3,16 +3,16 @@ # # Tasks related to setting up an internal postgres server # -- import_tasks: "{{ role_path }}/tasks/util/detect_existing_postgres_version.yml" - when: 'matrix_postgres_backup_enabled|bool and matrix_postgres_backup_postgres_data_path != ""' +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/util/detect_existing_postgres_version.yml" + when: 'matrix_postgres_backup_enabled | bool and matrix_postgres_backup_postgres_data_path != ""' # If we have found an existing version (installed from before), we use its corresponding Docker image. # If not, we install using the latest Postgres. # # Upgrading is supposed to be performed separately and explicitly (see `upgrade_postgres.yml`). - ansible.builtin.set_fact: - matrix_postgres_backup_docker_image_to_use: "{{ matrix_postgres_backup_docker_image_latest if matrix_postgres_backup_detected_version_corresponding_docker_image|default('') == '' else matrix_postgres_backup_detected_version_corresponding_docker_image }}" - when: matrix_postgres_backup_enabled|bool + matrix_postgres_backup_docker_image_to_use: "{{ matrix_postgres_backup_docker_image_latest if matrix_postgres_backup_detected_version_corresponding_docker_image | default('') == '' else matrix_postgres_backup_detected_version_corresponding_docker_image }}" + when: matrix_postgres_backup_enabled | bool - name: Ensure postgres backup Docker image is pulled docker_image: @@ -20,7 +20,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_postgres_backup_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_postgres_backup_docker_image_force_pull }}" - when: matrix_postgres_backup_enabled|bool + when: matrix_postgres_backup_enabled | bool register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -35,7 +35,7 @@ group: "{{ matrix_user_groupname }}" with_items: - "{{ matrix_postgres_backup_path }}" - when: matrix_postgres_backup_enabled|bool + when: matrix_postgres_backup_enabled | bool - name: Ensure Postgres environment variables file created ansible.builtin.template: @@ -46,7 +46,7 @@ mode: 0640 with_items: - "env-postgres-backup" - when: matrix_postgres_backup_enabled|bool + when: matrix_postgres_backup_enabled | bool - name: Ensure matrix-postgres-backup.service installed ansible.builtin.template: @@ -54,22 +54,22 @@ dest: "{{ matrix_systemd_path }}/matrix-postgres-backup.service" mode: 0644 register: matrix_postgres_backup_systemd_service_result - when: matrix_postgres_backup_enabled|bool + when: matrix_postgres_backup_enabled | bool - name: Ensure systemd reloaded after matrix-postgres-backup.service installation ansible.builtin.service: daemon_reload: true - when: "matrix_postgres_backup_enabled|bool and matrix_postgres_backup_systemd_service_result.changed" + when: "matrix_postgres_backup_enabled | bool and matrix_postgres_backup_systemd_service_result.changed" # # Tasks related to getting rid of the internal postgres backup server (if it was previously enabled) # - name: Check existence of matrix-postgres-backup service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-postgres-backup.service" register: matrix_postgres_backup_service_stat - when: "not matrix_postgres_backup_enabled|bool" + when: "not matrix_postgres_backup_enabled | bool" - name: Ensure matrix-postgres-backup is stopped ansible.builtin.service: @@ -77,34 +77,34 @@ state: stopped enabled: false daemon_reload: true - when: "not matrix_postgres_backup_enabled|bool and matrix_postgres_backup_service_stat.stat.exists" + when: "not matrix_postgres_backup_enabled | bool and matrix_postgres_backup_service_stat.stat.exists" - name: Ensure matrix-postgres-backup.service doesn't exist ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-postgres-backup.service" state: absent - when: "not matrix_postgres_backup_enabled|bool and matrix_postgres_backup_service_stat.stat.exists" + when: "not matrix_postgres_backup_enabled | bool and matrix_postgres_backup_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-postgres-backup.service removal ansible.builtin.service: daemon_reload: true - when: "not matrix_postgres_backup_enabled|bool and matrix_postgres_backup_service_stat.stat.exists" + when: "not matrix_postgres_backup_enabled | bool and matrix_postgres_backup_service_stat.stat.exists" - name: Check existence of matrix-postgres-backup backup path - stat: + ansible.builtin.stat: path: "{{ matrix_postgres_backup_path }}" register: matrix_postgres_backup_path_stat - when: "not matrix_postgres_backup_enabled|bool" + when: "not matrix_postgres_backup_enabled | bool" # We just want to notify the user. Deleting data is too destructive. - name: Inject warning if matrix-postgres backup data remains ansible.builtin.set_fact: matrix_playbook_runtime_results: | {{ - matrix_playbook_runtime_results|default([]) + matrix_playbook_runtime_results | default([]) + [ "NOTE: You are not using the local backup service to backup the PostgreSQL database, but some old data remains from before in `{{ matrix_postgres_backup_path }}`. Feel free to delete it." ] }} - when: "not matrix_postgres_backup_enabled|bool and matrix_postgres_backup_path_stat.stat.exists" + when: "not matrix_postgres_backup_enabled | bool and matrix_postgres_backup_path_stat.stat.exists" diff --git a/roles/matrix-postgres-backup/tasks/util/detect_existing_postgres_version.yml b/roles/matrix-postgres-backup/tasks/util/detect_existing_postgres_version.yml index 33120453..cce35e00 100644 --- a/roles/matrix-postgres-backup/tasks/util/detect_existing_postgres_version.yml +++ b/roles/matrix-postgres-backup/tasks/util/detect_existing_postgres_version.yml @@ -11,7 +11,7 @@ matrix_postgres_backup_detected_version_corresponding_docker_image: "" - name: Determine existing Postgres version (check PG_VERSION file) - stat: + ansible.builtin.stat: path: "{{ matrix_postgres_backup_detection_pg_version_path }}" register: result_pg_version_stat @@ -23,12 +23,12 @@ ansible.builtin.slurp: src: "{{ matrix_postgres_backup_detection_pg_version_path }}" register: result_pg_version - when: matrix_postgres_backup_detected_existing|bool + when: matrix_postgres_backup_detected_existing | bool - name: Determine existing Postgres version (make sense of PG_VERSION file) ansible.builtin.set_fact: matrix_postgres_backup_detected_version: "{{ result_pg_version['content']|b64decode|replace('\n', '') }}" - when: matrix_postgres_backup_detected_existing|bool + when: matrix_postgres_backup_detected_existing | bool - name: Determine corresponding Docker image to detected version (assume default of latest) ansible.builtin.set_fact: diff --git a/roles/matrix-postgres/defaults/main.yml b/roles/matrix-postgres/defaults/main.yml index 3a4d73be..b5442309 100644 --- a/roles/matrix-postgres/defaults/main.yml +++ b/roles/matrix-postgres/defaults/main.yml @@ -78,7 +78,7 @@ matrix_postgres_import_roles_to_ignore: [matrix_postgres_connection_username] # which is unsupported by default by newer Postgres versions (v14+). # When users are created and passwords are set by the playbook, they end up hashed as `scram-sha-256` on Postgres v14+. # If an md5-hashed password is restored on top, Postgres v14+ will refuse to authenticate users with it by default. -matrix_postgres_import_roles_ignore_regex: "^(CREATE|ALTER) ROLE ({{ matrix_postgres_import_roles_to_ignore|join('|') }})(;| WITH)" +matrix_postgres_import_roles_ignore_regex: "^(CREATE|ALTER) ROLE ({{ matrix_postgres_import_roles_to_ignore | join('|') }})(;| WITH)" # A list of databases to avoid creating when importing (or upgrading) the database. # If a dump file contains the databases and they've also been created beforehand (see `matrix_postgres_additional_databases`), @@ -86,7 +86,7 @@ matrix_postgres_import_roles_ignore_regex: "^(CREATE|ALTER) ROLE ({{ matrix_post # We either need to not create them or to ignore the `CREATE DATABASE` statements in the dump. matrix_postgres_import_databases_to_ignore: [matrix_postgres_db_name] -matrix_postgres_import_databases_ignore_regex: "^CREATE DATABASE ({{ matrix_postgres_import_databases_to_ignore|join('|') }})\\s" +matrix_postgres_import_databases_ignore_regex: "^CREATE DATABASE ({{ matrix_postgres_import_databases_to_ignore | join('|') }})\\s" # The number of seconds to wait after starting `matrix-postgres.service` # and before trying to run queries for creating additional databases/users against it. diff --git a/roles/matrix-postgres/tasks/import_generic_sqlite_db.yml b/roles/matrix-postgres/tasks/import_generic_sqlite_db.yml index 81f37050..37f3353e 100644 --- a/roles/matrix-postgres/tasks/import_generic_sqlite_db.yml +++ b/roles/matrix-postgres/tasks/import_generic_sqlite_db.yml @@ -5,7 +5,7 @@ - name: Fail if Postgres not enabled ansible.builtin.fail: msg: "Postgres via the matrix-postgres role is not enabled (`matrix_postgres_enabled`). Cannot import." - when: "not matrix_postgres_enabled|bool" + when: "not matrix_postgres_enabled | bool" - name: Fail if playbook called incorrectly ansible.builtin.fail: @@ -13,7 +13,7 @@ when: "sqlite_database_path is not defined or sqlite_database_path.startswith('<')" - name: Check if the provided SQLite database file exists - stat: + ansible.builtin.stat: path: "{{ sqlite_database_path }}" register: sqlite_database_path_stat_result @@ -48,7 +48,7 @@ - name: Set postgres_start_wait_time, if not provided ansible.builtin.set_fact: postgres_start_wait_time: 15 - when: "postgres_start_wait_time|default('') == ''" + when: "postgres_start_wait_time | default('') == ''" # Actual import work @@ -61,11 +61,11 @@ register: matrix_postgres_service_start_result - name: Wait a bit, so that Postgres can start - wait_for: + ansible.builtin.wait_for: timeout: "{{ postgres_start_wait_time }}" delegate_to: 127.0.0.1 become: false - when: "matrix_postgres_service_start_result.changed|bool" + when: "matrix_postgres_service_start_result.changed | bool" - name: Import SQLite database from {{ sqlite_database_path }} into Postgres ansible.builtin.command: @@ -89,7 +89,7 @@ ansible.builtin.set_fact: matrix_playbook_runtime_results: | {{ - matrix_playbook_runtime_results|default([]) + matrix_playbook_runtime_results | default([]) + [ "NOTE: Your SQLite database file has been imported into Postgres. The original file has been moved from `{{ sqlite_database_path }}` to `{{ sqlite_database_path }}.backup`. When you've confirmed that the import went well and everything works, you should be able to safely delete this file." diff --git a/roles/matrix-postgres/tasks/import_postgres.yml b/roles/matrix-postgres/tasks/import_postgres.yml index 899dc78c..d74afe1d 100644 --- a/roles/matrix-postgres/tasks/import_postgres.yml +++ b/roles/matrix-postgres/tasks/import_postgres.yml @@ -5,7 +5,7 @@ - name: Fail if Postgres not enabled ansible.builtin.fail: msg: "Postgres via the matrix-postgres role is not enabled (`matrix_postgres_enabled`). Cannot import." - when: "not matrix_postgres_enabled|bool" + when: "not matrix_postgres_enabled | bool" - name: Fail if playbook called incorrectly ansible.builtin.fail: @@ -13,7 +13,7 @@ when: "server_path_postgres_dump is not defined or server_path_postgres_dump.startswith('<')" - name: Check if the provided Postgres dump file exists - stat: + ansible.builtin.stat: path: "{{ server_path_postgres_dump }}" register: result_server_path_postgres_dump_stat @@ -28,19 +28,19 @@ - name: Set postgres_start_wait_time, if not provided ansible.builtin.set_fact: postgres_start_wait_time: 15 - when: "postgres_start_wait_time|default('') == ''" + when: "postgres_start_wait_time | default('') == ''" - name: Set postgres_import_wait_time, if not provided ansible.builtin.set_fact: postgres_import_wait_time: "{{ 7 * 86400 }}" - when: "postgres_import_wait_time|default('') == ''" + when: "postgres_import_wait_time | default('') == ''" # By default, we connect and import into the main (`matrix`) database. # Single-database dumps for Synapse may wish to import into `synapse` instead. - name: Set postgres_default_import_database, if not provided ansible.builtin.set_fact: postgres_default_import_database: "{{ matrix_postgres_db_name }}" - when: "postgres_default_import_database|default('') == ''" + when: "postgres_default_import_database | default('') == ''" # Actual import work @@ -51,17 +51,17 @@ daemon_reload: true - name: Wait a bit, so that Postgres can start - wait_for: + ansible.builtin.wait_for: timeout: "{{ postgres_start_wait_time }}" delegate_to: 127.0.0.1 become: false -- import_tasks: tasks/util/detect_existing_postgres_version.yml +- ansible.builtin.import_tasks: tasks/util/detect_existing_postgres_version.yml - name: Abort, if no existing Postgres version detected ansible.builtin.fail: msg: "Could not find existing Postgres installation" - when: "not matrix_postgres_detected_existing|bool" + when: "not matrix_postgres_detected_existing | bool" # Starting the database container had automatically created the default # role (`matrix_postgres_connection_username`) and database (`matrix_postgres_db_name`). @@ -76,10 +76,10 @@ --cap-drop=ALL --network={{ matrix_docker_network }} --env-file={{ matrix_postgres_base_path }}/env-postgres-psql - --mount type=bind,src={{ server_path_postgres_dump }},dst=/{{ server_path_postgres_dump|basename }},ro + --mount type=bind,src={{ server_path_postgres_dump }},dst=/{{ server_path_postgres_dump | basename }},ro --entrypoint=/bin/sh {{ matrix_postgres_docker_image_latest }} - -c "cat /{{ server_path_postgres_dump|basename }} | + -c "cat /{{ server_path_postgres_dump | basename }} | {{ 'gunzip |' if server_path_postgres_dump.endswith('.gz') else '' }} grep -vE '{{ matrix_postgres_import_roles_ignore_regex }}' | grep -vE '{{ matrix_postgres_import_databases_ignore_regex }}' | diff --git a/roles/matrix-postgres/tasks/import_synapse_sqlite_db.yml b/roles/matrix-postgres/tasks/import_synapse_sqlite_db.yml index d10831dd..636b7b8e 100644 --- a/roles/matrix-postgres/tasks/import_synapse_sqlite_db.yml +++ b/roles/matrix-postgres/tasks/import_synapse_sqlite_db.yml @@ -5,7 +5,7 @@ - name: Fail if Postgres not enabled ansible.builtin.fail: msg: "Postgres via the matrix-postgres role is not enabled (`matrix_postgres_enabled`). Cannot import." - when: "not matrix_postgres_enabled|bool" + when: "not matrix_postgres_enabled | bool" - name: Fail if playbook called incorrectly ansible.builtin.fail: @@ -13,7 +13,7 @@ when: "server_path_homeserver_db is not defined or server_path_homeserver_db.startswith('<')" - name: Check if the provided SQLite homeserver.db file exists - stat: + ansible.builtin.stat: path: "{{ server_path_homeserver_db }}" register: result_server_path_homeserver_db_stat @@ -28,7 +28,7 @@ - name: Set postgres_start_wait_time, if not provided ansible.builtin.set_fact: postgres_start_wait_time: 15 - when: "postgres_start_wait_time|default('') == ''" + when: "postgres_start_wait_time | default('') == ''" # Actual import work @@ -59,7 +59,7 @@ daemon_reload: true - name: Wait a bit, so that Postgres can start - wait_for: + ansible.builtin.wait_for: timeout: "{{ postgres_start_wait_time }}" delegate_to: 127.0.0.1 become: false @@ -81,6 +81,6 @@ --entrypoint=python --mount type=bind,src={{ matrix_synapse_config_dir_path }},dst=/data --mount type=bind,src={{ matrix_synapse_config_dir_path }},dst=/matrix-media-store-parent/media-store - --mount type=bind,src={{ server_path_homeserver_db }},dst=/{{ server_path_homeserver_db|basename }} + --mount type=bind,src={{ server_path_homeserver_db }},dst=/{{ server_path_homeserver_db | basename }} {{ matrix_synapse_docker_image }} - /usr/local/bin/synapse_port_db --sqlite-database /{{ server_path_homeserver_db|basename }} --postgres-config /data/homeserver.yaml + /usr/local/bin/synapse_port_db --sqlite-database /{{ server_path_homeserver_db | basename }} --postgres-config /data/homeserver.yaml diff --git a/roles/matrix-postgres/tasks/init.yml b/roles/matrix-postgres/tasks/init.yml index 0a46fa86..659380f1 100644 --- a/roles/matrix-postgres/tasks/init.yml +++ b/roles/matrix-postgres/tasks/init.yml @@ -2,4 +2,4 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-postgres.service'] }}" - when: matrix_postgres_enabled|bool + when: matrix_postgres_enabled | bool diff --git a/roles/matrix-postgres/tasks/main.yml b/roles/matrix-postgres/tasks/main.yml index 79890417..8e21b3c6 100644 --- a/roles/matrix-postgres/tasks/main.yml +++ b/roles/matrix-postgres/tasks/main.yml @@ -1,45 +1,45 @@ --- -- 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_postgres_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_postgres_enabled | bool" tags: - setup-all - setup-postgres -- import_tasks: "{{ role_path }}/tasks/setup_postgres.yml" - when: run_setup|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_postgres.yml" + when: run_setup | bool tags: - setup-all - setup-postgres -- import_tasks: "{{ role_path }}/tasks/import_postgres.yml" - when: run_postgres_import|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/import_postgres.yml" + when: run_postgres_import | bool tags: - import-postgres # The `run_postgres_import_sqlite_db` variable had better be renamed to be consistent, # but that's a breaking change which may cause trouble for people. -- import_tasks: "{{ role_path }}/tasks/import_synapse_sqlite_db.yml" - when: run_postgres_import_sqlite_db|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/import_synapse_sqlite_db.yml" + when: run_postgres_import_sqlite_db | bool tags: - import-synapse-sqlite-db # Perhaps we need a new variable here, instead of `run_postgres_import_sqlite_db`. -- import_tasks: "{{ role_path }}/tasks/import_generic_sqlite_db.yml" - when: run_postgres_import_sqlite_db|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/import_generic_sqlite_db.yml" + when: run_postgres_import_sqlite_db | bool tags: - import-generic-sqlite-db -- import_tasks: "{{ role_path }}/tasks/upgrade_postgres.yml" - when: run_postgres_upgrade|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/upgrade_postgres.yml" + when: run_postgres_upgrade | bool tags: - upgrade-postgres -- import_tasks: "{{ role_path }}/tasks/run_vacuum.yml" - when: run_postgres_vacuum|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/run_vacuum.yml" + when: run_postgres_vacuum | bool tags: - run-postgres-vacuum diff --git a/roles/matrix-postgres/tasks/migrate_postgres_data_directory.yml b/roles/matrix-postgres/tasks/migrate_postgres_data_directory.yml index 4713fcd6..8c92e3e9 100644 --- a/roles/matrix-postgres/tasks/migrate_postgres_data_directory.yml +++ b/roles/matrix-postgres/tasks/migrate_postgres_data_directory.yml @@ -11,7 +11,7 @@ # which still store it in the parent directory (`/matrix/postgres`). - name: Check if old Postgres data directory is used - stat: + ansible.builtin.stat: path: "{{ matrix_postgres_base_path }}/PG_VERSION" register: result_pg_old_data_dir_stat @@ -33,7 +33,7 @@ when: "result_pg_old_data_dir_stat.stat.exists" - name: Find files and directories in old Postgres data path - find: + ansible.builtin.find: paths: "{{ matrix_postgres_base_path }}" file_type: any excludes: ["data"] @@ -51,7 +51,7 @@ - block: - name: Relocate Postgres data files from old directory to new - ansible.builtin.command: "mv {{ item.path }} {{ matrix_postgres_data_path }}/{{ item.path|basename }}" + ansible.builtin.command: "mv {{ item.path }} {{ matrix_postgres_data_path }}/{{ item.path | basename }}" with_items: "{{ result_pg_old_data_dir_find.files }}" when: "result_pg_old_data_dir_stat.stat.exists" diff --git a/roles/matrix-postgres/tasks/run_vacuum.yml b/roles/matrix-postgres/tasks/run_vacuum.yml index f3c59775..04088588 100644 --- a/roles/matrix-postgres/tasks/run_vacuum.yml +++ b/roles/matrix-postgres/tasks/run_vacuum.yml @@ -5,7 +5,7 @@ - name: Fail if Postgres not enabled ansible.builtin.fail: msg: "Postgres via the matrix-postgres role is not enabled (`matrix_postgres_enabled`). Cannot run vacuum." - when: "not matrix_postgres_enabled|bool" + when: "not matrix_postgres_enabled | bool" # Defaults @@ -13,12 +13,12 @@ - name: Set postgres_start_wait_time, if not provided ansible.builtin.set_fact: postgres_start_wait_time: 15 - when: "postgres_start_wait_time|default('') == ''" + when: "postgres_start_wait_time | default('') == ''" - name: Set postgres_vacuum_wait_time, if not provided ansible.builtin.set_fact: postgres_vacuum_wait_time: "{{ 7 * 86400 }}" - when: "postgres_vacuum_wait_time|default('') == ''" + when: "postgres_vacuum_wait_time | default('') == ''" # Actual vacuuming work @@ -30,17 +30,17 @@ daemon_reload: true - name: Wait a bit, so that Postgres can start - wait_for: + ansible.builtin.wait_for: timeout: "{{ postgres_start_wait_time }}" delegate_to: 127.0.0.1 become: false -- import_tasks: tasks/util/detect_existing_postgres_version.yml +- ansible.builtin.import_tasks: tasks/util/detect_existing_postgres_version.yml - name: Abort, if no existing Postgres version detected ansible.builtin.fail: msg: "Could not find existing Postgres installation" - when: "not matrix_postgres_detected_existing|bool" + when: "not matrix_postgres_detected_existing | bool" - name: Generate Postgres database vacuum command ansible.builtin.set_fact: @@ -62,7 +62,7 @@ and manually run the above command directly on the server. - name: Populate service facts - service_facts: + ansible.builtin.service_facts: - ansible.builtin.set_fact: matrix_postgres_synapse_was_running: "{{ ansible_facts.services['matrix-synapse.service']|default(none) is not none and ansible_facts.services['matrix-synapse.service'].state == 'running' }}" @@ -87,4 +87,4 @@ name: matrix-synapse state: started daemon_reload: true - when: "matrix_postgres_synapse_was_running|bool" + when: "matrix_postgres_synapse_was_running | bool" diff --git a/roles/matrix-postgres/tasks/setup_postgres.yml b/roles/matrix-postgres/tasks/setup_postgres.yml index 3cdde807..695876f6 100644 --- a/roles/matrix-postgres/tasks/setup_postgres.yml +++ b/roles/matrix-postgres/tasks/setup_postgres.yml @@ -4,11 +4,11 @@ # Tasks related to setting up an internal postgres server # -- import_tasks: "{{ role_path }}/tasks/migrate_postgres_data_directory.yml" - when: matrix_postgres_enabled|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/migrate_postgres_data_directory.yml" + when: matrix_postgres_enabled | bool -- import_tasks: "{{ role_path }}/tasks/util/detect_existing_postgres_version.yml" - when: matrix_postgres_enabled|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/util/detect_existing_postgres_version.yml" + when: matrix_postgres_enabled | bool # If we have found an existing version (installed from before), we use its corresponding Docker image. # If not, we install using the latest Postgres. @@ -16,24 +16,24 @@ # Upgrading is supposed to be performed separately and explicitly (see `upgrade_postgres.yml`). - ansible.builtin.set_fact: matrix_postgres_docker_image_to_use: "{{ matrix_postgres_docker_image_latest if matrix_postgres_detected_version_corresponding_docker_image == '' else matrix_postgres_detected_version_corresponding_docker_image }}" - when: matrix_postgres_enabled|bool + when: matrix_postgres_enabled | bool - name: Abort if on an unsupported Postgres version ansible.builtin.fail: msg: "You're on Postgres {{ matrix_postgres_detected_version }}, which is no longer supported. To upgrade, see docs/maintenance-postgres.md" - when: "matrix_postgres_enabled|bool and matrix_postgres_detected_version.startswith('9.')" + when: "matrix_postgres_enabled | bool and matrix_postgres_detected_version.startswith('9.')" - name: Inject warning if on an old version of Postgres ansible.builtin.set_fact: matrix_playbook_runtime_results: | {{ - matrix_playbook_runtime_results|default([]) + matrix_playbook_runtime_results | default([]) + [ "NOTE: Your setup is on an old Postgres version ({{ matrix_postgres_docker_image_to_use }}), while {{ matrix_postgres_docker_image_latest }} is supported. You can upgrade using --tags=upgrade-postgres" ] }} - when: "matrix_postgres_enabled|bool and matrix_postgres_docker_image_to_use != matrix_postgres_docker_image_latest" + when: "matrix_postgres_enabled | bool and matrix_postgres_docker_image_to_use != matrix_postgres_docker_image_latest" # Even if we don't run the internal server, we still need this for running the CLI - name: Ensure postgres Docker image is pulled @@ -42,7 +42,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_postgres_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_postgres_docker_image_force_pull }}" - when: matrix_postgres_enabled|bool + when: matrix_postgres_enabled | bool register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -58,7 +58,7 @@ with_items: - "{{ matrix_postgres_base_path }}" - "{{ matrix_postgres_data_path }}" - when: matrix_postgres_enabled|bool + when: matrix_postgres_enabled | bool # We do this as a separate task, because: # - we'd like to do it for the data path only, not for the base path (which contains root-owned environment variable files we'd like to leave as-is) @@ -70,7 +70,7 @@ owner: "{{ matrix_user_username }}" group: "{{ matrix_user_groupname }}" recurse: true - when: matrix_postgres_enabled|bool + when: matrix_postgres_enabled | bool - name: Ensure Postgres environment variables file created ansible.builtin.template: @@ -82,41 +82,41 @@ with_items: - "env-postgres-psql" - "env-postgres-server" - when: matrix_postgres_enabled|bool + when: matrix_postgres_enabled | bool - name: Ensure matrix-postgres-cli script created ansible.builtin.template: src: "{{ role_path }}/templates/usr-local-bin/matrix-postgres-cli.j2" dest: "{{ matrix_local_bin_path }}/matrix-postgres-cli" mode: 0755 - when: matrix_postgres_enabled|bool + when: matrix_postgres_enabled | bool - name: Ensure matrix-postgres-cli-non-interactive script created ansible.builtin.template: src: "{{ role_path }}/templates/usr-local-bin/matrix-postgres-cli-non-interactive.j2" dest: "{{ matrix_local_bin_path }}/matrix-postgres-cli-non-interactive" mode: 0755 - when: matrix_postgres_enabled|bool + when: matrix_postgres_enabled | bool - name: Ensure matrix-change-user-admin-status script created ansible.builtin.template: src: "{{ role_path }}/templates/usr-local-bin/matrix-change-user-admin-status.j2" dest: "{{ matrix_local_bin_path }}/matrix-change-user-admin-status" mode: 0755 - when: matrix_postgres_enabled|bool + when: matrix_postgres_enabled | bool - name: (Migration) Ensure old matrix-make-user-admin script deleted ansible.builtin.file: path: "{{ matrix_local_bin_path }}/matrix-make-user-admin" state: absent - when: matrix_postgres_enabled|bool + when: matrix_postgres_enabled | bool - name: Ensure matrix-postgres-update-user-password-hash script created ansible.builtin.template: src: "{{ role_path }}/templates/usr-local-bin/matrix-postgres-update-user-password-hash.j2" dest: "{{ matrix_local_bin_path }}/matrix-postgres-update-user-password-hash" mode: 0755 - when: matrix_postgres_enabled|bool + when: matrix_postgres_enabled | bool - name: Ensure matrix-postgres.service installed ansible.builtin.template: @@ -124,37 +124,37 @@ dest: "{{ matrix_systemd_path }}/matrix-postgres.service" mode: 0644 register: matrix_postgres_systemd_service_result - when: matrix_postgres_enabled|bool + when: matrix_postgres_enabled | bool - name: Ensure systemd reloaded after matrix-postgres.service installation ansible.builtin.service: daemon_reload: true - when: "matrix_postgres_enabled|bool and matrix_postgres_systemd_service_result.changed" + when: "matrix_postgres_enabled | bool and matrix_postgres_systemd_service_result.changed" -- include_tasks: +- ansible.builtin.include_tasks: ansible.builtin.file: "{{ role_path }}/tasks/util/create_additional_databases.yml" apply: tags: - always - when: "matrix_postgres_enabled|bool and matrix_postgres_additional_databases|length > 0" + when: "matrix_postgres_enabled | bool and matrix_postgres_additional_databases|length > 0" - name: Check existence of matrix-postgres backup data path - stat: + ansible.builtin.stat: path: "{{ matrix_postgres_data_path }}-auto-upgrade-backup" register: matrix_postgres_data_backup_path_stat - when: "matrix_postgres_enabled|bool" + when: "matrix_postgres_enabled | bool" - name: Inject warning if backup data remains ansible.builtin.set_fact: matrix_playbook_runtime_results: | {{ - matrix_playbook_runtime_results|default([]) + matrix_playbook_runtime_results | default([]) + [ "NOTE: You have some Postgres backup data in `{{ matrix_postgres_data_path }}-auto-upgrade-backup`, which was created during the last major Postgres update you ran. If your setup works well after this upgrade, feel free to delete this whole directory." ] }} - when: "matrix_postgres_enabled|bool and matrix_postgres_data_backup_path_stat.stat.exists" + when: "matrix_postgres_enabled | bool and matrix_postgres_data_backup_path_stat.stat.exists" # @@ -162,47 +162,47 @@ # - name: Check existence of matrix-postgres service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-postgres.service" register: matrix_postgres_service_stat - when: "not matrix_postgres_enabled|bool" + when: "not matrix_postgres_enabled | bool" - name: Ensure matrix-postgres is stopped ansible.builtin.service: name: matrix-postgres state: stopped daemon_reload: true - when: "not matrix_postgres_enabled|bool and matrix_postgres_service_stat.stat.exists" + when: "not matrix_postgres_enabled | bool and matrix_postgres_service_stat.stat.exists" - name: Ensure matrix-postgres.service doesn't exist ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-postgres.service" state: absent - when: "not matrix_postgres_enabled|bool and matrix_postgres_service_stat.stat.exists" + when: "not matrix_postgres_enabled | bool and matrix_postgres_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-postgres.service removal ansible.builtin.service: daemon_reload: true - when: "not matrix_postgres_enabled|bool and matrix_postgres_service_stat.stat.exists" + when: "not matrix_postgres_enabled | bool and matrix_postgres_service_stat.stat.exists" - name: Check existence of matrix-postgres local data path - stat: + ansible.builtin.stat: path: "{{ matrix_postgres_data_path }}" register: matrix_postgres_data_path_stat - when: "not matrix_postgres_enabled|bool" + when: "not matrix_postgres_enabled | bool" # We just want to notify the user. Deleting data is too destructive. - name: Inject warning if matrix-postgres local data remains ansible.builtin.set_fact: matrix_playbook_runtime_results: | {{ - matrix_playbook_runtime_results|default([]) + matrix_playbook_runtime_results | default([]) + [ "NOTE: You are not using a local PostgreSQL database, but some old data remains from before in `{{ matrix_postgres_data_path }}`. Feel free to delete it." ] }} - when: "not matrix_postgres_enabled|bool and matrix_postgres_data_path_stat.stat.exists" + when: "not matrix_postgres_enabled | bool and matrix_postgres_data_path_stat.stat.exists" - name: Remove Postgres scripts ansible.builtin.file: @@ -212,4 +212,4 @@ - matrix-postgres-cli - matrix-change-user-admin-status - matrix-postgres-update-user-password-hash - when: "not matrix_postgres_enabled|bool" + when: "not matrix_postgres_enabled | bool" diff --git a/roles/matrix-postgres/tasks/upgrade_postgres.yml b/roles/matrix-postgres/tasks/upgrade_postgres.yml index 012f292d..8e0d480d 100644 --- a/roles/matrix-postgres/tasks/upgrade_postgres.yml +++ b/roles/matrix-postgres/tasks/upgrade_postgres.yml @@ -3,35 +3,35 @@ - name: Set default postgres_dump_dir, if not provided ansible.builtin.set_fact: postgres_dump_dir: "/tmp" - when: "postgres_dump_dir|default('') == ''" + when: "postgres_dump_dir | default('') == ''" - name: Set postgres_dump_name, if not provided ansible.builtin.set_fact: postgres_dump_name: "matrix-postgres-dump.sql.gz" - when: "postgres_dump_name|default('') == ''" + when: "postgres_dump_name | default('') == ''" - name: Set postgres_auto_upgrade_backup_data_path, if not provided ansible.builtin.set_fact: postgres_auto_upgrade_backup_data_path: "{{ matrix_postgres_data_path }}-auto-upgrade-backup" - when: "postgres_auto_upgrade_backup_data_path|default('') == ''" + when: "postgres_auto_upgrade_backup_data_path | default('') == ''" - name: Set postgres_start_wait_time, if not provided ansible.builtin.set_fact: postgres_start_wait_time: 15 - when: "postgres_start_wait_time|default('') == ''" + when: "postgres_start_wait_time | default('') == ''" - name: Set postgres_force_upgrade, if not provided ansible.builtin.set_fact: postgres_force_upgrade: false - when: "postgres_force_upgrade|default('') == ''" + when: "postgres_force_upgrade | default('') == ''" - name: Fail, if trying to upgrade external Postgres database ansible.builtin.fail: msg: "Your configuration indicates that you're not using Postgres from this role. There is nothing to upgrade." - when: "not matrix_postgres_enabled|bool" + when: "not matrix_postgres_enabled | bool" - name: Check Postgres auto-upgrade backup data directory - stat: + ansible.builtin.stat: path: "{{ postgres_auto_upgrade_backup_data_path }}" register: result_auto_upgrade_path @@ -40,12 +40,12 @@ msg: "Detected that a left-over {{ postgres_auto_upgrade_backup_data_path }} exists. You should rename it to {{ matrix_postgres_data_path }} if the previous upgrade went wrong, or delete it if it went well." when: "result_auto_upgrade_path.stat.exists" -- import_tasks: tasks/util/detect_existing_postgres_version.yml +- ansible.builtin.import_tasks: tasks/util/detect_existing_postgres_version.yml - name: Abort, if no existing Postgres version detected ansible.builtin.fail: msg: "Could not find existing Postgres installation" - when: "not matrix_postgres_detected_existing|bool" + when: "not matrix_postgres_detected_existing | bool" - name: Abort, if already at latest Postgres version ansible.builtin.fail: @@ -67,7 +67,7 @@ daemon_reload: true - name: Wait a bit, so that Postgres can start - wait_for: + ansible.builtin.wait_for: timeout: "{{ postgres_start_wait_time }}" delegate_to: 127.0.0.1 become: false @@ -102,7 +102,7 @@ - ansible.builtin.debug: msg: "NOTE: Your Postgres data directory has been moved from `{{ matrix_postgres_data_path }}` to `{{ postgres_auto_upgrade_backup_data_path }}`. In the event of failure, you can move it back and run the playbook with --tags=setup-postgres to restore operation." -- import_tasks: tasks/setup_postgres.yml +- ansible.builtin.import_tasks: tasks/setup_postgres.yml - name: Ensure matrix-postgres autoruns and is restarted ansible.builtin.service: @@ -112,7 +112,7 @@ daemon_reload: true - name: Wait a bit, so that Postgres can start - wait_for: + ansible.builtin.wait_for: timeout: "{{ postgres_start_wait_time }}" delegate_to: 127.0.0.1 become: false diff --git a/roles/matrix-postgres/tasks/util/create_additional_databases.yml b/roles/matrix-postgres/tasks/util/create_additional_databases.yml index c1b5cd51..7fe5713e 100644 --- a/roles/matrix-postgres/tasks/util/create_additional_databases.yml +++ b/roles/matrix-postgres/tasks/util/create_additional_databases.yml @@ -8,14 +8,14 @@ register: matrix_postgres_service_start_result - name: Wait a bit, so that Postgres can start - wait_for: + ansible.builtin.wait_for: timeout: "{{ matrix_postgres_additional_databases_postgres_start_wait_timeout_seconds }}" delegate_to: 127.0.0.1 become: false - when: "matrix_postgres_service_start_result.changed|bool" + when: "matrix_postgres_service_start_result.changed | bool" - name: Create additional Postgres user and database - include_tasks: "{{ role_path }}/tasks/util/create_additional_database.yml" + ansible.builtin.include_tasks: "{{ role_path }}/tasks/util/create_additional_database.yml" with_items: "{{ matrix_postgres_additional_databases }}" loop_control: loop_var: additional_db diff --git a/roles/matrix-postgres/tasks/util/detect_existing_postgres_version.yml b/roles/matrix-postgres/tasks/util/detect_existing_postgres_version.yml index 932ca336..e19dfbea 100644 --- a/roles/matrix-postgres/tasks/util/detect_existing_postgres_version.yml +++ b/roles/matrix-postgres/tasks/util/detect_existing_postgres_version.yml @@ -11,7 +11,7 @@ matrix_postgres_detected_version_corresponding_docker_image: "" - name: Determine existing Postgres version (check PG_VERSION file) - stat: + ansible.builtin.stat: path: "{{ matrix_postgres_detection_pg_version_path }}" register: result_pg_version_stat @@ -23,12 +23,12 @@ ansible.builtin.slurp: src: "{{ matrix_postgres_detection_pg_version_path }}" register: result_pg_version - when: matrix_postgres_detected_existing|bool + when: matrix_postgres_detected_existing | bool - name: Determine existing Postgres version (make sense of PG_VERSION file) ansible.builtin.set_fact: matrix_postgres_detected_version: "{{ result_pg_version['content']|b64decode|replace('\n', '') }}" - when: matrix_postgres_detected_existing|bool + when: matrix_postgres_detected_existing | bool - name: Determine corresponding Docker image to detected version (assume default of latest) ansible.builtin.set_fact: diff --git a/roles/matrix-postgres/tasks/util/migrate_db_to_postgres.yml b/roles/matrix-postgres/tasks/util/migrate_db_to_postgres.yml index 7b1fb6aa..469eb86a 100644 --- a/roles/matrix-postgres/tasks/util/migrate_db_to_postgres.yml +++ b/roles/matrix-postgres/tasks/util/migrate_db_to_postgres.yml @@ -3,7 +3,7 @@ - name: Fail if Postgres not enabled ansible.builtin.fail: msg: "Postgres via the matrix-postgres role is not enabled (`matrix_postgres_enabled`). Cannot migrate." - when: "not matrix_postgres_enabled|bool" + when: "not matrix_postgres_enabled | bool" - name: Fail if util called incorrectly (missing matrix_postgres_db_migration_request) ansible.builtin.fail: @@ -22,7 +22,7 @@ when: "item not in matrix_postgres_db_migration_request" - name: Check if the provided source database file exists - stat: + ansible.builtin.stat: path: "{{ matrix_postgres_db_migration_request.src }}" register: matrix_postgres_db_migration_request_src_stat_result @@ -69,7 +69,7 @@ dockerfile: Dockerfile path: "{{ matrix_postgres_pgloader_container_image_self_build_src_path }}" pull: true - when: "matrix_postgres_pgloader_container_image_self_build|bool" + when: "matrix_postgres_pgloader_container_image_self_build | bool" - name: Ensure pgloader Docker image is pulled docker_image: @@ -84,7 +84,7 @@ - name: Set postgres_start_wait_time, if not provided ansible.builtin.set_fact: postgres_start_wait_time: 15 - when: "postgres_start_wait_time|default('') == ''" + when: "postgres_start_wait_time | default('') == ''" # Actual import work @@ -97,11 +97,11 @@ register: matrix_postgres_service_start_result - name: Wait a bit, so that Postgres can start - wait_for: + ansible.builtin.wait_for: timeout: "{{ postgres_start_wait_time }}" delegate_to: 127.0.0.1 become: false - when: "matrix_postgres_service_start_result.changed|bool" + when: "matrix_postgres_service_start_result.changed | bool" # We only stop services here, leaving it to the caller to start them later. # @@ -130,12 +130,12 @@ --entrypoint=/bin/sh {{ matrix_postgres_pgloader_docker_image }} -c - 'pgloader {{ matrix_postgres_db_migration_request.pgloader_options|default([])|join(' ') }} /in.db {{ matrix_postgres_db_migration_request.dst }}' + 'pgloader {{ matrix_postgres_db_migration_request.pgloader_options | default([]) | join(' ') }} /in.db {{ matrix_postgres_db_migration_request.dst }}' - block: # We can't use `{{ role_path }}` here, neither with `import_tasks`, nor with `include_tasks`, # because it refers to the role that included this util, and not to the role this file belongs to. - - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/detect_existing_postgres_version.yml" + - ansible.builtin.import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/detect_existing_postgres_version.yml" - ansible.builtin.set_fact: matrix_postgres_docker_image_to_use: "{{ matrix_postgres_docker_image_latest if matrix_postgres_detected_version_corresponding_docker_image == '' else matrix_postgres_detected_version_corresponding_docker_image }}" @@ -153,7 +153,7 @@ psql --host=matrix-postgres --dbname={{ matrix_postgres_db_migration_request.additional_psql_statements_db_name }} --command='{{ item }}' with_items: "{{ matrix_postgres_db_migration_request.additional_psql_statements_list }}" - when: "matrix_postgres_db_migration_request.additional_psql_statements_list|default([])|length > 0" + when: "matrix_postgres_db_migration_request.additional_psql_statements_list | default([])|length > 0" - name: Archive {{ matrix_postgres_db_migration_request.engine_old }} database ({{ matrix_postgres_db_migration_request.src }} -> {{ matrix_postgres_db_migration_request.src }}.backup) ansible.builtin.command: @@ -163,7 +163,7 @@ ansible.builtin.set_fact: matrix_playbook_runtime_results: | {{ - matrix_playbook_runtime_results|default([]) + matrix_playbook_runtime_results | default([]) + [ "NOTE: Your {{ matrix_postgres_db_migration_request.engine_old }} database file has been imported into Postgres. The original database file has been moved from `{{ matrix_postgres_db_migration_request.src }}` to `{{ matrix_postgres_db_migration_request.src }}.backup`. When you've confirmed that the import went well and everything works, you should be able to safely delete this file." diff --git a/roles/matrix-prometheus-node-exporter/tasks/init.yml b/roles/matrix-prometheus-node-exporter/tasks/init.yml index 4e53b0c3..51dd94f2 100644 --- a/roles/matrix-prometheus-node-exporter/tasks/init.yml +++ b/roles/matrix-prometheus-node-exporter/tasks/init.yml @@ -2,7 +2,7 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-prometheus-node-exporter.service'] }}" - when: matrix_prometheus_node_exporter_enabled|bool + when: matrix_prometheus_node_exporter_enabled | bool - block: - name: Fail if matrix-nginx-proxy role already executed @@ -12,13 +12,13 @@ but it's pointless since the matrix-nginx-proxy role had already executed. To fix this, please change the order of roles in your playbook, so that the matrix-nginx-proxy role would run after the matrix-prometheus-node-exporter role. - when: matrix_nginx_proxy_role_executed|default(False)|bool + when: matrix_nginx_proxy_role_executed | default(False) | bool - name: Generate node-exporter metrics proxying configuration for matrix-nginx-proxy (matrix.DOMAIN/metrics/node-exporter) ansible.builtin.set_fact: matrix_prometheus_node_exporter_nginx_metrics_configuration_block: | location /metrics/node-exporter { - {% if matrix_nginx_proxy_enabled|default(False) %} + {% if matrix_nginx_proxy_enabled | default(False) %} {# Use the embedded DNS resolver in Docker containers to discover the service #} resolver 127.0.0.11 valid=5s; set $backend "matrix-prometheus-node-exporter:9100"; @@ -34,8 +34,8 @@ ansible.builtin.set_fact: matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks: | {{ - matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks|default([]) + matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks | default([]) + [matrix_prometheus_node_exporter_nginx_metrics_configuration_block] }} - when: matrix_prometheus_node_exporter_enabled|bool and matrix_prometheus_node_exporter_metrics_proxying_enabled|bool + when: matrix_prometheus_node_exporter_enabled | bool and matrix_prometheus_node_exporter_metrics_proxying_enabled | bool diff --git a/roles/matrix-prometheus-node-exporter/tasks/main.yml b/roles/matrix-prometheus-node-exporter/tasks/main.yml index 71bbb8d7..81b0c702 100644 --- a/roles/matrix-prometheus-node-exporter/tasks/main.yml +++ b/roles/matrix-prometheus-node-exporter/tasks/main.yml @@ -1,10 +1,10 @@ --- -- import_tasks: "{{ role_path }}/tasks/init.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/init.yml" tags: - always -- import_tasks: "{{ role_path }}/tasks/setup.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup.yml" tags: - setup-all - setup-prometheus-node-exporter diff --git a/roles/matrix-prometheus-node-exporter/tasks/setup.yml b/roles/matrix-prometheus-node-exporter/tasks/setup.yml index ee2c1835..0c6e77fc 100644 --- a/roles/matrix-prometheus-node-exporter/tasks/setup.yml +++ b/roles/matrix-prometheus-node-exporter/tasks/setup.yml @@ -10,7 +10,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_prometheus_node_exporter_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_prometheus_node_exporter_docker_image_force_pull }}" - when: "matrix_prometheus_node_exporter_enabled|bool" + when: "matrix_prometheus_node_exporter_enabled | bool" register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -22,19 +22,19 @@ dest: "{{ matrix_systemd_path }}/matrix-prometheus-node-exporter.service" mode: 0644 register: matrix_prometheus_node_exporter_systemd_service_result - when: matrix_prometheus_node_exporter_enabled|bool + when: matrix_prometheus_node_exporter_enabled | bool - name: Ensure systemd reloaded after matrix-prometheus.service installation ansible.builtin.service: daemon_reload: true - when: "matrix_prometheus_node_exporter_enabled|bool and matrix_prometheus_node_exporter_systemd_service_result.changed" + when: "matrix_prometheus_node_exporter_enabled | bool and matrix_prometheus_node_exporter_systemd_service_result.changed" # # Tasks related to getting rid of matrix-prometheus-node-exporter (if it was previously enabled) # - name: Check existence of matrix-prometheus-node-exporter service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-prometheus-node-exporter.service" register: matrix_prometheus_node_exporter_service_stat @@ -45,15 +45,15 @@ enabled: false daemon_reload: true register: stopping_result - when: "not matrix_prometheus_node_exporter_enabled|bool and matrix_prometheus_node_exporter_service_stat.stat.exists" + when: "not matrix_prometheus_node_exporter_enabled | bool and matrix_prometheus_node_exporter_service_stat.stat.exists" - name: Ensure matrix-prometheus-node-exporter.service doesn't exist ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-prometheus-node-exporter.service" state: absent - when: "not matrix_prometheus_node_exporter_enabled|bool and matrix_prometheus_node_exporter_service_stat.stat.exists" + when: "not matrix_prometheus_node_exporter_enabled | bool and matrix_prometheus_node_exporter_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-prometheus-node-exporter.service removal ansible.builtin.service: daemon_reload: true - when: "not matrix_prometheus_node_exporter_enabled|bool and matrix_prometheus_node_exporter_service_stat.stat.exists" + when: "not matrix_prometheus_node_exporter_enabled | bool and matrix_prometheus_node_exporter_service_stat.stat.exists" diff --git a/roles/matrix-prometheus-postgres-exporter/tasks/init.yml b/roles/matrix-prometheus-postgres-exporter/tasks/init.yml index 3c7b5b01..6da16937 100644 --- a/roles/matrix-prometheus-postgres-exporter/tasks/init.yml +++ b/roles/matrix-prometheus-postgres-exporter/tasks/init.yml @@ -2,7 +2,7 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-prometheus-postgres-exporter.service'] }}" - when: matrix_prometheus_postgres_exporter_enabled|bool + when: matrix_prometheus_postgres_exporter_enabled | bool - block: - name: Fail if matrix-nginx-proxy role already executed @@ -12,13 +12,13 @@ but it's pointless since the matrix-nginx-proxy role had already executed. To fix this, please change the order of roles in your playbook, so that the matrix-nginx-proxy role would run after the matrix-prometheus-postgres-exporter role. - when: matrix_nginx_proxy_role_executed|default(False)|bool + when: matrix_nginx_proxy_role_executed | default(False) | bool - name: Generate postgres-exporter metrics proxying configuration for matrix-nginx-proxy (matrix.DOMAIN/metrics/postgres-exporter) ansible.builtin.set_fact: matrix_prometheus_postgres_exporter_nginx_metrics_configuration_block: | location /metrics/postgres-exporter { - {% if matrix_nginx_proxy_enabled|default(False) %} + {% if matrix_nginx_proxy_enabled | default(False) %} {# Use the embedded DNS resolver in Docker containers to discover the service #} resolver 127.0.0.11 valid=5s; set $backend "matrix-prometheus-postgres-exporter:9187"; @@ -34,8 +34,8 @@ ansible.builtin.set_fact: matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks: | {{ - matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks|default([]) + matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks | default([]) + [matrix_prometheus_postgres_exporter_nginx_metrics_configuration_block] }} - when: matrix_prometheus_node_exporter_enabled|bool and matrix_prometheus_node_exporter_metrics_proxying_enabled|bool + when: matrix_prometheus_node_exporter_enabled | bool and matrix_prometheus_node_exporter_metrics_proxying_enabled | bool diff --git a/roles/matrix-prometheus-postgres-exporter/tasks/main.yml b/roles/matrix-prometheus-postgres-exporter/tasks/main.yml index e9497099..43473587 100644 --- a/roles/matrix-prometheus-postgres-exporter/tasks/main.yml +++ b/roles/matrix-prometheus-postgres-exporter/tasks/main.yml @@ -1,10 +1,10 @@ --- -- import_tasks: "{{ role_path }}/tasks/init.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/init.yml" tags: - always -- import_tasks: "{{ role_path }}/tasks/setup.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup.yml" tags: - setup-all - setup-prometheus-postgres-exporter diff --git a/roles/matrix-prometheus-postgres-exporter/tasks/setup.yml b/roles/matrix-prometheus-postgres-exporter/tasks/setup.yml index 2c263eb2..00a61df6 100644 --- a/roles/matrix-prometheus-postgres-exporter/tasks/setup.yml +++ b/roles/matrix-prometheus-postgres-exporter/tasks/setup.yml @@ -10,7 +10,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_prometheus_postgres_exporter_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_prometheus_postgres_exporter_docker_image_force_pull }}" - when: "matrix_prometheus_postgres_exporter_enabled|bool" + when: "matrix_prometheus_postgres_exporter_enabled | bool" register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -22,19 +22,19 @@ dest: "{{ matrix_systemd_path }}/matrix-prometheus-postgres-exporter.service" mode: 0644 register: matrix_prometheus_postgres_exporter_systemd_service_result - when: matrix_prometheus_postgres_exporter_enabled|bool + when: matrix_prometheus_postgres_exporter_enabled | bool - name: Ensure systemd reloaded after matrix-prometheus.service installation ansible.builtin.service: daemon_reload: true - when: "matrix_prometheus_postgres_exporter_enabled|bool and matrix_prometheus_postgres_exporter_systemd_service_result.changed" + when: "matrix_prometheus_postgres_exporter_enabled | bool and matrix_prometheus_postgres_exporter_systemd_service_result.changed" # # Tasks related to getting rid of matrix-prometheus-postgres-exporter (if it was previously enabled) # - name: Check existence of matrix-prometheus-postgres-exporter service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-prometheus-postgres-exporter.service" register: matrix_prometheus_postgres_exporter_service_stat @@ -45,15 +45,15 @@ enabled: false daemon_reload: true register: stopping_result - when: "not matrix_prometheus_postgres_exporter_enabled|bool and matrix_prometheus_postgres_exporter_service_stat.stat.exists" + when: "not matrix_prometheus_postgres_exporter_enabled | bool and matrix_prometheus_postgres_exporter_service_stat.stat.exists" - name: Ensure matrix-prometheus-postgres-exporter.service doesn't exist ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-prometheus-postgres-exporter.service" state: absent - when: "not matrix_prometheus_postgres_exporter_enabled|bool and matrix_prometheus_postgres_exporter_service_stat.stat.exists" + when: "not matrix_prometheus_postgres_exporter_enabled | bool and matrix_prometheus_postgres_exporter_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-prometheus-postgres-exporter.service removal ansible.builtin.service: daemon_reload: true - when: "not matrix_prometheus_postgres_exporter_enabled|bool and matrix_prometheus_postgres_exporter_service_stat.stat.exists" + when: "not matrix_prometheus_postgres_exporter_enabled | bool and matrix_prometheus_postgres_exporter_service_stat.stat.exists" diff --git a/roles/matrix-prometheus/defaults/main.yml b/roles/matrix-prometheus/defaults/main.yml index 547a868f..aeb6ea6d 100644 --- a/roles/matrix-prometheus/defaults/main.yml +++ b/roles/matrix-prometheus/defaults/main.yml @@ -75,8 +75,8 @@ matrix_prometheus_configuration_extension_yaml: | # If you need something more special, you can take full control by # completely redefining `matrix_prometheus_configuration_yaml`. -matrix_prometheus_configuration_extension: "{{ matrix_prometheus_configuration_extension_yaml|from_yaml if matrix_prometheus_configuration_extension_yaml|from_yaml is mapping else {} }}" +matrix_prometheus_configuration_extension: "{{ matrix_prometheus_configuration_extension_yaml | from_yaml if matrix_prometheus_configuration_extension_yaml | from_yaml is mapping else {} }}" # Holds the final configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_prometheus_configuration_yaml`. -matrix_prometheus_configuration: "{{ matrix_prometheus_configuration_yaml|from_yaml|combine(matrix_prometheus_configuration_extension, recursive=True) }}" +matrix_prometheus_configuration: "{{ matrix_prometheus_configuration_yaml | from_yaml|combine(matrix_prometheus_configuration_extension, recursive=True) }}" diff --git a/roles/matrix-prometheus/tasks/init.yml b/roles/matrix-prometheus/tasks/init.yml index 946410e3..29853673 100644 --- a/roles/matrix-prometheus/tasks/init.yml +++ b/roles/matrix-prometheus/tasks/init.yml @@ -2,4 +2,4 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-prometheus.service'] }}" - when: matrix_prometheus_enabled|bool + when: matrix_prometheus_enabled | bool diff --git a/roles/matrix-prometheus/tasks/main.yml b/roles/matrix-prometheus/tasks/main.yml index c74918fa..1a5a3708 100644 --- a/roles/matrix-prometheus/tasks/main.yml +++ b/roles/matrix-prometheus/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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_prometheus_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_prometheus_enabled | bool" tags: - setup-all - setup-prometheus -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_prometheus_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_prometheus_enabled | bool" tags: - setup-all - setup-prometheus -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_prometheus_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_prometheus_enabled | bool" tags: - setup-all - setup-prometheus diff --git a/roles/matrix-prometheus/tasks/setup_install.yml b/roles/matrix-prometheus/tasks/setup_install.yml index ad2b94aa..c3aeaa7a 100644 --- a/roles/matrix-prometheus/tasks/setup_install.yml +++ b/roles/matrix-prometheus/tasks/setup_install.yml @@ -31,7 +31,7 @@ mode: 0440 owner: "{{ matrix_user_username }}" group: "{{ matrix_user_groupname }}" - when: "matrix_prometheus_scraper_synapse_rules_enabled|bool" + when: "matrix_prometheus_scraper_synapse_rules_enabled | bool" register: result retries: "{{ matrix_geturl_retries_count }}" delay: "{{ matrix_geturl_retries_delay }}" @@ -39,7 +39,7 @@ - name: Ensure prometheus.yml installed ansible.builtin.copy: - content: "{{ matrix_prometheus_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_prometheus_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_prometheus_config_path }}/prometheus.yml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -55,4 +55,4 @@ - name: Ensure systemd reloaded after matrix-prometheus.service installation ansible.builtin.service: daemon_reload: true - when: "matrix_prometheus_systemd_service_result.changed|bool" + when: "matrix_prometheus_systemd_service_result.changed | bool" diff --git a/roles/matrix-prometheus/tasks/setup_uninstall.yml b/roles/matrix-prometheus/tasks/setup_uninstall.yml index f1a62481..7dd94459 100644 --- a/roles/matrix-prometheus/tasks/setup_uninstall.yml +++ b/roles/matrix-prometheus/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-prometheus service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-prometheus.service" register: matrix_prometheus_service_stat @@ -12,15 +12,15 @@ enabled: false daemon_reload: true register: stopping_result - when: "matrix_prometheus_service_stat.stat.exists|bool" + when: "matrix_prometheus_service_stat.stat.exists | bool" - name: Ensure matrix-prometheus.service doesn't exist ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-prometheus.service" state: absent - when: "matrix_prometheus_service_stat.stat.exists|bool" + when: "matrix_prometheus_service_stat.stat.exists | bool" - name: Ensure systemd reloaded after matrix-prometheus.service removal ansible.builtin.service: daemon_reload: true - when: "matrix_prometheus_service_stat.stat.exists|bool" + when: "matrix_prometheus_service_stat.stat.exists | bool" diff --git a/roles/matrix-redis/tasks/init.yml b/roles/matrix-redis/tasks/init.yml index 08d7ec5a..00154b33 100644 --- a/roles/matrix-redis/tasks/init.yml +++ b/roles/matrix-redis/tasks/init.yml @@ -2,4 +2,4 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-redis'] }}" - when: matrix_redis_enabled|bool + when: matrix_redis_enabled | bool diff --git a/roles/matrix-redis/tasks/main.yml b/roles/matrix-redis/tasks/main.yml index 430b6a64..1bcac7d6 100644 --- a/roles/matrix-redis/tasks/main.yml +++ b/roles/matrix-redis/tasks/main.yml @@ -1,11 +1,11 @@ --- -- import_tasks: "{{ role_path }}/tasks/init.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/init.yml" tags: - always -- import_tasks: "{{ role_path }}/tasks/setup_redis.yml" - when: run_setup|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_redis.yml" + when: run_setup | bool tags: - setup-all - setup-redis diff --git a/roles/matrix-redis/tasks/setup_redis.yml b/roles/matrix-redis/tasks/setup_redis.yml index 7ff55552..7dd7ea9f 100644 --- a/roles/matrix-redis/tasks/setup_redis.yml +++ b/roles/matrix-redis/tasks/setup_redis.yml @@ -10,7 +10,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_redis_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_redis_docker_image_force_pull }}" - when: matrix_redis_enabled|bool + when: matrix_redis_enabled | bool register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -26,7 +26,7 @@ with_items: - "{{ matrix_redis_base_path }}" - "{{ matrix_redis_data_path }}" - when: matrix_redis_enabled|bool + when: matrix_redis_enabled | bool # We do this as a separate task, because: # - we'd like to do it for the data path only, not for the base path (which contains root-owned environment variable files we'd like to leave as-is) @@ -38,7 +38,7 @@ owner: "{{ matrix_user_username }}" group: "{{ matrix_user_username }}" recurse: true - when: matrix_redis_enabled|bool + when: matrix_redis_enabled | bool - name: Ensure redis environment variables file created ansible.builtin.template: @@ -47,7 +47,7 @@ mode: 0644 with_items: - "redis.conf" - when: matrix_redis_enabled|bool + when: matrix_redis_enabled | bool - name: Ensure matrix-redis.service installed ansible.builtin.template: @@ -55,22 +55,22 @@ dest: "{{ matrix_systemd_path }}/matrix-redis.service" mode: 0644 register: matrix_redis_systemd_service_result - when: matrix_redis_enabled|bool + when: matrix_redis_enabled | bool - name: Ensure systemd reloaded after matrix-redis.service installation ansible.builtin.service: daemon_reload: true - when: "matrix_redis_enabled|bool and matrix_redis_systemd_service_result.changed" + when: "matrix_redis_enabled | bool and matrix_redis_systemd_service_result.changed" # # Tasks related to getting rid of the internal redis server (if it was previously enabled) # - name: Check existence of matrix-redis service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-redis.service" register: matrix_redis_service_stat - when: "not matrix_redis_enabled|bool" + when: "not matrix_redis_enabled | bool" - name: Ensure matrix-redis is stopped ansible.builtin.service: @@ -78,27 +78,27 @@ state: stopped enabled: false daemon_reload: true - when: "not matrix_redis_enabled|bool and matrix_redis_service_stat.stat.exists" + when: "not matrix_redis_enabled | bool and matrix_redis_service_stat.stat.exists" - name: Ensure matrix-redis.service doesn't exist ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-redis.service" state: absent - when: "not matrix_redis_enabled|bool and matrix_redis_service_stat.stat.exists" + when: "not matrix_redis_enabled | bool and matrix_redis_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-redis.service removal ansible.builtin.service: daemon_reload: true - when: "not matrix_redis_enabled|bool and matrix_redis_service_stat.stat.exists" + when: "not matrix_redis_enabled | bool and matrix_redis_service_stat.stat.exists" - name: Check existence of matrix-redis local data path - stat: + ansible.builtin.stat: path: "{{ matrix_redis_data_path }}" register: matrix_redis_data_path_stat - when: "not matrix_redis_enabled|bool" + when: "not matrix_redis_enabled | bool" # We just want to notify the user. Deleting data is too destructive. - name: Notify if matrix-redis local data remains ansible.builtin.debug: msg: "Note: You are not using a local redis instance, but some old data remains from before in `{{ matrix_redis_data_path }}`. Feel free to delete it." - when: "not matrix_redis_enabled|bool and matrix_redis_data_path_stat.stat.exists" + when: "not matrix_redis_enabled | bool and matrix_redis_data_path_stat.stat.exists" diff --git a/roles/matrix-registration/defaults/main.yml b/roles/matrix-registration/defaults/main.yml index 9f4c673c..060f51a2 100644 --- a/roles/matrix-registration/defaults/main.yml +++ b/roles/matrix-registration/defaults/main.yml @@ -115,8 +115,8 @@ matrix_registration_configuration_extension_yaml: | # password: # min_length: 12 -matrix_registration_configuration_extension: "{{ matrix_registration_configuration_extension_yaml|from_yaml if matrix_registration_configuration_extension_yaml|from_yaml is mapping else {} }}" +matrix_registration_configuration_extension: "{{ matrix_registration_configuration_extension_yaml | from_yaml if matrix_registration_configuration_extension_yaml | from_yaml is mapping else {} }}" # Holds the final matrix-registration configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_registration_configuration_yaml`. -matrix_registration_configuration: "{{ matrix_registration_configuration_yaml|from_yaml|combine(matrix_registration_configuration_extension, recursive=True) }}" +matrix_registration_configuration: "{{ matrix_registration_configuration_yaml | from_yaml|combine(matrix_registration_configuration_extension, recursive=True) }}" diff --git a/roles/matrix-registration/tasks/generate_token.yml b/roles/matrix-registration/tasks/generate_token.yml index 4b01957c..c910bf63 100644 --- a/roles/matrix-registration/tasks/generate_token.yml +++ b/roles/matrix-registration/tasks/generate_token.yml @@ -23,7 +23,7 @@ body: | { "one_time": {{ 'true' if one_time == 'yes' else 'false' }}, - "ex_date": {{ ex_date|to_json }} + "ex_date": {{ ex_date | to_json }} } check_mode: false register: matrix_registration_api_result @@ -45,7 +45,7 @@ ansible.builtin.set_fact: matrix_playbook_runtime_results: | {{ - matrix_playbook_runtime_results|default([]) + matrix_playbook_runtime_results | default([]) + [matrix_registration_api_result_message] }} diff --git a/roles/matrix-registration/tasks/init.yml b/roles/matrix-registration/tasks/init.yml index 5267f2b2..064f895c 100644 --- a/roles/matrix-registration/tasks/init.yml +++ b/roles/matrix-registration/tasks/init.yml @@ -8,7 +8,7 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-registration.service'] }}" - when: matrix_registration_enabled|bool + when: matrix_registration_enabled | bool - block: - name: Fail if matrix-nginx-proxy role already executed @@ -18,7 +18,7 @@ but it's pointless since the matrix-nginx-proxy role had already executed. To fix this, please change the order of roles in your playbook, so that the matrix-nginx-proxy role would run after the matrix-registration role. - when: matrix_nginx_proxy_role_executed|default(False)|bool + when: matrix_nginx_proxy_role_executed | default(False) | bool - name: Generate matrix-registration proxying configuration for matrix-nginx-proxy ansible.builtin.set_fact: @@ -27,7 +27,7 @@ rewrite ^{{ matrix_registration_public_endpoint }}/$ {{ matrix_nginx_proxy_x_forwarded_proto_value }}://$server_name{{ matrix_registration_public_endpoint }}/register redirect; location ~ ^{{ matrix_registration_public_endpoint }}/(.*) { - {% if matrix_nginx_proxy_enabled|default(False) %} + {% if matrix_nginx_proxy_enabled | default(False) %} {# Use the embedded DNS resolver in Docker containers to discover the service #} resolver 127.0.0.11 valid=5s; set $backend "matrix-registration:5000"; @@ -50,13 +50,13 @@ ansible.builtin.set_fact: matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: | {{ - matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([]) + matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks | default([]) + [matrix_registration_matrix_nginx_proxy_configuration] }} tags: - always - when: matrix_registration_enabled|bool + when: matrix_registration_enabled | bool - name: Warn about reverse-proxying if matrix-nginx-proxy not used ansible.builtin.debug: @@ -66,4 +66,4 @@ Please make sure that you're proxying the `{{ matrix_registration_public_endpoint }}` URL endpoint to the matrix-registration container. You can expose the container's port using the `matrix_registration_container_http_host_bind_port` variable. - when: "matrix_registration_enabled|bool and not matrix_nginx_proxy_enabled|default(False)|bool" + when: "matrix_registration_enabled | bool and not matrix_nginx_proxy_enabled | default(False) | bool" diff --git a/roles/matrix-registration/tasks/list_tokens.yml b/roles/matrix-registration/tasks/list_tokens.yml index d83d2976..4bcd1460 100644 --- a/roles/matrix-registration/tasks/list_tokens.yml +++ b/roles/matrix-registration/tasks/list_tokens.yml @@ -24,7 +24,7 @@ ansible.builtin.set_fact: matrix_playbook_runtime_results: | {{ - matrix_playbook_runtime_results|default([]) + matrix_playbook_runtime_results | default([]) + [matrix_registration_api_result_message] }} diff --git a/roles/matrix-registration/tasks/main.yml b/roles/matrix-registration/tasks/main.yml index ca574384..99b89e3d 100644 --- a/roles/matrix-registration/tasks/main.yml +++ b/roles/matrix-registration/tasks/main.yml @@ -1,33 +1,33 @@ --- -- 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_registration_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: "run_setup | bool and matrix_registration_enabled | bool" tags: - setup-all - setup-matrix-registration -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: "run_setup|bool and matrix_registration_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: "run_setup | bool and matrix_registration_enabled | bool" tags: - setup-all - setup-matrix-registration -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: "run_setup|bool and not matrix_registration_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: "run_setup | bool and not matrix_registration_enabled | bool" tags: - setup-all - setup-matrix-registration -- import_tasks: "{{ role_path }}/tasks/generate_token.yml" - when: "run_setup|bool and matrix_registration_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/generate_token.yml" + when: "run_setup | bool and matrix_registration_enabled | bool" tags: - generate-matrix-registration-token -- import_tasks: "{{ role_path }}/tasks/list_tokens.yml" - when: "run_setup|bool and matrix_registration_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/list_tokens.yml" + when: "run_setup | bool and matrix_registration_enabled | bool" tags: - list-matrix-registration-tokens diff --git a/roles/matrix-registration/tasks/setup_install.yml b/roles/matrix-registration/tasks/setup_install.yml index 3a8e71e7..dbdb4aea 100644 --- a/roles/matrix-registration/tasks/setup_install.yml +++ b/roles/matrix-registration/tasks/setup_install.yml @@ -5,7 +5,7 @@ - block: - name: Check if an SQLite database already exists - stat: + ansible.builtin.stat: path: "{{ matrix_registration_sqlite_database_path_local }}" register: matrix_registration_sqlite_database_path_local_stat_result @@ -14,7 +14,7 @@ matrix_postgres_db_migration_request: src: "{{ matrix_registration_sqlite_database_path_local }}" dst: "{{ matrix_registration_database_connection_string }}" - caller: "{{ role_path|basename }}" + caller: "{{ role_path | basename }}" engine_variable_name: 'matrix_registration_database_engine' engine_old: 'sqlite' systemd_services_to_stop: ['matrix-registration.service'] @@ -24,11 +24,11 @@ - ALTER TABLE tokens ALTER COLUMN ex_date TYPE TIMESTAMP WITHOUT TIME ZONE; additional_psql_statements_db_name: "{{ matrix_registration_database_name }}" - - 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_registration_requires_restart: true - when: "matrix_registration_sqlite_database_path_local_stat_result.stat.exists|bool" + when: "matrix_registration_sqlite_database_path_local_stat_result.stat.exists | bool" when: "matrix_registration_database_engine == 'postgres'" - name: Ensure matrix-registration paths exist @@ -43,7 +43,7 @@ - {path: "{{ matrix_registration_config_path }}", when: true} - {path: "{{ matrix_registration_data_path }}", when: true} - {path: "{{ matrix_registration_docker_src_files_path }}", when: "{{ matrix_registration_container_image_self_build }}"} - when: "item.when|bool" + when: "item.when | bool" - name: Ensure matrix-registration image is pulled docker_image: @@ -51,7 +51,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_registration_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_registration_docker_image_force_pull }}" - when: "not matrix_registration_container_image_self_build|bool" + when: "not matrix_registration_container_image_self_build | bool" register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -66,7 +66,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_registration_git_pull_results - when: "matrix_registration_container_image_self_build|bool" + when: "matrix_registration_container_image_self_build | bool" # See: https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1864 - name: Patch setup.py to allow self-built version to work @@ -74,7 +74,7 @@ path: "{{ matrix_registration_docker_src_files_path }}/setup.py" regexp: 'flask-limiter' line: '"flask-limiter~=1.1.0", "Markupsafe<2.1",' - when: "matrix_registration_container_image_self_build|bool and matrix_registration_container_image_self_build_python_dependencies_patch_enabled|bool" + when: "matrix_registration_container_image_self_build | bool and matrix_registration_container_image_self_build_python_dependencies_patch_enabled | bool" - name: Ensure matrix-registration Docker image is built docker_image: @@ -86,11 +86,11 @@ dockerfile: Dockerfile path: "{{ matrix_registration_docker_src_files_path }}" pull: true - when: "matrix_registration_container_image_self_build|bool" + when: "matrix_registration_container_image_self_build | bool" - name: Ensure matrix-registration config installed ansible.builtin.copy: - content: "{{ matrix_registration_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_registration_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_registration_config_path }}/config.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -106,10 +106,10 @@ - name: Ensure systemd reloaded after matrix-registration.service installation ansible.builtin.service: daemon_reload: true - when: "matrix_registration_systemd_service_result.changed|bool" + when: "matrix_registration_systemd_service_result.changed | bool" - name: Ensure matrix-registration.service restarted, if necessary ansible.builtin.service: name: "matrix-registration.service" state: restarted - when: "matrix_registration_requires_restart|bool" + when: "matrix_registration_requires_restart | bool" diff --git a/roles/matrix-registration/tasks/setup_uninstall.yml b/roles/matrix-registration/tasks/setup_uninstall.yml index 54f5483b..e3d713dc 100644 --- a/roles/matrix-registration/tasks/setup_uninstall.yml +++ b/roles/matrix-registration/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-registration service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-registration.service" register: matrix_registration_service_stat @@ -12,18 +12,18 @@ enabled: false daemon_reload: true register: stopping_result - when: "matrix_registration_service_stat.stat.exists|bool" + when: "matrix_registration_service_stat.stat.exists | bool" - name: Ensure matrix-registration.service doesn't exist ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-registration.service" state: absent - when: "matrix_registration_service_stat.stat.exists|bool" + when: "matrix_registration_service_stat.stat.exists | bool" - name: Ensure systemd reloaded after matrix-registration.service removal ansible.builtin.service: daemon_reload: true - when: "matrix_registration_service_stat.stat.exists|bool" + when: "matrix_registration_service_stat.stat.exists | bool" - name: Ensure matrix-registration Docker image doesn't exist docker_image: diff --git a/roles/matrix-sygnal/defaults/main.yml b/roles/matrix-sygnal/defaults/main.yml index b19ce614..2c0f3a86 100644 --- a/roles/matrix-sygnal/defaults/main.yml +++ b/roles/matrix-sygnal/defaults/main.yml @@ -69,8 +69,8 @@ matrix_sygnal_configuration_extension_yaml: | # opentracing: # enabled: true -matrix_sygnal_configuration_extension: "{{ matrix_sygnal_configuration_extension_yaml|from_yaml if matrix_sygnal_configuration_extension_yaml|from_yaml is mapping else {} }}" +matrix_sygnal_configuration_extension: "{{ matrix_sygnal_configuration_extension_yaml | from_yaml if matrix_sygnal_configuration_extension_yaml | from_yaml is mapping else {} }}" # Holds the final sygnal configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_sygnal_configuration_yaml`. -matrix_sygnal_configuration: "{{ matrix_sygnal_configuration_yaml|from_yaml|combine(matrix_sygnal_configuration_extension, recursive=True) }}" +matrix_sygnal_configuration: "{{ matrix_sygnal_configuration_yaml | from_yaml|combine(matrix_sygnal_configuration_extension, recursive=True) }}" diff --git a/roles/matrix-sygnal/tasks/init.yml b/roles/matrix-sygnal/tasks/init.yml index 1543435c..dae7a299 100644 --- a/roles/matrix-sygnal/tasks/init.yml +++ b/roles/matrix-sygnal/tasks/init.yml @@ -2,4 +2,4 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-sygnal.service'] }}" - when: matrix_sygnal_enabled|bool + when: matrix_sygnal_enabled | bool diff --git a/roles/matrix-sygnal/tasks/main.yml b/roles/matrix-sygnal/tasks/main.yml index 38579822..b001bb82 100644 --- a/roles/matrix-sygnal/tasks/main.yml +++ b/roles/matrix-sygnal/tasks/main.yml @@ -1,23 +1,23 @@ --- -- 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 +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: run_setup | bool tags: - setup-all - setup-sygnal -- import_tasks: "{{ role_path }}/tasks/setup_install.yml" - when: run_setup|bool and matrix_sygnal_enabled|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml" + when: run_setup | bool and matrix_sygnal_enabled | bool tags: - setup-all - setup-sygnal -- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" - when: run_setup|bool and not matrix_sygnal_enabled|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" + when: run_setup | bool and not matrix_sygnal_enabled | bool tags: - setup-all - setup-sygnal diff --git a/roles/matrix-sygnal/tasks/setup_install.yml b/roles/matrix-sygnal/tasks/setup_install.yml index 26b59d99..8f5f6937 100644 --- a/roles/matrix-sygnal/tasks/setup_install.yml +++ b/roles/matrix-sygnal/tasks/setup_install.yml @@ -25,7 +25,7 @@ - name: Ensure Sygnal config installed ansible.builtin.copy: - content: "{{ matrix_sygnal_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_sygnal_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_sygnal_config_path }}/sygnal.yaml" mode: 0640 owner: "{{ matrix_user_username }}" @@ -41,4 +41,4 @@ - name: Ensure systemd reloaded after matrix-sygnal.service installation ansible.builtin.service: daemon_reload: true - when: "matrix_sygnal_systemd_service_result.changed|bool" + when: "matrix_sygnal_systemd_service_result.changed | bool" diff --git a/roles/matrix-sygnal/tasks/setup_uninstall.yml b/roles/matrix-sygnal/tasks/setup_uninstall.yml index 37b7db22..eff4a74b 100644 --- a/roles/matrix-sygnal/tasks/setup_uninstall.yml +++ b/roles/matrix-sygnal/tasks/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-sygnal service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-sygnal.service" register: matrix_sygnal_service_stat @@ -12,18 +12,18 @@ enabled: false daemon_reload: true register: stopping_result - when: "matrix_sygnal_service_stat.stat.exists|bool" + when: "matrix_sygnal_service_stat.stat.exists | bool" - name: Ensure matrix-sygnal.service doesn't exist ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-sygnal.service" state: absent - when: "matrix_sygnal_service_stat.stat.exists|bool" + when: "matrix_sygnal_service_stat.stat.exists | bool" - name: Ensure systemd reloaded after matrix-sygnal.service removal ansible.builtin.service: daemon_reload: true - when: "matrix_sygnal_service_stat.stat.exists|bool" + when: "matrix_sygnal_service_stat.stat.exists | bool" - name: Ensure Sygnal base directory doesn't exist ansible.builtin.file: diff --git a/roles/matrix-synapse-admin/tasks/init.yml b/roles/matrix-synapse-admin/tasks/init.yml index e274e186..4d8a5eb0 100644 --- a/roles/matrix-synapse-admin/tasks/init.yml +++ b/roles/matrix-synapse-admin/tasks/init.yml @@ -8,7 +8,7 @@ - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-synapse-admin.service'] }}" - when: matrix_synapse_admin_enabled|bool + when: matrix_synapse_admin_enabled | bool - block: - name: Fail if matrix-nginx-proxy role already executed @@ -18,7 +18,7 @@ but it's pointless since the matrix-nginx-proxy role had already executed. To fix this, please change the order of roles in your playbook, so that the matrix-nginx-proxy role would run after the matrix-synapse-admin role. - when: matrix_nginx_proxy_role_executed|default(False)|bool + when: matrix_nginx_proxy_role_executed | default(False) | bool - name: Generate Synapse Admin proxying configuration for matrix-nginx-proxy ansible.builtin.set_fact: @@ -26,7 +26,7 @@ rewrite ^{{ matrix_synapse_admin_public_endpoint }}$ {{ matrix_nginx_proxy_x_forwarded_proto_value }}://$server_name{{ matrix_synapse_admin_public_endpoint }}/ permanent; location ~ ^{{ matrix_synapse_admin_public_endpoint }}/(.*) { - {% if matrix_nginx_proxy_enabled|default(False) %} + {% if matrix_nginx_proxy_enabled | default(False) %} {# Use the embedded DNS resolver in Docker containers to discover the service #} resolver 127.0.0.11 valid=5s; set $backend "matrix-synapse-admin:80"; @@ -41,13 +41,13 @@ ansible.builtin.set_fact: matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: | {{ - matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([]) + matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks | default([]) + [matrix_synapse_admin_matrix_nginx_proxy_configuration] }} tags: - always - when: matrix_synapse_admin_enabled|bool + when: matrix_synapse_admin_enabled | bool - name: Warn about reverse-proxying if matrix-nginx-proxy not used ansible.builtin.debug: @@ -57,4 +57,4 @@ Please make sure that you're proxying the `{{ matrix_synapse_admin_public_endpoint }}` URL endpoint to the matrix-synapse-admin container. You can expose the container's port using the `matrix_synapse_admin_container_http_host_bind_port` variable. - when: "matrix_synapse_admin_enabled|bool and not matrix_nginx_proxy_enabled|default(False)|bool" + when: "matrix_synapse_admin_enabled | bool and not matrix_nginx_proxy_enabled | default(False) | bool" diff --git a/roles/matrix-synapse-admin/tasks/main.yml b/roles/matrix-synapse-admin/tasks/main.yml index 0095f753..0c6bd942 100644 --- a/roles/matrix-synapse-admin/tasks/main.yml +++ b/roles/matrix-synapse-admin/tasks/main.yml @@ -1,16 +1,16 @@ --- -- 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 +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: run_setup | bool tags: - setup-all - setup-synapse-admin -- import_tasks: "{{ role_path }}/tasks/setup.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup.yml" tags: - setup-all - setup-synapse-admin diff --git a/roles/matrix-synapse-admin/tasks/setup.yml b/roles/matrix-synapse-admin/tasks/setup.yml index 5f117a12..66021272 100644 --- a/roles/matrix-synapse-admin/tasks/setup.yml +++ b/roles/matrix-synapse-admin/tasks/setup.yml @@ -10,7 +10,7 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_synapse_admin_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_synapse_admin_docker_image_force_pull }}" - when: "matrix_synapse_admin_enabled|bool and not matrix_synapse_admin_container_image_self_build|bool" + when: "matrix_synapse_admin_enabled | bool and not matrix_synapse_admin_container_image_self_build | bool" register: result retries: "{{ matrix_container_retries_count }}" delay: "{{ matrix_container_retries_delay }}" @@ -25,7 +25,7 @@ become: true become_user: "{{ matrix_user_username }}" register: matrix_synapse_admin_git_pull_results - when: "matrix_synapse_admin_enabled|bool and matrix_synapse_admin_container_image_self_build|bool" + when: "matrix_synapse_admin_enabled | bool and matrix_synapse_admin_container_image_self_build | bool" - name: Ensure matrix-synapse-admin Docker image is built docker_image: @@ -37,7 +37,7 @@ dockerfile: Dockerfile path: "{{ matrix_synapse_admin_docker_src_files_path }}" pull: true - when: "matrix_synapse_admin_enabled|bool and matrix_synapse_admin_container_image_self_build|bool" + when: "matrix_synapse_admin_enabled | bool and matrix_synapse_admin_container_image_self_build | bool" - name: Ensure matrix-synapse-admin.service installed ansible.builtin.template: @@ -45,19 +45,19 @@ dest: "{{ matrix_systemd_path }}/matrix-synapse-admin.service" mode: 0644 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-synapse-admin.service installation ansible.builtin.service: daemon_reload: true - 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" # # Tasks related to getting rid of matrix-synapse-admin (if it was previously enabled) # - name: Check existence of matrix-synapse-admin service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-synapse-admin.service" register: matrix_synapse_admin_service_stat @@ -68,21 +68,21 @@ enabled: false daemon_reload: true 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-synapse-admin.service doesn't exist ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-synapse-admin.service" 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-synapse-admin.service removal ansible.builtin.service: daemon_reload: true - 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-synapse-admin Docker image doesn't exist docker_image: name: "{{ matrix_synapse_admin_docker_image }}" state: absent - when: "not matrix_synapse_admin_enabled|bool" + when: "not matrix_synapse_admin_enabled | bool" diff --git a/roles/matrix-synapse/defaults/main.yml b/roles/matrix-synapse/defaults/main.yml index de8bfdca..279730bf 100644 --- a/roles/matrix-synapse/defaults/main.yml +++ b/roles/matrix-synapse/defaults/main.yml @@ -521,11 +521,11 @@ matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret: "" matrix_synapse_ext_password_provider_shared_secret_auth_m_login_password_support_enabled: true # We'd like to enable this, but it causes trouble for Element: https://github.com/vector-im/element-web/issues/19605 matrix_synapse_ext_password_provider_shared_secret_auth_com_devture_shared_secret_auth_support_enabled: false -matrix_synapse_ext_password_provider_shared_secret_config: "{{ matrix_synapse_ext_password_provider_shared_secret_config_yaml|from_yaml }}" +matrix_synapse_ext_password_provider_shared_secret_config: "{{ matrix_synapse_ext_password_provider_shared_secret_config_yaml | from_yaml }}" matrix_synapse_ext_password_provider_shared_secret_config_yaml: | - shared_secret: {{ matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret|string|to_json }} - m_login_password_support_enabled: {{ matrix_synapse_ext_password_provider_shared_secret_auth_m_login_password_support_enabled|to_json }} - com_devture_shared_secret_auth_support_enabled: {{ matrix_synapse_ext_password_provider_shared_secret_auth_com_devture_shared_secret_auth_support_enabled|to_json }} + shared_secret: {{ matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret|string | to_json }} + m_login_password_support_enabled: {{ matrix_synapse_ext_password_provider_shared_secret_auth_m_login_password_support_enabled | to_json }} + com_devture_shared_secret_auth_support_enabled: {{ matrix_synapse_ext_password_provider_shared_secret_auth_com_devture_shared_secret_auth_support_enabled | to_json }} # Enable this to activate LDAP password provider matrix_synapse_ext_password_provider_ldap_enabled: false @@ -586,11 +586,11 @@ matrix_synapse_ext_encryption_disabler_deny_encryption_for_rooms_of: ["{{ matrix # Enabling this may have incompatiblity consequences with servers / clients. # Familiarize yourself with the caveats upstream: https://github.com/digitalentity/matrix_encryption_disabler matrix_synapse_ext_encryption_disabler_patch_power_levels: false -matrix_synapse_ext_encryption_config: "{{ matrix_synapse_ext_encryption_config_yaml|from_yaml }}" +matrix_synapse_ext_encryption_config: "{{ matrix_synapse_ext_encryption_config_yaml | from_yaml }}" matrix_synapse_ext_encryption_config_yaml: | - deny_encryption_for_users_of: {{ matrix_synapse_ext_encryption_disabler_deny_encryption_for_users_of|to_json }} - deny_encryption_for_rooms_of: {{ matrix_synapse_ext_encryption_disabler_deny_encryption_for_rooms_of|to_json }} - patch_power_levels: {{ matrix_synapse_ext_encryption_disabler_patch_power_levels|to_json }} + deny_encryption_for_users_of: {{ matrix_synapse_ext_encryption_disabler_deny_encryption_for_users_of | to_json }} + deny_encryption_for_rooms_of: {{ matrix_synapse_ext_encryption_disabler_deny_encryption_for_rooms_of | to_json }} + patch_power_levels: {{ matrix_synapse_ext_encryption_disabler_patch_power_levels | to_json }} matrix_s3_media_store_enabled: false @@ -678,8 +678,8 @@ matrix_synapse_configuration_extension_yaml: | # system_mxid_avatar_url: "mxc://server.com/oumMVlgDnLYFaPVkExemNVVZ" # room_name: "Server Notices" -matrix_synapse_configuration_extension: "{{ matrix_synapse_configuration_extension_yaml|from_yaml if matrix_synapse_configuration_extension_yaml|from_yaml is mapping else {} }}" +matrix_synapse_configuration_extension: "{{ matrix_synapse_configuration_extension_yaml | from_yaml if matrix_synapse_configuration_extension_yaml | from_yaml is mapping else {} }}" # Holds the final Synapse configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_synapse_configuration_yaml`. -matrix_synapse_configuration: "{{ matrix_synapse_configuration_yaml|from_yaml|combine(matrix_synapse_configuration_extension, recursive=True) }}" +matrix_synapse_configuration: "{{ matrix_synapse_configuration_yaml | from_yaml|combine(matrix_synapse_configuration_extension, recursive=True) }}" diff --git a/roles/matrix-synapse/tasks/ext/encryption-disabler/setup.yml b/roles/matrix-synapse/tasks/ext/encryption-disabler/setup.yml index 8fda082d..e0e61df8 100644 --- a/roles/matrix-synapse/tasks/ext/encryption-disabler/setup.yml +++ b/roles/matrix-synapse/tasks/ext/encryption-disabler/setup.yml @@ -1,7 +1,7 @@ --- -- import_tasks: "{{ role_path }}/tasks/ext/encryption-disabler/setup_install.yml" - when: matrix_synapse_ext_encryption_disabler_enabled|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/encryption-disabler/setup_install.yml" + when: matrix_synapse_ext_encryption_disabler_enabled | bool -- import_tasks: "{{ role_path }}/tasks/ext/encryption-disabler/setup_uninstall.yml" - when: "not matrix_synapse_ext_encryption_disabler_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/encryption-disabler/setup_uninstall.yml" + when: "not matrix_synapse_ext_encryption_disabler_enabled | bool" diff --git a/roles/matrix-synapse/tasks/ext/encryption-disabler/setup_install.yml b/roles/matrix-synapse/tasks/ext/encryption-disabler/setup_install.yml index 41970cde..00cc1650 100644 --- a/roles/matrix-synapse/tasks/ext/encryption-disabler/setup_install.yml +++ b/roles/matrix-synapse/tasks/ext/encryption-disabler/setup_install.yml @@ -16,7 +16,7 @@ - ansible.builtin.set_fact: matrix_synapse_modules: | {{ - matrix_synapse_modules|default([]) + matrix_synapse_modules | default([]) + [ { @@ -28,7 +28,7 @@ matrix_synapse_container_extra_arguments: > {{ - matrix_synapse_container_extra_arguments|default([]) + matrix_synapse_container_extra_arguments | default([]) + ["--mount type=bind,src={{ matrix_synapse_ext_path }}/matrix_e2ee_filter.py,dst={{ matrix_synapse_in_container_python_packages_path }}/matrix_e2ee_filter.py,ro"] }} diff --git a/roles/matrix-synapse/tasks/ext/ldap-auth/setup.yml b/roles/matrix-synapse/tasks/ext/ldap-auth/setup.yml index d5f54db3..5d648c84 100644 --- a/roles/matrix-synapse/tasks/ext/ldap-auth/setup.yml +++ b/roles/matrix-synapse/tasks/ext/ldap-auth/setup.yml @@ -9,4 +9,4 @@ + [{'name': 'ldap_auth_provider', 'level': 'INFO'}] }} - when: matrix_synapse_ext_password_provider_ldap_enabled|bool + when: matrix_synapse_ext_password_provider_ldap_enabled | bool diff --git a/roles/matrix-synapse/tasks/ext/mjolnir-antispam/setup.yml b/roles/matrix-synapse/tasks/ext/mjolnir-antispam/setup.yml index 6c45f469..1a3e097d 100644 --- a/roles/matrix-synapse/tasks/ext/mjolnir-antispam/setup.yml +++ b/roles/matrix-synapse/tasks/ext/mjolnir-antispam/setup.yml @@ -1,7 +1,7 @@ --- -- import_tasks: "{{ role_path }}/tasks/ext/mjolnir-antispam/setup_install.yml" - when: matrix_synapse_ext_spam_checker_mjolnir_antispam_enabled|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/mjolnir-antispam/setup_install.yml" + when: matrix_synapse_ext_spam_checker_mjolnir_antispam_enabled | bool -- import_tasks: "{{ role_path }}/tasks/ext/mjolnir-antispam/setup_uninstall.yml" - when: "not matrix_synapse_ext_spam_checker_mjolnir_antispam_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/mjolnir-antispam/setup_uninstall.yml" + when: "not matrix_synapse_ext_spam_checker_mjolnir_antispam_enabled | bool" diff --git a/roles/matrix-synapse/tasks/ext/mjolnir-antispam/setup_install.yml b/roles/matrix-synapse/tasks/ext/mjolnir-antispam/setup_install.yml index 4dd122ff..3869f1aa 100644 --- a/roles/matrix-synapse/tasks/ext/mjolnir-antispam/setup_install.yml +++ b/roles/matrix-synapse/tasks/ext/mjolnir-antispam/setup_install.yml @@ -50,7 +50,7 @@ matrix_synapse_container_extra_arguments: > {{ - matrix_synapse_container_extra_arguments|default([]) + matrix_synapse_container_extra_arguments | default([]) + ["--mount type=bind,src={{ matrix_synapse_ext_path }}/mjolnir/synapse_antispam/mjolnir,dst={{ matrix_synapse_in_container_python_packages_path }}/mjolnir,ro"] }} diff --git a/roles/matrix-synapse/tasks/ext/rest-auth/setup.yml b/roles/matrix-synapse/tasks/ext/rest-auth/setup.yml index 0270784a..6df360ce 100644 --- a/roles/matrix-synapse/tasks/ext/rest-auth/setup.yml +++ b/roles/matrix-synapse/tasks/ext/rest-auth/setup.yml @@ -1,7 +1,7 @@ --- -- import_tasks: "{{ role_path }}/tasks/ext/rest-auth/setup_install.yml" - when: matrix_synapse_ext_password_provider_rest_auth_enabled|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/rest-auth/setup_install.yml" + when: matrix_synapse_ext_password_provider_rest_auth_enabled | bool -- import_tasks: "{{ role_path }}/tasks/ext/rest-auth/setup_uninstall.yml" - when: "not matrix_synapse_ext_password_provider_rest_auth_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/rest-auth/setup_uninstall.yml" + when: "not matrix_synapse_ext_password_provider_rest_auth_enabled | bool" diff --git a/roles/matrix-synapse/tasks/ext/rest-auth/setup_install.yml b/roles/matrix-synapse/tasks/ext/rest-auth/setup_install.yml index 685b2922..489f1140 100644 --- a/roles/matrix-synapse/tasks/ext/rest-auth/setup_install.yml +++ b/roles/matrix-synapse/tasks/ext/rest-auth/setup_install.yml @@ -23,7 +23,7 @@ matrix_synapse_container_extra_arguments: > {{ - matrix_synapse_container_extra_arguments|default([]) + matrix_synapse_container_extra_arguments | default([]) + ["--mount type=bind,src={{ matrix_synapse_ext_path }}/rest_auth_provider.py,dst={{ matrix_synapse_in_container_python_packages_path }}/rest_auth_provider.py,ro"] }} diff --git a/roles/matrix-synapse/tasks/ext/setup.yml b/roles/matrix-synapse/tasks/ext/setup.yml index 25c8809d..d944f257 100644 --- a/roles/matrix-synapse/tasks/ext/setup.yml +++ b/roles/matrix-synapse/tasks/ext/setup.yml @@ -1,13 +1,13 @@ --- -- import_tasks: "{{ role_path }}/tasks/ext/encryption-disabler/setup.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/encryption-disabler/setup.yml" -- import_tasks: "{{ role_path }}/tasks/ext/rest-auth/setup.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/rest-auth/setup.yml" -- import_tasks: "{{ role_path }}/tasks/ext/shared-secret-auth/setup.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/shared-secret-auth/setup.yml" -- import_tasks: "{{ role_path }}/tasks/ext/ldap-auth/setup.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/ldap-auth/setup.yml" -- import_tasks: "{{ role_path }}/tasks/ext/synapse-simple-antispam/setup.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/synapse-simple-antispam/setup.yml" -- import_tasks: "{{ role_path }}/tasks/ext/mjolnir-antispam/setup.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/mjolnir-antispam/setup.yml" diff --git a/roles/matrix-synapse/tasks/ext/shared-secret-auth/setup.yml b/roles/matrix-synapse/tasks/ext/shared-secret-auth/setup.yml index ed8d0197..6dc385d3 100644 --- a/roles/matrix-synapse/tasks/ext/shared-secret-auth/setup.yml +++ b/roles/matrix-synapse/tasks/ext/shared-secret-auth/setup.yml @@ -1,7 +1,7 @@ --- -- import_tasks: "{{ role_path }}/tasks/ext/shared-secret-auth/setup_install.yml" - when: matrix_synapse_ext_password_provider_shared_secret_auth_enabled|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/shared-secret-auth/setup_install.yml" + when: matrix_synapse_ext_password_provider_shared_secret_auth_enabled | bool -- import_tasks: "{{ role_path }}/tasks/ext/shared-secret-auth/setup_uninstall.yml" - when: "not matrix_synapse_ext_password_provider_shared_secret_auth_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/shared-secret-auth/setup_uninstall.yml" + when: "not matrix_synapse_ext_password_provider_shared_secret_auth_enabled | bool" diff --git a/roles/matrix-synapse/tasks/ext/shared-secret-auth/setup_install.yml b/roles/matrix-synapse/tasks/ext/shared-secret-auth/setup_install.yml index f4229538..055d671a 100644 --- a/roles/matrix-synapse/tasks/ext/shared-secret-auth/setup_install.yml +++ b/roles/matrix-synapse/tasks/ext/shared-secret-auth/setup_install.yml @@ -26,7 +26,7 @@ - ansible.builtin.set_fact: matrix_synapse_modules: | {{ - matrix_synapse_modules|default([]) + matrix_synapse_modules | default([]) + [ { @@ -38,7 +38,7 @@ matrix_synapse_container_extra_arguments: > {{ - matrix_synapse_container_extra_arguments|default([]) + matrix_synapse_container_extra_arguments | default([]) + ["--mount type=bind,src={{ matrix_synapse_ext_path }}/shared_secret_authenticator.py,dst={{ matrix_synapse_in_container_python_packages_path }}/shared_secret_authenticator.py,ro"] }} diff --git a/roles/matrix-synapse/tasks/ext/synapse-simple-antispam/setup.yml b/roles/matrix-synapse/tasks/ext/synapse-simple-antispam/setup.yml index efd4a027..038eea74 100644 --- a/roles/matrix-synapse/tasks/ext/synapse-simple-antispam/setup.yml +++ b/roles/matrix-synapse/tasks/ext/synapse-simple-antispam/setup.yml @@ -1,7 +1,7 @@ --- -- import_tasks: "{{ role_path }}/tasks/ext/synapse-simple-antispam/setup_install.yml" - when: matrix_synapse_ext_spam_checker_synapse_simple_antispam_enabled|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/synapse-simple-antispam/setup_install.yml" + when: matrix_synapse_ext_spam_checker_synapse_simple_antispam_enabled | bool -- import_tasks: "{{ role_path }}/tasks/ext/synapse-simple-antispam/setup_uninstall.yml" - when: "not matrix_synapse_ext_spam_checker_synapse_simple_antispam_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/synapse-simple-antispam/setup_uninstall.yml" + when: "not matrix_synapse_ext_spam_checker_synapse_simple_antispam_enabled | bool" diff --git a/roles/matrix-synapse/tasks/ext/synapse-simple-antispam/setup_install.yml b/roles/matrix-synapse/tasks/ext/synapse-simple-antispam/setup_install.yml index 7eb67deb..23a382f2 100644 --- a/roles/matrix-synapse/tasks/ext/synapse-simple-antispam/setup_install.yml +++ b/roles/matrix-synapse/tasks/ext/synapse-simple-antispam/setup_install.yml @@ -52,7 +52,7 @@ matrix_synapse_container_extra_arguments: > {{ - matrix_synapse_container_extra_arguments|default([]) + matrix_synapse_container_extra_arguments | default([]) + ["--mount type=bind,src={{ matrix_synapse_ext_path }}/synapse-simple-antispam/synapse_simple_antispam,dst={{ matrix_synapse_in_container_python_packages_path }}/synapse_simple_antispam,ro"] }} diff --git a/roles/matrix-synapse/tasks/goofys/setup.yml b/roles/matrix-synapse/tasks/goofys/setup.yml index 6370408d..2f9eaa87 100644 --- a/roles/matrix-synapse/tasks/goofys/setup.yml +++ b/roles/matrix-synapse/tasks/goofys/setup.yml @@ -1,7 +1,7 @@ --- -- import_tasks: "{{ role_path }}/tasks/goofys/setup_install.yml" - when: matrix_s3_media_store_enabled|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/goofys/setup_install.yml" + when: matrix_s3_media_store_enabled | bool -- import_tasks: "{{ role_path }}/tasks/goofys/setup_uninstall.yml" - when: "not matrix_s3_media_store_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/goofys/setup_uninstall.yml" + when: "not matrix_s3_media_store_enabled | bool" diff --git a/roles/matrix-synapse/tasks/goofys/setup_install.yml b/roles/matrix-synapse/tasks/goofys/setup_install.yml index b9e99747..e3c34150 100644 --- a/roles/matrix-synapse/tasks/goofys/setup_install.yml +++ b/roles/matrix-synapse/tasks/goofys/setup_install.yml @@ -1,6 +1,6 @@ --- -- import_tasks: "{{ role_path }}/../matrix-base/tasks/util/ensure_fuse_installed.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/../matrix-base/tasks/util/ensure_fuse_installed.yml" - name: Ensure Goofys Docker image is pulled docker_image: @@ -15,7 +15,7 @@ # This will throw a Permission Denied error if already mounted - name: Check Matrix Goofys external storage mountpoint path - stat: + ansible.builtin.stat: path: "{{ matrix_s3_media_store_path }}" register: local_path_matrix_s3_media_store_path_stat ignore_errors: true diff --git a/roles/matrix-synapse/tasks/goofys/setup_uninstall.yml b/roles/matrix-synapse/tasks/goofys/setup_uninstall.yml index 8f7e3237..da78003f 100644 --- a/roles/matrix-synapse/tasks/goofys/setup_uninstall.yml +++ b/roles/matrix-synapse/tasks/goofys/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-goofys service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-goofys.service" register: matrix_goofys_service_stat diff --git a/roles/matrix-synapse/tasks/import_media_store.yml b/roles/matrix-synapse/tasks/import_media_store.yml index edfad27e..133debe3 100644 --- a/roles/matrix-synapse/tasks/import_media_store.yml +++ b/roles/matrix-synapse/tasks/import_media_store.yml @@ -10,10 +10,10 @@ - name: Fail if media store is on Amazon S3 ansible.builtin.fail: msg: "Your media store is on Amazon S3. Due to technical limitations, restoring is not supported." - when: matrix_s3_media_store_enabled|bool + when: matrix_s3_media_store_enabled | bool - name: Check if the provided media store directory exists - stat: + ansible.builtin.stat: path: "{{ server_path_media_store }}" register: server_path_media_store_stat @@ -23,12 +23,12 @@ when: "not server_path_media_store_stat.stat.exists or not server_path_media_store_stat.stat.isdir" - name: Check if media store contains local_content - stat: + ansible.builtin.stat: path: "{{ server_path_media_store }}/local_content" register: server_path_media_store_local_content_stat - name: Check if media store contains remote_content - stat: + ansible.builtin.stat: path: "{{ server_path_media_store }}/remote_content" register: server_path_media_store_remote_content_stat @@ -69,7 +69,7 @@ owner: "{{ matrix_user_username }}" group: "{{ matrix_user_groupname }}" recurse: true - when: "not matrix_s3_media_store_enabled|bool" + when: "not matrix_s3_media_store_enabled | bool" # We don't chown for Goofys, because due to the way it's mounted, # all files become owned by whoever needs to own them. diff --git a/roles/matrix-synapse/tasks/init.yml b/roles/matrix-synapse/tasks/init.yml index c76b4f6c..77696bce 100644 --- a/roles/matrix-synapse/tasks/init.yml +++ b/roles/matrix-synapse/tasks/init.yml @@ -8,23 +8,23 @@ # Unless `matrix_synapse_workers_enabled_list` is explicitly defined, # we'll generate it dynamically. -- import_tasks: "{{ role_path }}/tasks/synapse/workers/init.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/synapse/workers/init.yml" when: "matrix_synapse_enabled and matrix_synapse_workers_enabled and matrix_synapse_workers_enabled_list|length == 0" - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-synapse.service'] }}" - when: matrix_synapse_enabled|bool + when: matrix_synapse_enabled | bool - name: Ensure systemd services for workers are injected - include_tasks: "{{ role_path }}/tasks/synapse/workers/util/inject_systemd_services_for_worker.yml" + ansible.builtin.include_tasks: "{{ role_path }}/tasks/synapse/workers/util/inject_systemd_services_for_worker.yml" with_items: "{{ matrix_synapse_workers_enabled_list }}" loop_control: loop_var: matrix_synapse_worker_details - when: matrix_synapse_enabled|bool and matrix_synapse_workers_enabled|bool + when: matrix_synapse_enabled | bool and matrix_synapse_workers_enabled | bool - ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-goofys.service'] }}" - when: matrix_s3_media_store_enabled|bool + when: matrix_s3_media_store_enabled | bool - block: - name: Fail if matrix-nginx-proxy role already executed @@ -34,13 +34,13 @@ but it's pointless since the matrix-nginx-proxy role had already executed. To fix this, please change the order of roles in your playbook, so that the matrix-nginx-proxy role would run after the matrix-synapse role. - when: matrix_nginx_proxy_role_executed|default(False)|bool + when: matrix_nginx_proxy_role_executed | default(False) | bool - name: Generate synapse metrics proxying configuration for matrix-nginx-proxy (matrix.DOMAIN/metrics/synapse/main-process) ansible.builtin.set_fact: matrix_synapse_nginx_metrics_configuration_block: | location /metrics/synapse/main-process { - {% if matrix_nginx_proxy_enabled|default(False) %} + {% if matrix_nginx_proxy_enabled | default(False) %} {# Use the embedded DNS resolver in Docker containers to discover the service #} resolver 127.0.0.11 valid=5s; set $backend "matrix-synapse:{{ matrix_synapse_metrics_port }}"; @@ -55,7 +55,7 @@ ansible.builtin.set_fact: matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks: | {{ - matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks|default([]) + matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks | default([]) + [matrix_synapse_nginx_metrics_configuration_block] }} @@ -79,9 +79,9 @@ ansible.builtin.set_fact: matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks: | {{ - matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks|default([]) + matrix_nginx_proxy_proxy_matrix_metrics_additional_system_location_configuration_blocks | default([]) + [matrix_synapse_worker_nginx_metrics_configuration_block] }} when: matrix_synapse_workers_enabled_list|length > 0 - when: matrix_synapse_enabled|bool and matrix_synapse_metrics_proxying_enabled|bool + when: matrix_synapse_enabled | bool and matrix_synapse_metrics_proxying_enabled | bool diff --git a/roles/matrix-synapse/tasks/main.yml b/roles/matrix-synapse/tasks/main.yml index 31a8c368..7068dcef 100644 --- a/roles/matrix-synapse/tasks/main.yml +++ b/roles/matrix-synapse/tasks/main.yml @@ -1,52 +1,52 @@ --- -- 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_synapse_enabled|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml" + when: run_setup | bool and matrix_synapse_enabled | bool tags: - setup-all - setup-synapse -- import_tasks: "{{ role_path }}/tasks/setup_synapse.yml" - when: run_setup|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_synapse.yml" + when: run_setup | bool tags: - setup-all - setup-synapse -- import_tasks: "{{ role_path }}/tasks/import_media_store.yml" - when: run_synapse_import_media_store|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/import_media_store.yml" + when: run_synapse_import_media_store | bool tags: - import-synapse-media-store -- import_tasks: "{{ role_path }}/tasks/register_user.yml" - when: run_synapse_register_user|bool and matrix_synapse_enabled|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/register_user.yml" + when: run_synapse_register_user | bool and matrix_synapse_enabled | bool tags: - register-user -- import_tasks: "{{ role_path }}/tasks/self_check_client_api.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/self_check_client_api.yml" delegate_to: 127.0.0.1 become: false - when: run_self_check|bool + when: run_self_check | bool tags: - self-check -- import_tasks: "{{ role_path }}/tasks/self_check_federation_api.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/self_check_federation_api.yml" delegate_to: 127.0.0.1 become: false - when: run_self_check|bool + when: run_self_check | bool tags: - self-check -- import_tasks: "{{ role_path }}/tasks/update_user_password.yml" - when: run_synapse_update_user_password|bool and matrix_synapse_enabled|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/update_user_password.yml" + when: run_synapse_update_user_password | bool and matrix_synapse_enabled | bool tags: - update-user-password -- import_tasks: "{{ role_path }}/tasks/rust-synapse-compress-state/main.yml" - when: run_synapse_rust_synapse_compress_state|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/rust-synapse-compress-state/main.yml" + when: run_synapse_rust_synapse_compress_state | bool tags: - rust-synapse-compress-state diff --git a/roles/matrix-synapse/tasks/register_user.yml b/roles/matrix-synapse/tasks/register_user.yml index 48ce33bb..d7354d05 100644 --- a/roles/matrix-synapse/tasks/register_user.yml +++ b/roles/matrix-synapse/tasks/register_user.yml @@ -23,7 +23,7 @@ register: start_result - name: Wait a while, so that Synapse can manage to start - pause: + ansible.builtin.pause: seconds: 7 when: "start_result.changed" diff --git a/roles/matrix-synapse/tasks/rust-synapse-compress-state/main.yml b/roles/matrix-synapse/tasks/rust-synapse-compress-state/main.yml index 33a18ac6..097b816a 100644 --- a/roles/matrix-synapse/tasks/rust-synapse-compress-state/main.yml +++ b/roles/matrix-synapse/tasks/rust-synapse-compress-state/main.yml @@ -4,7 +4,7 @@ - name: Fail if Postgres not enabled ansible.builtin.fail: msg: "Postgres via the matrix-postgres role is not enabled (`matrix_postgres_enabled`). Cannot use rust-synapse-compress-state." - when: "not matrix_postgres_enabled|bool" + when: "not matrix_postgres_enabled | bool" # Defaults @@ -12,24 +12,24 @@ - name: Set matrix_synapse_rust_synapse_compress_state_find_rooms_command_wait_time, if not provided ansible.builtin.set_fact: matrix_synapse_rust_synapse_compress_state_find_rooms_command_wait_time: 1800 - when: "matrix_synapse_rust_synapse_compress_state_find_rooms_command_wait_time|default('') == ''" + when: "matrix_synapse_rust_synapse_compress_state_find_rooms_command_wait_time | default('') == ''" - name: Set matrix_synapse_rust_synapse_compress_state_compress_room_time, if not provided ansible.builtin.set_fact: matrix_synapse_rust_synapse_compress_state_compress_room_time: 3600 - when: "matrix_synapse_rust_synapse_compress_state_compress_room_time|default('') == ''" + when: "matrix_synapse_rust_synapse_compress_state_compress_room_time | default('') == ''" - name: Set matrix_synapse_rust_synapse_compress_state_psql_import_time, if not provided ansible.builtin.set_fact: matrix_synapse_rust_synapse_compress_state_psql_import_time: 3600 - when: "matrix_synapse_rust_synapse_compress_state_psql_import_time|default('') == ''" + when: "matrix_synapse_rust_synapse_compress_state_psql_import_time | default('') == ''" - name: Set matrix_synapse_rust_synapse_compress_state_min_state_groups_required, if not provided ansible.builtin.set_fact: # The minimum number of state groups we're looking for before we consider a room eligible for compression. # Rooms with a smaller state groups count will not be compressed. matrix_synapse_rust_synapse_compress_state_min_state_groups_required: 100000 - when: "matrix_synapse_rust_synapse_compress_state_min_state_groups_required|default('') == ''" + when: "matrix_synapse_rust_synapse_compress_state_min_state_groups_required | default('') == ''" # Actual compression work @@ -108,7 +108,7 @@ {{ matrix_synapse_rust_synapse_compress_state_eligible_rooms }} - name: Compress room state - include_tasks: "{{ role_path }}/tasks/rust-synapse-compress-state/compress_room.yml" + ansible.builtin.include_tasks: "{{ role_path }}/tasks/rust-synapse-compress-state/compress_room.yml" with_items: "{{ matrix_synapse_rust_synapse_compress_state_eligible_rooms }}" loop_control: loop_var: room_details diff --git a/roles/matrix-synapse/tasks/self_check_client_api.yml b/roles/matrix-synapse/tasks/self_check_client_api.yml index c0906304..1c03ba5b 100644 --- a/roles/matrix-synapse/tasks/self_check_client_api.yml +++ b/roles/matrix-synapse/tasks/self_check_client_api.yml @@ -8,14 +8,14 @@ register: result_matrix_synapse_client_api ignore_errors: true check_mode: false - when: matrix_synapse_enabled|bool + when: matrix_synapse_enabled | bool - name: Fail if Matrix Client API not working ansible.builtin.fail: msg: "Failed checking Matrix Client API is up at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_synapse_client_api_url_endpoint_public }}`). Is Synapse running? Is port 443 open in your firewall? Full error: {{ result_matrix_synapse_client_api }}" - when: "matrix_synapse_enabled|bool and (result_matrix_synapse_client_api.failed or 'json' not in result_matrix_synapse_client_api)" + when: "matrix_synapse_enabled | bool and (result_matrix_synapse_client_api.failed or 'json' not in result_matrix_synapse_client_api)" - name: Report working Matrix Client API ansible.builtin.debug: msg: "The Matrix Client API at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_synapse_client_api_url_endpoint_public }}`) is working" - when: matrix_synapse_enabled|bool + when: matrix_synapse_enabled | bool diff --git a/roles/matrix-synapse/tasks/self_check_federation_api.yml b/roles/matrix-synapse/tasks/self_check_federation_api.yml index 447e3e26..80ec4fc2 100644 --- a/roles/matrix-synapse/tasks/self_check_federation_api.yml +++ b/roles/matrix-synapse/tasks/self_check_federation_api.yml @@ -8,19 +8,19 @@ register: result_matrix_synapse_federation_api ignore_errors: true check_mode: false - when: matrix_synapse_enabled|bool + when: matrix_synapse_enabled | bool - name: Fail if Matrix Federation API not working ansible.builtin.fail: msg: "Failed checking Matrix Federation API is up at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_synapse_federation_api_url_endpoint_public }}`). Is Synapse running? Is port {{ matrix_federation_public_port }} open in your firewall? Full error: {{ result_matrix_synapse_federation_api }}" - when: "matrix_synapse_enabled|bool and matrix_synapse_federation_enabled|bool and (result_matrix_synapse_federation_api.failed or 'json' not in result_matrix_synapse_federation_api)" + when: "matrix_synapse_enabled | bool and matrix_synapse_federation_enabled | bool and (result_matrix_synapse_federation_api.failed or 'json' not in result_matrix_synapse_federation_api)" - name: Fail if Matrix Federation API unexpectedly enabled ansible.builtin.fail: msg: "Matrix Federation API is up at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_synapse_federation_api_url_endpoint_public }}`) despite being disabled." - when: "matrix_synapse_enabled|bool and not matrix_synapse_federation_enabled|bool and not result_matrix_synapse_federation_api.failed" + when: "matrix_synapse_enabled | bool and not matrix_synapse_federation_enabled | bool and not result_matrix_synapse_federation_api.failed" - name: Report working Matrix Federation API ansible.builtin.debug: msg: "The Matrix Federation API at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_synapse_federation_api_url_endpoint_public }}`) is working" - when: "matrix_synapse_enabled|bool and matrix_synapse_federation_enabled|bool" + when: "matrix_synapse_enabled | bool and matrix_synapse_federation_enabled | bool" diff --git a/roles/matrix-synapse/tasks/setup_synapse.yml b/roles/matrix-synapse/tasks/setup_synapse.yml index c2b33f0b..d4e6ae95 100644 --- a/roles/matrix-synapse/tasks/setup_synapse.yml +++ b/roles/matrix-synapse/tasks/setup_synapse.yml @@ -14,12 +14,12 @@ # We handle matrix_synapse_media_store_path elsewhere (in ./synapse/setup_install.yml), # because if it's using Goofys and it's already mounted (from before), # trying to chown/chmod it here will cause trouble. - when: "(matrix_synapse_enabled|bool or matrix_s3_media_store_enabled|bool) and item.when" + when: "(matrix_synapse_enabled | bool or matrix_s3_media_store_enabled | bool) and item.when" -- import_tasks: "{{ role_path }}/tasks/ext/setup.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ext/setup.yml" -- import_tasks: "{{ role_path }}/tasks/synapse/workers/setup.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/synapse/workers/setup.yml" -- import_tasks: "{{ role_path }}/tasks/synapse/setup.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/synapse/setup.yml" -- import_tasks: "{{ role_path }}/tasks/goofys/setup.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/goofys/setup.yml" diff --git a/roles/matrix-synapse/tasks/synapse/setup.yml b/roles/matrix-synapse/tasks/synapse/setup.yml index b5d27c36..80f761e5 100644 --- a/roles/matrix-synapse/tasks/synapse/setup.yml +++ b/roles/matrix-synapse/tasks/synapse/setup.yml @@ -1,7 +1,7 @@ --- -- import_tasks: "{{ role_path }}/tasks/synapse/setup_install.yml" - when: matrix_synapse_enabled|bool +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/synapse/setup_install.yml" + when: matrix_synapse_enabled | bool -- import_tasks: "{{ role_path }}/tasks/synapse/setup_uninstall.yml" - when: "not matrix_synapse_enabled|bool" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/synapse/setup_uninstall.yml" + when: "not matrix_synapse_enabled | bool" diff --git a/roles/matrix-synapse/tasks/synapse/setup_install.yml b/roles/matrix-synapse/tasks/synapse/setup_install.yml index e0d47072..51e22d75 100644 --- a/roles/matrix-synapse/tasks/synapse/setup_install.yml +++ b/roles/matrix-synapse/tasks/synapse/setup_install.yml @@ -2,7 +2,7 @@ # This will throw a Permission Denied error if already mounted using fuse - name: Check Synapse media store path - stat: + ansible.builtin.stat: path: "{{ matrix_synapse_media_store_path }}" register: local_path_media_store_stat ignore_errors: true @@ -46,8 +46,8 @@ . environment: DOCKER_BUILDKIT: 1 - when: "matrix_synapse_git_pull_results.changed|bool or matrix_synapse_docker_image_check_result.stdout == ''" - when: "matrix_synapse_container_image_self_build|bool" + when: "matrix_synapse_git_pull_results.changed | bool or matrix_synapse_docker_image_check_result.stdout == ''" + when: "matrix_synapse_container_image_self_build | bool" - name: Ensure Synapse Docker image is pulled docker_image: @@ -62,7 +62,7 @@ until: result is not failed - name: Check if a Synapse signing key exists - stat: + ansible.builtin.stat: path: "{{ matrix_synapse_config_dir_path }}/{{ matrix_server_fqn_matrix }}.signing.key" register: matrix_synapse_signing_key_stat @@ -90,7 +90,7 @@ - name: Ensure Synapse homeserver config installed ansible.builtin.copy: - content: "{{ matrix_synapse_configuration|to_nice_yaml(indent=2, width=999999) }}" + content: "{{ matrix_synapse_configuration | to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_synapse_config_dir_path }}/homeserver.yaml" mode: 0644 owner: "{{ matrix_user_username }}" @@ -127,4 +127,4 @@ owner: "{{ matrix_user_username }}" group: "{{ matrix_user_groupname }}" mode: 0644 - when: matrix_synapse_metrics_proxying_enabled|bool + when: matrix_synapse_metrics_proxying_enabled | bool diff --git a/roles/matrix-synapse/tasks/synapse/setup_uninstall.yml b/roles/matrix-synapse/tasks/synapse/setup_uninstall.yml index 1f2d3fe5..17b1b8c4 100644 --- a/roles/matrix-synapse/tasks/synapse/setup_uninstall.yml +++ b/roles/matrix-synapse/tasks/synapse/setup_uninstall.yml @@ -1,7 +1,7 @@ --- - name: Check existence of matrix-synapse service - stat: + ansible.builtin.stat: path: "{{ matrix_systemd_path }}/matrix-synapse.service" register: matrix_synapse_service_stat @@ -34,4 +34,4 @@ ansible.builtin.file: path: "{{ matrix_synapse_base_path }}/external_prometheus.yml.example" state: absent - when: "not matrix_synapse_metrics_proxying_enabled|bool" + when: "not matrix_synapse_metrics_proxying_enabled | bool" diff --git a/roles/matrix-synapse/tasks/synapse/workers/init.yml b/roles/matrix-synapse/tasks/synapse/workers/init.yml index 6d75d9f6..7c396422 100644 --- a/roles/matrix-synapse/tasks/synapse/workers/init.yml +++ b/roles/matrix-synapse/tasks/synapse/workers/init.yml @@ -12,7 +12,7 @@ port: "{{ matrix_synapse_workers_generic_workers_port_range_start + item }}" metrics_port: "{{ matrix_synapse_workers_generic_workers_metrics_range_start + item }}" register: "matrix_synapse_workers_list_results_generic_workers" - loop: "{{ range(0, matrix_synapse_workers_generic_workers_count|int)|list }}" + loop: "{{ range(0, matrix_synapse_workers_generic_workers_count|int) | list }}" - name: Build federation sender workers ansible.builtin.set_fact: @@ -22,7 +22,7 @@ port: 0 metrics_port: "{{ matrix_synapse_workers_federation_sender_workers_metrics_range_start + item }}" register: "matrix_synapse_workers_list_results_federation_sender_workers" - loop: "{{ range(0, matrix_synapse_workers_federation_sender_workers_count|int)|list }}" + loop: "{{ range(0, matrix_synapse_workers_federation_sender_workers_count|int) | list }}" # This type of worker can only have a count of 1, at most - name: Build pusher workers @@ -33,7 +33,7 @@ port: 0 metrics_port: "{{ matrix_synapse_workers_pusher_workers_metrics_range_start + item }}" register: "matrix_synapse_workers_list_results_pusher_workers" - loop: "{{ range(0, matrix_synapse_workers_pusher_workers_count|int)|list }}" + loop: "{{ range(0, matrix_synapse_workers_pusher_workers_count|int) | list }}" # This type of worker can only have a count of 1, at most - name: Build appservice workers @@ -44,7 +44,7 @@ port: 0 metrics_port: "{{ matrix_synapse_workers_appservice_workers_metrics_range_start + item }}" register: "matrix_synapse_workers_list_results_appservice_workers" - loop: "{{ range(0, matrix_synapse_workers_appservice_workers_count|int)|list }}" + loop: "{{ range(0, matrix_synapse_workers_appservice_workers_count|int) | list }}" - name: Build media_repository workers ansible.builtin.set_fact: @@ -54,7 +54,7 @@ port: "{{ matrix_synapse_workers_media_repository_workers_port_range_start + item }}" metrics_port: "{{ matrix_synapse_workers_media_repository_workers_metrics_range_start + item }}" register: "matrix_synapse_workers_list_results_media_repository_workers" - loop: "{{ range(0, matrix_synapse_workers_media_repository_workers_count|int)|list }}" + loop: "{{ range(0, matrix_synapse_workers_media_repository_workers_count|int) | list }}" - name: Build frontend_proxy workers ansible.builtin.set_fact: @@ -64,10 +64,10 @@ port: "{{ matrix_synapse_workers_frontend_proxy_workers_port_range_start + item }}" metrics_port: "{{ matrix_synapse_workers_frontend_proxy_workers_metrics_range_start + item }}" register: "matrix_synapse_workers_list_results_frontend_proxy_workers" - loop: "{{ range(0, matrix_synapse_workers_frontend_proxy_workers_count|int)|list }}" + loop: "{{ range(0, matrix_synapse_workers_frontend_proxy_workers_count|int) | list }}" - ansible.builtin.set_fact: - matrix_synapse_dynamic_workers_list: "{{ matrix_synapse_dynamic_workers_list|default([]) + [item.ansible_facts.worker] }}" + matrix_synapse_dynamic_workers_list: "{{ matrix_synapse_dynamic_workers_list | default([]) + [item.ansible_facts.worker] }}" with_items: | {{ matrix_synapse_workers_list_results_generic_workers.results diff --git a/roles/matrix-synapse/tasks/synapse/workers/setup.yml b/roles/matrix-synapse/tasks/synapse/workers/setup.yml index 7fcce2b4..836d5a66 100644 --- a/roles/matrix-synapse/tasks/synapse/workers/setup.yml +++ b/roles/matrix-synapse/tasks/synapse/workers/setup.yml @@ -14,8 +14,8 @@ path: "{{ matrix_local_bin_path }}/matrix-synapse-worker-write-pid" state: absent -- include_tasks: "{{ role_path }}/tasks/synapse/workers/setup_install.yml" - when: "matrix_synapse_enabled|bool and matrix_synapse_workers_enabled|bool" +- ansible.builtin.include_tasks: "{{ role_path }}/tasks/synapse/workers/setup_install.yml" + when: "matrix_synapse_enabled | bool and matrix_synapse_workers_enabled | bool" -- include_tasks: "{{ role_path }}/tasks/synapse/workers/setup_uninstall.yml" - when: "not matrix_synapse_workers_enabled|bool" +- ansible.builtin.include_tasks: "{{ role_path }}/tasks/synapse/workers/setup_uninstall.yml" + when: "not matrix_synapse_workers_enabled | bool" diff --git a/roles/matrix-synapse/tasks/synapse/workers/setup_install.yml b/roles/matrix-synapse/tasks/synapse/workers/setup_install.yml index ce86e35f..c264805a 100644 --- a/roles/matrix-synapse/tasks/synapse/workers/setup_install.yml +++ b/roles/matrix-synapse/tasks/synapse/workers/setup_install.yml @@ -1,7 +1,7 @@ --- - name: Determine current worker configs - find: + ansible.builtin.find: path: "{{ matrix_synapse_config_dir_path }}" patterns: "worker.*.yaml" use_regex: true @@ -15,7 +15,7 @@ with_items: "{{ matrix_synapse_workers_current_config_files.files }}" - name: Determine current worker systemd services - find: + ansible.builtin.find: path: "{{ matrix_systemd_path }}" patterns: "matrix-synapse-worker.*.service" use_regex: true @@ -23,11 +23,11 @@ - name: Ensure unnecessary worker systemd services are stopped and disabled ansible.builtin.service: - name: "{{ item.path|basename }}" + name: "{{ item.path | basename }}" state: stopped enabled: false with_items: "{{ matrix_synapse_workers_current_systemd_services.files }}" - when: "not ansible_check_mode and item.path|basename not in matrix_systemd_services_list" + when: "not ansible_check_mode and item.path | basename not in matrix_systemd_services_list" - name: Ensure unnecessary worker systemd services are cleaned ansible.builtin.file: @@ -36,7 +36,7 @@ with_items: "{{ matrix_synapse_workers_current_systemd_services.files }}" - name: Ensure creation of worker systemd service files and configuration files - include_tasks: "{{ role_path }}/tasks/synapse/workers/util/setup_files_for_worker.yml" + ansible.builtin.include_tasks: "{{ role_path }}/tasks/synapse/workers/util/setup_files_for_worker.yml" with_items: "{{ matrix_synapse_workers_enabled_list }}" loop_control: loop_var: matrix_synapse_worker_details diff --git a/roles/matrix-synapse/tasks/synapse/workers/setup_uninstall.yml b/roles/matrix-synapse/tasks/synapse/workers/setup_uninstall.yml index 8b70dec5..f79a4115 100644 --- a/roles/matrix-synapse/tasks/synapse/workers/setup_uninstall.yml +++ b/roles/matrix-synapse/tasks/synapse/workers/setup_uninstall.yml @@ -1,17 +1,17 @@ --- - name: Populate service facts - service_facts: + ansible.builtin.service_facts: - name: Ensure any worker services are stopped ansible.builtin.service: name: "{{ item.key }}" state: stopped - with_dict: "{{ ansible_facts.services|default({})|dict2items|selectattr('key', 'match', 'matrix-synapse-worker-.+\\.service')|list|items2dict }}" + with_dict: "{{ ansible_facts.services | default({})|dict2items|selectattr('key', 'match', 'matrix-synapse-worker-.+\\.service')|list|items2dict }}" when: "item.value['status'] != 'not-found'" # see https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1461 - name: Find worker configs to be cleaned - find: + ansible.builtin.find: path: "{{ matrix_synapse_config_dir_path }}" patterns: "worker.*.yaml" use_regex: true @@ -24,7 +24,7 @@ with_items: "{{ matrix_synapse_workers_current_config_files.files }}" - name: Find worker systemd services to be cleaned - find: + ansible.builtin.find: path: "{{ matrix_systemd_path }}" patterns: "matrix-synapse-worker.*.service" use_regex: true diff --git a/roles/matrix-synapse/tasks/synapse/workers/util/inject_systemd_services_for_worker.yml b/roles/matrix-synapse/tasks/synapse/workers/util/inject_systemd_services_for_worker.yml index dfbb8316..2ecb3f2b 100644 --- a/roles/matrix-synapse/tasks/synapse/workers/util/inject_systemd_services_for_worker.yml +++ b/roles/matrix-synapse/tasks/synapse/workers/util/inject_systemd_services_for_worker.yml @@ -9,7 +9,7 @@ # Our own code which dynamically builds `matrix_synapse_workers_enabled_list` does things right. - name: Fail if instanceId not defined for worker ansible.builtin.fail: - msg: "Synapse workers (like {{ matrix_synapse_worker_details|to_json }}) need to define an instanceId property (type + instanceId must be unique)" + msg: "Synapse workers (like {{ matrix_synapse_worker_details | to_json }}) need to define an instanceId property (type + instanceId must be unique)" when: "'instanceId' not in matrix_synapse_worker_details" - ansible.builtin.set_fact: diff --git a/roles/matrix-synapse/tasks/update_user_password.yml b/roles/matrix-synapse/tasks/update_user_password.yml index 171159ff..1ae3183e 100644 --- a/roles/matrix-synapse/tasks/update_user_password.yml +++ b/roles/matrix-synapse/tasks/update_user_password.yml @@ -13,7 +13,7 @@ - name: Fail if not using matrix-postgres container ansible.builtin.fail: msg: "This command is working only when matrix-postgres container is being used" - when: "not matrix_postgres_enabled|bool" + when: "not matrix_postgres_enabled | bool" - name: Ensure matrix-synapse is started ansible.builtin.service: @@ -31,7 +31,7 @@ - name: Wait a while, so that Matrix Synapse can manage to start - pause: + ansible.builtin.pause: seconds: 7 when: "start_result.changed or postgres_start_result.changed" diff --git a/roles/matrix-synapse/vars/main.yml b/roles/matrix-synapse/vars/main.yml index 5839aa81..62fa0ac2 100644 --- a/roles/matrix-synapse/vars/main.yml +++ b/roles/matrix-synapse/vars/main.yml @@ -6,7 +6,7 @@ matrix_synapse_federation_api_url_endpoint_public: "https://{{ matrix_server_fqn # Tells whether this role had executed or not. Toggled to `true` during runtime. matrix_synapse_role_executed: false -matrix_synapse_media_store_directory_name: "{{ matrix_synapse_media_store_path|basename }}" +matrix_synapse_media_store_directory_name: "{{ matrix_synapse_media_store_path | basename }}" # A Synapse generic worker can handle both federation and client-server API endpoints. # We wish to split these, as we normally serve federation separately and don't want them mixed up. @@ -24,11 +24,11 @@ matrix_synapse_media_store_directory_name: "{{ matrix_synapse_media_store_path|b # so it's not that important whether we forward them or not. # # Basically, we aim to cover most things. Skipping `/_synapse/client` or a few other minor things doesn't matter too much. -matrix_synapse_workers_generic_worker_client_server_endpoints: "{{ matrix_synapse_workers_generic_worker_endpoints|default([]) | map('regex_search', '.*/_matrix/client.*')| list | difference([none]) }}" +matrix_synapse_workers_generic_worker_client_server_endpoints: "{{ matrix_synapse_workers_generic_worker_endpoints | default([]) | map('regex_search', '.*/_matrix/client.*' | list | difference([none]) }}" # A Synapse generic worker can handle both federation and client-server API endpoints. # We wish to split these, as we normally serve federation separately and don't want them mixed up. # # This is some ugly Ansible/Jinja2 hack (seen here: https://stackoverflow.com/a/47831492), # which takes a list of various strings and removes the ones NOT containing `/_matrix/federation` or `/_matrix/key` anywhere in them. -matrix_synapse_workers_generic_worker_federation_endpoints: "{{ matrix_synapse_workers_generic_worker_endpoints|default([]) | map('regex_search', '.*(/_matrix/federation|/_matrix/key).*')| list | difference([none]) }}" +matrix_synapse_workers_generic_worker_federation_endpoints: "{{ matrix_synapse_workers_generic_worker_endpoints | default([]) | map('regex_search', '.*(/_matrix/federation|/_matrix/key).*' | list | difference([none]) }}"