From 34cdaade08de7ea84ab62a44e82968b932f98f29 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Mon, 18 Jul 2022 10:39:08 +0300 Subject: [PATCH 01/16] Use fully-qualified module names for builtin Ansible modules Related to https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/1939 --- roles/matrix-aux/tasks/setup.yml | 4 +- roles/matrix-backup-borg/tasks/init.yml | 2 +- .../tasks/setup_install.yml | 24 ++--- .../tasks/setup_uninstall.yml | 10 +-- .../tasks/validate_config.yml | 4 +- .../matrix-base/tasks/clean_up_old_files.yml | 2 +- roles/matrix-base/tasks/sanity_check.yml | 20 ++--- roles/matrix-base/tasks/server_base/setup.yml | 6 +- .../tasks/server_base/setup_debian.yml | 6 +- .../tasks/server_base/setup_fedora.yml | 6 +- .../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 | 6 +- roles/matrix-base/tasks/setup_matrix_user.yml | 8 +- roles/matrix-base/tasks/setup_well_known.yml | 8 +- .../tasks/util/ensure_fuse_installed.yml | 4 +- .../tasks/util/ensure_openssl_installed.yml | 4 +- roles/matrix-bot-buscarron/tasks/init.yml | 2 +- .../tasks/setup_install.yml | 18 ++-- .../tasks/setup_uninstall.yml | 8 +- .../tasks/validate_config.yml | 2 +- roles/matrix-bot-go-neb/tasks/init.yml | 2 +- .../matrix-bot-go-neb/tasks/setup_install.yml | 12 +-- .../tasks/setup_uninstall.yml | 8 +- .../tasks/validate_config.yml | 4 +- roles/matrix-bot-honoroit/tasks/init.yml | 2 +- .../tasks/setup_install.yml | 18 ++-- .../tasks/setup_uninstall.yml | 8 +- .../tasks/validate_config.yml | 2 +- .../tasks/init.yml | 2 +- .../tasks/setup_install.yml | 12 +-- .../tasks/setup_uninstall.yml | 8 +- .../tasks/validate_config.yml | 2 +- .../tasks/init.yml | 2 +- .../tasks/setup_install.yml | 18 ++-- .../tasks/setup_uninstall.yml | 8 +- .../tasks/validate_config.yml | 4 +- roles/matrix-bot-mjolnir/tasks/init.yml | 4 +- .../tasks/setup_install.yml | 14 +-- .../tasks/setup_uninstall.yml | 8 +- .../tasks/validate_config.yml | 2 +- .../tasks/init.yml | 6 +- .../tasks/setup_install.yml | 24 ++--- .../tasks/setup_uninstall.yml | 6 +- .../tasks/validate_config.yml | 6 +- .../tasks/init.yml | 8 +- .../tasks/migrate_nedb_to_postgres.yml | 14 +-- .../tasks/setup_install.yml | 38 ++++---- .../tasks/setup_uninstall.yml | 6 +- .../tasks/validate_config.yml | 6 +- .../tasks/init.yml | 18 ++-- .../tasks/migrate_nedb_to_postgres.yml | 14 +-- .../tasks/setup_install.yml | 18 ++-- .../tasks/setup_uninstall.yml | 6 +- .../tasks/validate_config.yml | 4 +- .../tasks/init.yml | 16 ++-- .../tasks/setup_install.yml | 16 ++-- .../tasks/setup_uninstall.yml | 6 +- .../tasks/validate_config.yml | 2 +- .../tasks/init.yml | 4 +- .../tasks/setup_install.yml | 16 ++-- .../tasks/setup_uninstall.yml | 6 +- .../tasks/validate_config.yml | 2 +- .../tasks/init.yml | 4 +- .../tasks/setup_install.yml | 28 +++--- .../tasks/setup_uninstall.yml | 6 +- .../tasks/validate_config.yml | 2 +- .../matrix-bridge-heisenbridge/tasks/init.yml | 6 +- .../tasks/setup_install.yml | 8 +- .../tasks/setup_uninstall.yml | 6 +- roles/matrix-bridge-hookshot/tasks/init.yml | 18 ++-- .../tasks/setup_install.yml | 20 ++--- .../tasks/setup_uninstall.yml | 6 +- .../tasks/validate_config.yml | 16 ++-- .../tasks/init.yml | 14 +-- .../tasks/setup_install.yml | 26 +++--- .../tasks/setup_uninstall.yml | 6 +- .../tasks/validate_config.yml | 4 +- .../tasks/init.yml | 14 +-- .../tasks/setup_install.yml | 26 +++--- .../tasks/setup_uninstall.yml | 6 +- .../tasks/validate_config.yml | 4 +- .../tasks/init.yml | 14 +-- .../tasks/setup_install.yml | 26 +++--- .../tasks/setup_uninstall.yml | 6 +- .../tasks/validate_config.yml | 4 +- .../tasks/init.yml | 6 +- .../tasks/setup_install.yml | 14 +-- .../tasks/setup_uninstall.yml | 6 +- .../tasks/validate_config.yml | 2 +- .../tasks/init.yml | 4 +- .../tasks/setup_install.yml | 18 ++-- .../tasks/setup_uninstall.yml | 10 +-- .../tasks/validate_config.yml | 4 +- .../tasks/init.yml | 14 +-- .../tasks/setup_install.yml | 28 +++--- .../tasks/setup_uninstall.yml | 6 +- .../tasks/validate_config.yml | 4 +- .../tasks/init.yml | 6 +- .../tasks/setup_install.yml | 18 ++-- .../tasks/setup_uninstall.yml | 6 +- .../tasks/validate_config.yml | 2 +- .../tasks/init.yml | 4 +- .../tasks/setup_install.yml | 28 +++--- .../tasks/setup_uninstall.yml | 6 +- .../tasks/validate_config.yml | 4 +- .../tasks/init.yml | 6 +- .../tasks/setup_install.yml | 26 +++--- .../tasks/setup_uninstall.yml | 6 +- .../tasks/validate_config.yml | 2 +- .../tasks/init.yml | 6 +- .../tasks/setup_install.yml | 26 +++--- .../tasks/setup_uninstall.yml | 6 +- .../tasks/validate_config.yml | 2 +- .../tasks/init.yml | 6 +- .../tasks/setup_install.yml | 22 ++--- .../tasks/setup_uninstall.yml | 6 +- .../tasks/validate_config.yml | 2 +- .../tasks/init.yml | 14 +-- .../tasks/setup_install.yml | 26 +++--- .../tasks/setup_uninstall.yml | 6 +- .../tasks/validate_config.yml | 2 +- .../tasks/init.yml | 6 +- .../tasks/setup_install.yml | 26 +++--- .../tasks/setup_uninstall.yml | 6 +- .../tasks/validate_config.yml | 2 +- .../tasks/init.yml | 14 +-- .../tasks/setup_install.yml | 26 +++--- .../tasks/setup_uninstall.yml | 6 +- .../tasks/validate_config.yml | 2 +- roles/matrix-bridge-sms/tasks/init.yml | 6 +- .../matrix-bridge-sms/tasks/setup_install.yml | 12 +-- .../tasks/setup_uninstall.yml | 4 +- .../tasks/validate_config.yml | 2 +- roles/matrix-client-cinny/tasks/init.yml | 4 +- .../matrix-client-cinny/tasks/self_check.yml | 8 +- .../tasks/setup_install.yml | 12 +-- .../tasks/setup_uninstall.yml | 8 +- .../tasks/validate_config.yml | 2 +- roles/matrix-client-element/tasks/init.yml | 4 +- .../tasks/migrate_riot_web.yml | 8 +- .../tasks/prepare_themes.yml | 8 +- .../tasks/self_check.yml | 8 +- .../tasks/setup_install.yml | 18 ++-- .../tasks/setup_uninstall.yml | 8 +- .../tasks/validate_config.yml | 4 +- roles/matrix-client-hydrogen/tasks/init.yml | 4 +- .../tasks/self_check.yml | 8 +- .../tasks/setup_install.yml | 12 +-- .../tasks/setup_uninstall.yml | 8 +- .../tasks/validate_config.yml | 2 +- .../tasks/dump_runtime_results.yml | 2 +- .../tasks/run_docker_prune.yml | 2 +- roles/matrix-common-after/tasks/start.yml | 14 +-- roles/matrix-common-after/tasks/stop.yml | 2 +- roles/matrix-corporal/tasks/init.yml | 4 +- .../tasks/self_check_corporal.yml | 8 +- .../matrix-corporal/tasks/setup_corporal.yml | 18 ++-- .../matrix-corporal/tasks/validate_config.yml | 6 +- roles/matrix-coturn/tasks/init.yml | 6 +- roles/matrix-coturn/tasks/setup_install.yml | 18 ++-- roles/matrix-coturn/tasks/setup_uninstall.yml | 10 +-- roles/matrix-coturn/tasks/validate_config.yml | 2 +- .../tasks/dendrite/setup_install.yml | 14 +-- .../tasks/dendrite/setup_uninstall.yml | 6 +- roles/matrix-dendrite/tasks/init.yml | 2 +- roles/matrix-dendrite/tasks/main.yml | 2 +- roles/matrix-dendrite/tasks/register_user.yml | 8 +- .../tasks/self_check_client_api.yml | 6 +- .../tasks/self_check_federation_api.yml | 8 +- .../matrix-dendrite/tasks/setup_dendrite.yml | 2 +- .../matrix-dendrite/tasks/validate_config.yml | 4 +- roles/matrix-dimension/tasks/init.yml | 2 +- .../matrix-dimension/tasks/setup_install.yml | 22 ++--- .../tasks/setup_uninstall.yml | 8 +- .../tasks/validate_config.yml | 4 +- roles/matrix-dynamic-dns/tasks/init.yml | 4 +- roles/matrix-dynamic-dns/tasks/install.yml | 10 +-- roles/matrix-dynamic-dns/tasks/uninstall.yml | 6 +- .../tasks/validate_config.yml | 4 +- roles/matrix-email2matrix/tasks/init.yml | 2 +- .../tasks/setup_install.yml | 10 +-- .../tasks/setup_uninstall.yml | 8 +- .../tasks/validate_config.yml | 2 +- roles/matrix-etherpad/tasks/init.yml | 10 +-- roles/matrix-etherpad/tasks/setup_install.yml | 8 +- .../matrix-etherpad/tasks/setup_uninstall.yml | 8 +- .../matrix-etherpad/tasks/validate_config.yml | 4 +- roles/matrix-grafana/tasks/init.yml | 2 +- roles/matrix-grafana/tasks/setup.yml | 20 ++--- .../matrix-grafana/tasks/validate_config.yml | 2 +- roles/matrix-jitsi/tasks/init.yml | 4 +- roles/matrix-jitsi/tasks/setup_jitsi_base.yml | 2 +- .../matrix-jitsi/tasks/setup_jitsi_jicofo.yml | 18 ++-- roles/matrix-jitsi/tasks/setup_jitsi_jvb.yml | 18 ++-- .../tasks/setup_jitsi_prosody.yml | 18 ++-- roles/matrix-jitsi/tasks/setup_jitsi_web.yml | 18 ++-- .../tasks/util/setup_jitsi_auth.yml | 6 +- roles/matrix-jitsi/tasks/validate_config.yml | 6 +- roles/matrix-ma1sd/tasks/init.yml | 4 +- roles/matrix-ma1sd/tasks/migrate_mxisd.yml | 16 ++-- roles/matrix-ma1sd/tasks/self_check_ma1sd.yml | 8 +- roles/matrix-ma1sd/tasks/setup_install.yml | 30 +++---- roles/matrix-ma1sd/tasks/setup_uninstall.yml | 8 +- roles/matrix-ma1sd/tasks/validate_config.yml | 10 +-- roles/matrix-mailer/tasks/init.yml | 4 +- roles/matrix-mailer/tasks/setup_mailer.yml | 18 ++-- roles/matrix-nginx-proxy/tasks/init.yml | 4 +- roles/matrix-nginx-proxy/tasks/main.yml | 2 +- .../tasks/nginx-proxy/setup_metrics_auth.yml | 8 +- .../tasks/self_check_well_known.yml | 6 +- .../tasks/self_check_well_known_file.yml | 24 ++--- .../tasks/setup_nginx_proxy.yml | 88 +++++++++---------- .../tasks/setup_well_known.yml | 6 +- roles/matrix-nginx-proxy/tasks/ssl/main.yml | 6 +- .../tasks/ssl/setup_ssl_lets_encrypt.yml | 10 +-- ...tup_ssl_lets_encrypt_obtain_for_domain.yml | 14 +-- ...ssl_manually_managed_verify_for_domain.yml | 6 +- ...etup_ssl_self_signed_obtain_for_domain.yml | 8 +- .../tasks/validate_config.yml | 14 +-- roles/matrix-ntfy/tasks/init.yml | 2 +- roles/matrix-ntfy/tasks/self_check.yml | 8 +- roles/matrix-ntfy/tasks/setup_install.yml | 8 +- roles/matrix-ntfy/tasks/setup_uninstall.yml | 8 +- roles/matrix-postgres-backup/tasks/init.yml | 2 +- .../tasks/setup_postgres_backup.yml | 18 ++-- .../util/detect_existing_postgres_version.yml | 20 ++--- .../tasks/validate_config.yml | 2 +- .../tasks/import_generic_sqlite_db.yml | 22 ++--- .../matrix-postgres/tasks/import_postgres.yml | 22 ++--- .../tasks/import_synapse_sqlite_db.yml | 18 ++-- roles/matrix-postgres/tasks/init.yml | 2 +- .../tasks/migrate_postgres_data_directory.yml | 12 +-- roles/matrix-postgres/tasks/run_vacuum.yml | 26 +++--- .../matrix-postgres/tasks/setup_postgres.yml | 40 ++++----- .../tasks/upgrade_postgres.yml | 46 +++++----- .../tasks/util/create_additional_database.yml | 8 +- .../util/create_additional_databases.yml | 2 +- .../util/detect_existing_postgres_version.yml | 20 ++--- .../tasks/util/migrate_db_to_postgres.yml | 28 +++--- .../matrix-postgres/tasks/validate_config.yml | 8 +- .../tasks/init.yml | 8 +- .../tasks/setup.yml | 10 +-- .../tasks/init.yml | 8 +- .../tasks/setup.yml | 10 +-- roles/matrix-prometheus/tasks/init.yml | 2 +- .../matrix-prometheus/tasks/setup_install.yml | 10 +-- .../tasks/setup_uninstall.yml | 6 +- .../tasks/validate_config.yml | 2 +- roles/matrix-redis/tasks/init.yml | 2 +- roles/matrix-redis/tasks/setup_redis.yml | 18 ++-- .../tasks/generate_token.yml | 10 +-- roles/matrix-registration/tasks/init.yml | 12 +-- .../matrix-registration/tasks/list_tokens.yml | 6 +- .../tasks/setup_install.yml | 20 ++--- .../tasks/setup_uninstall.yml | 6 +- .../tasks/validate_config.yml | 4 +- roles/matrix-sygnal/tasks/init.yml | 2 +- roles/matrix-sygnal/tasks/setup_install.yml | 8 +- roles/matrix-sygnal/tasks/setup_uninstall.yml | 8 +- roles/matrix-sygnal/tasks/validate_config.yml | 2 +- roles/matrix-synapse-admin/tasks/init.yml | 12 +-- roles/matrix-synapse-admin/tasks/setup.yml | 12 +-- .../tasks/validate_config.yml | 2 +- .../ext/encryption-disabler/setup_install.yml | 4 +- .../encryption-disabler/setup_uninstall.yml | 2 +- .../tasks/ext/ldap-auth/setup.yml | 2 +- .../ext/mjolnir-antispam/setup_install.yml | 8 +- .../ext/mjolnir-antispam/setup_uninstall.yml | 2 +- .../tasks/ext/rest-auth/setup_install.yml | 6 +- .../tasks/ext/rest-auth/setup_uninstall.yml | 2 +- .../ext/shared-secret-auth/setup_install.yml | 8 +- .../shared-secret-auth/setup_uninstall.yml | 2 +- .../synapse-simple-antispam/setup_install.yml | 10 +-- .../setup_uninstall.yml | 2 +- .../tasks/goofys/setup_install.yml | 8 +- .../tasks/goofys/setup_uninstall.yml | 8 +- .../tasks/import_media_store.yml | 16 ++-- roles/matrix-synapse/tasks/init.yml | 16 ++-- roles/matrix-synapse/tasks/main.yml | 2 +- roles/matrix-synapse/tasks/register_user.yml | 10 +-- .../compress_room.yml | 14 +-- .../rust-synapse-compress-state/main.yml | 26 +++--- .../tasks/self_check_client_api.yml | 6 +- .../tasks/self_check_federation_api.yml | 8 +- roles/matrix-synapse/tasks/setup_synapse.yml | 2 +- .../tasks/synapse/setup_install.yml | 22 ++--- .../tasks/synapse/setup_uninstall.yml | 8 +- .../tasks/synapse/workers/init.yml | 16 ++-- .../tasks/synapse/workers/setup.yml | 4 +- .../tasks/synapse/workers/setup_install.yml | 6 +- .../tasks/synapse/workers/setup_uninstall.yml | 6 +- .../inject_systemd_services_for_worker.yml | 6 +- .../workers/util/setup_files_for_worker.yml | 10 +-- .../tasks/update_user_password.yml | 14 +-- .../matrix-synapse/tasks/validate_config.yml | 10 +-- 297 files changed, 1420 insertions(+), 1420 deletions(-) diff --git a/roles/matrix-aux/tasks/setup.yml b/roles/matrix-aux/tasks/setup.yml index 949c0b4a..87c67d6d 100644 --- a/roles/matrix-aux/tasks/setup.yml +++ b/roles/matrix-aux/tasks/setup.yml @@ -1,7 +1,7 @@ --- - name: Ensure AUX directories are created - file: + ansible.builtin.file: dest: "{{ item.dest }}" state: directory owner: "{{ item.owner|default(matrix_user_username) }}" @@ -10,7 +10,7 @@ with_items: "{{ matrix_aux_directory_definitions }}" - name: Ensure AUX files are created - copy: + ansible.builtin.copy: dest: "{{ item.dest }}" content: "{{ item.content }}" owner: "{{ item.owner|default(matrix_user_username) }}" diff --git a/roles/matrix-backup-borg/tasks/init.yml b/roles/matrix-backup-borg/tasks/init.yml index a82fb7b8..4d853a82 100644 --- a/roles/matrix-backup-borg/tasks/init.yml +++ b/roles/matrix-backup-borg/tasks/init.yml @@ -1,4 +1,4 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-backup-borg.timer'] }}" when: matrix_backup_borg_enabled|bool diff --git a/roles/matrix-backup-borg/tasks/setup_install.yml b/roles/matrix-backup-borg/tasks/setup_install.yml index 6ef39863..c8cf7f24 100644 --- a/roles/matrix-backup-borg/tasks/setup_install.yml +++ b/roles/matrix-backup-borg/tasks/setup_install.yml @@ -3,17 +3,17 @@ - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/detect_existing_postgres_version.yml" - name: Fail if detected Postgres version is unsupported - fail: + ansible.builtin.fail: msg: "You cannot use borg backup with such an old version ({{ matrix_postgres_detected_version }}) of Postgres. Consider upgrading - link to docs for upgrading Postgres: docs/maintenance-postgres.md#upgrading-postgresql" when: "matrix_postgres_detected_version not in matrix_backup_borg_supported_postgres_versions" - name: Set the correct borg backup version to use - set_fact: + ansible.builtin.set_fact: matrix_backup_borg_version: "{{ matrix_postgres_detected_version }}" when: matrix_backup_borg_postgresql_enabled|bool and matrix_backup_borg_version == '' - name: Ensure borg paths exist - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -25,7 +25,7 @@ when: "item.when|bool" - name: Ensure borgmatic config is created - copy: + ansible.builtin.copy: content: "{{ matrix_backup_borg_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_backup_borg_config_path }}/config.yaml" owner: "{{ matrix_user_username }}" @@ -33,7 +33,7 @@ mode: 0640 - name: Ensure borg passwd is created - template: + ansible.builtin.template: src: "{{ role_path }}/templates/passwd.j2" dest: "{{ matrix_backup_borg_config_path }}/passwd" owner: "{{ matrix_user_username }}" @@ -41,7 +41,7 @@ mode: 0640 - name: Ensure borg ssh key is created - template: + ansible.builtin.template: src: "{{ role_path }}/templates/sshkey.j2" dest: "{{ matrix_backup_borg_config_path }}/sshkey" owner: "{{ matrix_user_username }}" @@ -61,7 +61,7 @@ until: result is not failed - name: Ensure borg repository is present on self-build - git: + ansible.builtin.git: repo: "{{ matrix_backup_borg_docker_repo }}" dest: "{{ matrix_backup_borg_docker_src_files_path }}" force: "yes" @@ -83,30 +83,30 @@ when: "matrix_backup_borg_container_image_self_build|bool" - name: Ensure matrix-backup-borg.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-backup-borg.service.j2" dest: "{{ matrix_systemd_path }}/matrix-backup-borg.service" mode: 0644 register: matrix_backup_borg_systemd_service_result - name: Ensure matrix-backup-borg.timer installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-backup-borg.timer.j2" dest: "{{ matrix_systemd_path }}/matrix-backup-borg.timer" mode: 0644 register: matrix_backup_borg_systemd_timer_result - name: Ensure systemd reloaded after matrix-backup-borg.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_backup_borg_systemd_service_result.changed|bool" - name: Ensure matrix-backup-borg.service enabled - service: + ansible.builtin.service: enabled: true name: matrix-backup-borg.service - name: Ensure matrix-backup-borg.timer enabled - service: + ansible.builtin.service: enabled: true name: matrix-backup-borg.timer diff --git a/roles/matrix-backup-borg/tasks/setup_uninstall.yml b/roles/matrix-backup-borg/tasks/setup_uninstall.yml index faad44f7..faed21f8 100644 --- a/roles/matrix-backup-borg/tasks/setup_uninstall.yml +++ b/roles/matrix-backup-borg/tasks/setup_uninstall.yml @@ -5,7 +5,7 @@ register: matrix_backup_borg_service_stat - name: Ensure matrix-backup-borg is stopped - service: + ansible.builtin.service: name: matrix-backup-borg state: stopped enabled: false @@ -14,24 +14,24 @@ when: "matrix_backup_borg_service_stat.stat.exists|bool" - name: Ensure matrix-backup-borg.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-backup-borg.service" state: absent when: "matrix_backup_borg_service_stat.stat.exists|bool" - name: Ensure matrix-backup-borg.timer doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-backup-borg.timer" state: absent when: "matrix_backup_borg_service_stat.stat.exists|bool" - name: Ensure systemd reloaded after matrix-backup-borg.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_backup_borg_service_stat.stat.exists|bool" - name: Ensure Matrix borg paths don't exist - file: + ansible.builtin.file: path: "{{ matrix_backup_borg_base_path }}" state: absent diff --git a/roles/matrix-backup-borg/tasks/validate_config.yml b/roles/matrix-backup-borg/tasks/validate_config.yml index 84b78d1e..66e487dd 100644 --- a/roles/matrix-backup-borg/tasks/validate_config.yml +++ b/roles/matrix-backup-borg/tasks/validate_config.yml @@ -1,6 +1,6 @@ --- - name: Fail if required settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). when: "vars[item] == ''" @@ -9,7 +9,7 @@ - "matrix_backup_borg_location_repositories" - name: Fail if encryption passphrase is undefined unless repository is unencrypted - fail: + ansible.builtin.fail: msg: >- You need to define a required passphrase using the `matrix_backup_borg_storage_encryption_passphrase` variable. when: "matrix_backup_borg_storage_encryption_passphrase == '' and matrix_backup_borg_encryption != 'none'" diff --git a/roles/matrix-base/tasks/clean_up_old_files.yml b/roles/matrix-base/tasks/clean_up_old_files.yml index 03eb8bcc..b79c01b3 100644 --- a/roles/matrix-base/tasks/clean_up_old_files.yml +++ b/roles/matrix-base/tasks/clean_up_old_files.yml @@ -1,7 +1,7 @@ --- - name: Get rid of old files and directories - file: + ansible.builtin.file: path: "{{ item }}" state: absent with_items: diff --git a/roles/matrix-base/tasks/sanity_check.yml b/roles/matrix-base/tasks/sanity_check.yml index 98fa2738..29ae8419 100644 --- a/roles/matrix-base/tasks/sanity_check.yml +++ b/roles/matrix-base/tasks/sanity_check.yml @@ -1,27 +1,27 @@ --- - name: Fail if invalid homeserver implementation - fail: + ansible.builtin.fail: msg: "You need to set a valid homeserver implementation in `matrix_homeserver_implementation`" when: "matrix_homeserver_implementation not in ['synapse', 'dendrite']" # We generally support Ansible 2.7.1 and above. - name: Fail if running on Ansible < 2.7.1 - fail: + ansible.builtin.fail: msg: "You are running on Ansible {{ ansible_version.string }}, which is not supported. See our guide about Ansible: https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/master/docs/ansible.md" when: - "(ansible_version.major < 2) or (ansible_version.major == 2 and ansible_version.minor < 7) or (ansible_version.major == 2 and ansible_version.minor == 7 and ansible_version.revision < 1)" # Though we do not support Ansible 2.9.6 which is buggy - name: Fail if running on Ansible 2.9.6 on Ubuntu - fail: + ansible.builtin.fail: msg: "You are running on Ansible {{ ansible_version.string }}, which is not supported. See our guide about Ansible: https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/master/docs/ansible.md" when: - ansible_distribution == 'Ubuntu' - "ansible_version.major == 2 and ansible_version.minor == 9 and ansible_version.revision == 6" - name: (Deprecation) Catch and report renamed settings - fail: + ansible.builtin.fail: msg: >- Your configuration contains a variable, which now has a different name. Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`). @@ -35,7 +35,7 @@ # We have a dedicated check for this variable, because we'd like to have a custom (friendlier) message. - name: Fail if matrix_homeserver_generic_secret_key is undefined - fail: + ansible.builtin.fail: msg: | The `matrix_homeserver_generic_secret_key` variable must be defined and have a non-null and non-empty value. @@ -47,7 +47,7 @@ when: "matrix_homeserver_generic_secret_key is none or matrix_homeserver_generic_secret_key == ''" - name: Fail if required variables are undefined - fail: + 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('') }}"} @@ -58,7 +58,7 @@ when: "item.value is none or item.value == ''" - name: Fail if uppercase domain used - fail: + ansible.builtin.fail: msg: "Detected that you're using an uppercase domain name - `{{ item }}`. This will cause trouble. Please use all-lowercase!" with_items: - "{{ matrix_domain }}" @@ -67,21 +67,21 @@ when: "item != item|lower" - name: Fail if using python2 on Archlinux - fail: + ansible.builtin.fail: msg: "Detected that you're using python2 when installing onto Archlinux. Archlinux by default only supports python3." when: - ansible_distribution == 'Archlinux' - ansible_python.version.major != 3 - name: Fail if architecture is set incorrectly - fail: + ansible.builtin.fail: msg: "Detected that variable matrix_architecture {{ matrix_architecture }} appears to be set incorrectly. See docs/alternative-architectures.md. Server appears to be {{ ansible_architecture }}." when: (ansible_architecture == "x86_64" and matrix_architecture != "amd64") or (ansible_architecture == "aarch64" and matrix_architecture != "arm64") or (ansible_architecture.startswith("armv") and matrix_architecture != "arm32") - name: Fail if encountering usage of removed role (mx-puppet-skype) - fail: + ansible.builtin.fail: msg: >- Your configuration seems to include a reference to `matrix_mx_puppet_skype_enabled`. Are you trying to install the mx-puppet-skype bridge? The playbook no longer includes a role for installing mx-puppet-skype, because the mx-puppet-bridge is unmaintained and has been reported as broken for a long time. diff --git a/roles/matrix-base/tasks/server_base/setup.yml b/roles/matrix-base/tasks/server_base/setup.yml index bbfa077c..c5145e55 100644 --- a/roles/matrix-base/tasks/server_base/setup.yml +++ b/roles/matrix-base/tasks/server_base/setup.yml @@ -12,7 +12,7 @@ - block: # ansible_lsb is only available if lsb-release is installed. - name: Ensure lsb-release installed - apt: + ansible.builtin.apt: name: - lsb-release state: present @@ -34,13 +34,13 @@ when: ansible_distribution == 'Archlinux' - name: Ensure Docker is started and autoruns - service: + ansible.builtin.service: name: docker state: started enabled: true - name: "Ensure {{ matrix_ntpd_service }} is started and autoruns" - service: + ansible.builtin.service: name: "{{ matrix_ntpd_service }}" state: started enabled: true diff --git a/roles/matrix-base/tasks/server_base/setup_debian.yml b/roles/matrix-base/tasks/server_base/setup_debian.yml index 5b169df7..a45cd377 100644 --- a/roles/matrix-base/tasks/server_base/setup_debian.yml +++ b/roles/matrix-base/tasks/server_base/setup_debian.yml @@ -1,7 +1,7 @@ --- - name: Ensure APT usage dependencies are installed - apt: + ansible.builtin.apt: name: - apt-transport-https - ca-certificates @@ -26,14 +26,14 @@ when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce' - name: Ensure APT packages are installed - apt: + ansible.builtin.apt: name: - "{{ matrix_ntpd_package }}" state: latest update_cache: true - name: Ensure Docker is installed - apt: + ansible.builtin.apt: name: - "{{ matrix_docker_package_name }}" - "python{{'3' if ansible_python.version.major == 3 else ''}}-docker" diff --git a/roles/matrix-base/tasks/server_base/setup_fedora.yml b/roles/matrix-base/tasks/server_base/setup_fedora.yml index 7369b6ad..c83d8844 100644 --- a/roles/matrix-base/tasks/server_base/setup_fedora.yml +++ b/roles/matrix-base/tasks/server_base/setup_fedora.yml @@ -1,7 +1,7 @@ --- - name: Ensure Docker repository is enabled - template: + ansible.builtin.template: src: "{{ role_path }}/files/yum.repos.d/{{ item }}" dest: "/etc/yum.repos.d/docker-ce.repo" owner: "root" @@ -18,14 +18,14 @@ when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce' - name: Ensure yum packages are installed - yum: + ansible.builtin.yum: name: - "{{ matrix_ntpd_package }}" state: latest update_cache: true - name: Ensure Docker is installed - yum: + ansible.builtin.yum: name: - "{{ matrix_docker_package_name }}" - python3-pip diff --git a/roles/matrix-base/tasks/server_base/setup_raspbian.yml b/roles/matrix-base/tasks/server_base/setup_raspbian.yml index 6a09f2fe..e3406ed5 100644 --- a/roles/matrix-base/tasks/server_base/setup_raspbian.yml +++ b/roles/matrix-base/tasks/server_base/setup_raspbian.yml @@ -1,7 +1,7 @@ --- - name: Ensure APT usage dependencies are installed - apt: + ansible.builtin.apt: name: - apt-transport-https - ca-certificates @@ -26,14 +26,14 @@ when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce' - name: Ensure APT packages are installed - apt: + ansible.builtin.apt: name: - "{{ matrix_ntpd_package }}" state: latest update_cache: true - name: Ensure Docker is installed - apt: + ansible.builtin.apt: name: - "{{ matrix_docker_package_name }}" - "python{{'3' if ansible_python.version.major == 3 else ''}}-docker" diff --git a/roles/matrix-base/tasks/server_base/setup_redhat.yml b/roles/matrix-base/tasks/server_base/setup_redhat.yml index b4be1d08..88061c71 100644 --- a/roles/matrix-base/tasks/server_base/setup_redhat.yml +++ b/roles/matrix-base/tasks/server_base/setup_redhat.yml @@ -1,7 +1,7 @@ --- - name: Ensure Docker repository is enabled - template: + ansible.builtin.template: src: "{{ role_path }}/files/yum.repos.d/docker-ce-centos.repo" dest: "/etc/yum.repos.d/docker-ce.repo" owner: "root" @@ -16,14 +16,14 @@ when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce' - name: Ensure yum packages are installed - yum: + ansible.builtin.yum: name: - "{{ matrix_ntpd_package }}" state: latest update_cache: true - name: Ensure Docker is installed - yum: + ansible.builtin.yum: name: - "{{ matrix_docker_package_name }}" - docker-python diff --git a/roles/matrix-base/tasks/server_base/setup_redhat8.yml b/roles/matrix-base/tasks/server_base/setup_redhat8.yml index d9dd6e23..d2eca681 100644 --- a/roles/matrix-base/tasks/server_base/setup_redhat8.yml +++ b/roles/matrix-base/tasks/server_base/setup_redhat8.yml @@ -1,7 +1,7 @@ --- - name: Ensure Docker repository is enabled - template: + ansible.builtin.template: src: "{{ role_path }}/files/yum.repos.d/docker-ce-centos.repo" dest: "/etc/yum.repos.d/docker-ce.repo" owner: "root" @@ -16,21 +16,21 @@ when: matrix_docker_installation_enabled|bool and matrix_docker_package_name == 'docker-ce' - name: Ensure EPEL is installed - yum: + ansible.builtin.yum: name: - epel-release state: latest update_cache: true - name: Ensure yum packages are installed - yum: + ansible.builtin.yum: name: - "{{ matrix_ntpd_package }}" state: latest update_cache: true - name: Ensure Docker is installed - yum: + ansible.builtin.yum: name: - "{{ matrix_docker_package_name }}" - python3-pip diff --git a/roles/matrix-base/tasks/setup_matrix_base.yml b/roles/matrix-base/tasks/setup_matrix_base.yml index 0fad2b3d..100b7e7c 100644 --- a/roles/matrix-base/tasks/setup_matrix_base.yml +++ b/roles/matrix-base/tasks/setup_matrix_base.yml @@ -1,7 +1,7 @@ --- - name: Ensure Matrix base path exists - file: + ansible.builtin.file: path: "{{ item }}" state: directory mode: "{{ matrix_base_data_path_mode }}" @@ -11,7 +11,7 @@ - "{{ matrix_base_data_path }}" - name: Preserve vars.yml on the server for easily restoring if it gets lost later on - copy: + ansible.builtin.copy: src: "{{ matrix_vars_yml_snapshotting_src }}" dest: "{{ matrix_base_data_path }}/vars.yml" owner: "{{ matrix_user_username }}" @@ -25,7 +25,7 @@ driver: bridge - name: Ensure matrix-remove-all script created - template: + ansible.builtin.template: src: "{{ role_path }}/templates/usr-local-bin/matrix-remove-all.j2" dest: "{{ matrix_local_bin_path }}/matrix-remove-all" mode: 0750 diff --git a/roles/matrix-base/tasks/setup_matrix_user.yml b/roles/matrix-base/tasks/setup_matrix_user.yml index 41604f87..0435b7a3 100644 --- a/roles/matrix-base/tasks/setup_matrix_user.yml +++ b/roles/matrix-base/tasks/setup_matrix_user.yml @@ -1,18 +1,18 @@ --- - name: Ensure Matrix group is created - group: + ansible.builtin.group: name: "{{ matrix_user_groupname }}" gid: "{{ omit if matrix_user_gid is none else matrix_user_gid }}" state: present register: matrix_group - name: Set Matrix Group GID Variable - set_fact: + ansible.builtin.set_fact: matrix_user_gid: "{{ matrix_group.gid }}" - name: Ensure Matrix user is created - user: + ansible.builtin.user: name: "{{ matrix_user_username }}" uid: "{{ omit if matrix_user_uid is none else matrix_user_uid }}" state: present @@ -23,5 +23,5 @@ register: matrix_user - name: Set Matrix Group UID Variable - set_fact: + ansible.builtin.set_fact: matrix_user_uid: "{{ matrix_user.uid }}" diff --git a/roles/matrix-base/tasks/setup_well_known.yml b/roles/matrix-base/tasks/setup_well_known.yml index da9b534f..c4a5c236 100644 --- a/roles/matrix-base/tasks/setup_well_known.yml +++ b/roles/matrix-base/tasks/setup_well_known.yml @@ -4,7 +4,7 @@ # # For running with another webserver, we recommend being part of the `matrix` group. - name: Ensure Matrix static-files path exists - file: + ansible.builtin.file: path: "{{ item }}" state: directory mode: 0755 @@ -14,7 +14,7 @@ - "{{ matrix_static_files_base_path }}/.well-known/matrix" - name: Ensure Matrix /.well-known/matrix/client file configured - copy: + ansible.builtin.copy: content: "{{ matrix_well_known_matrix_client_configuration|to_nice_json }}" dest: "{{ matrix_static_files_base_path }}/.well-known/matrix/client" mode: 0644 @@ -22,7 +22,7 @@ group: "{{ matrix_user_groupname }}" - name: Ensure Matrix /.well-known/matrix/server file configured - copy: + ansible.builtin.copy: content: "{{ matrix_well_known_matrix_server_configuration|to_nice_json }}" dest: "{{ matrix_static_files_base_path }}/.well-known/matrix/server" mode: 0644 @@ -31,7 +31,7 @@ when: matrix_well_known_matrix_server_enabled|bool - name: Ensure Matrix /.well-known/matrix/server file deleted - file: + ansible.builtin.file: path: "{{ matrix_static_files_base_path }}/.well-known/matrix/server" state: absent when: "not matrix_well_known_matrix_server_enabled|bool" diff --git a/roles/matrix-base/tasks/util/ensure_fuse_installed.yml b/roles/matrix-base/tasks/util/ensure_fuse_installed.yml index 7a3fde41..dfb1ddc8 100644 --- a/roles/matrix-base/tasks/util/ensure_fuse_installed.yml +++ b/roles/matrix-base/tasks/util/ensure_fuse_installed.yml @@ -1,7 +1,7 @@ --- # This is for both RedHat 7 and 8 - name: Ensure fuse installed (RedHat) - yum: + ansible.builtin.yum: name: - fuse state: latest @@ -9,7 +9,7 @@ # This is for both Debian and Raspbian - name: Ensure fuse installed (Debian/Raspbian) - apt: + ansible.builtin.apt: name: - fuse state: latest diff --git a/roles/matrix-base/tasks/util/ensure_openssl_installed.yml b/roles/matrix-base/tasks/util/ensure_openssl_installed.yml index 53fc9b03..909c0f1c 100644 --- a/roles/matrix-base/tasks/util/ensure_openssl_installed.yml +++ b/roles/matrix-base/tasks/util/ensure_openssl_installed.yml @@ -1,7 +1,7 @@ --- # This is for both RedHat 7 and 8 - name: Ensure openssl installed (RedHat) - yum: + ansible.builtin.yum: name: - openssl state: latest @@ -9,7 +9,7 @@ # This is for both Debian and Raspbian - name: Ensure openssl installed (Debian/Raspbian) - apt: + ansible.builtin.apt: name: - openssl state: latest diff --git a/roles/matrix-bot-buscarron/tasks/init.yml b/roles/matrix-bot-buscarron/tasks/init.yml index 3da32948..37c0932e 100644 --- a/roles/matrix-bot-buscarron/tasks/init.yml +++ b/roles/matrix-bot-buscarron/tasks/init.yml @@ -1,5 +1,5 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-bot-buscarron.service'] }}" when: matrix_bot_buscarron_enabled|bool diff --git a/roles/matrix-bot-buscarron/tasks/setup_install.yml b/roles/matrix-bot-buscarron/tasks/setup_install.yml index 0ebe7e42..6559a95a 100644 --- a/roles/matrix-bot-buscarron/tasks/setup_install.yml +++ b/roles/matrix-bot-buscarron/tasks/setup_install.yml @@ -1,5 +1,5 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_bot_buscarron_requires_restart: false - block: @@ -9,7 +9,7 @@ register: matrix_bot_buscarron_sqlite_database_path_local_stat_result - block: - - set_fact: + - ansible.builtin.set_fact: matrix_postgres_db_migration_request: src: "{{ matrix_bot_buscarron_sqlite_database_path_local }}" dst: "{{ matrix_bot_buscarron_database_connection_string }}" @@ -20,13 +20,13 @@ - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" - - set_fact: + - 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_database_engine == 'postgres'" - name: Ensure buscarron paths exist - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -40,7 +40,7 @@ when: "item.when|bool" - name: Ensure buscarron environment variables file created - template: + ansible.builtin.template: src: "{{ role_path }}/templates/env.j2" dest: "{{ matrix_bot_buscarron_config_path }}/env" owner: "{{ matrix_user_username }}" @@ -60,7 +60,7 @@ until: result is not failed - name: Ensure buscarron repository is present on self-build - git: + ansible.builtin.git: repo: "{{ matrix_bot_buscarron_docker_repo }}" dest: "{{ matrix_bot_buscarron_docker_src_files_path }}" force: "yes" @@ -82,19 +82,19 @@ when: "matrix_bot_buscarron_container_image_self_build|bool" - name: Ensure matrix-bot-buscarron.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-bot-buscarron.service.j2" dest: "{{ matrix_systemd_path }}/matrix-bot-buscarron.service" mode: 0644 register: matrix_bot_buscarron_systemd_service_result - name: Ensure systemd reloaded after matrix-bot-buscarron.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_bot_buscarron_systemd_service_result.changed|bool" - name: Ensure matrix-bot-buscarron.service restarted, if necessary - service: + ansible.builtin.service: name: "matrix-bot-buscarron.service" state: restarted 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 cc70e79a..5dd26653 100644 --- a/roles/matrix-bot-buscarron/tasks/setup_uninstall.yml +++ b/roles/matrix-bot-buscarron/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_bot_buscarron_service_stat - name: Ensure matrix-buscarron is stopped - service: + ansible.builtin.service: name: matrix-bot-buscarron state: stopped enabled: false @@ -15,18 +15,18 @@ when: "matrix_bot_buscarron_service_stat.stat.exists|bool" - name: Ensure matrix-bot-buscarron.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-bot-buscarron.service" state: absent when: "matrix_bot_buscarron_service_stat.stat.exists|bool" - name: Ensure systemd reloaded after matrix-bot-buscarron.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_bot_buscarron_service_stat.stat.exists|bool" - name: Ensure Matrix buscarron paths don't exist - file: + ansible.builtin.file: path: "{{ matrix_bot_buscarron_base_path }}" state: absent diff --git a/roles/matrix-bot-buscarron/tasks/validate_config.yml b/roles/matrix-bot-buscarron/tasks/validate_config.yml index 5a517d39..04238012 100644 --- a/roles/matrix-bot-buscarron/tasks/validate_config.yml +++ b/roles/matrix-bot-buscarron/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). when: "vars[item] == ''" diff --git a/roles/matrix-bot-go-neb/tasks/init.yml b/roles/matrix-bot-go-neb/tasks/init.yml index b046d494..a1b57ec6 100644 --- a/roles/matrix-bot-go-neb/tasks/init.yml +++ b/roles/matrix-bot-go-neb/tasks/init.yml @@ -1,5 +1,5 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-bot-go-neb.service'] }}" when: matrix_bot_go_neb_enabled|bool diff --git a/roles/matrix-bot-go-neb/tasks/setup_install.yml b/roles/matrix-bot-go-neb/tasks/setup_install.yml index ef2dfbb0..71d5168a 100644 --- a/roles/matrix-bot-go-neb/tasks/setup_install.yml +++ b/roles/matrix-bot-go-neb/tasks/setup_install.yml @@ -1,10 +1,10 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_bot_go_neb_requires_restart: false - name: Ensure go-neb paths exist - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -28,7 +28,7 @@ until: result is not failed - name: Ensure go-neb config installed - copy: + ansible.builtin.copy: content: "{{ matrix_bot_go_neb_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_bot_go_neb_config_path }}/config.yaml" mode: 0644 @@ -36,19 +36,19 @@ group: "{{ matrix_user_groupname }}" - name: Ensure matrix-bot-go-neb.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-bot-go-neb.service.j2" dest: "{{ matrix_systemd_path }}/matrix-bot-go-neb.service" mode: 0644 register: matrix_bot_go_neb_systemd_service_result - name: Ensure systemd reloaded after matrix-bot-go-neb.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_bot_go_neb_systemd_service_result.changed|bool" - name: Ensure matrix-bot-go-neb.service restarted, if necessary - service: + ansible.builtin.service: name: "matrix-bot-go-neb.service" state: restarted 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 a009badf..d27377c1 100644 --- a/roles/matrix-bot-go-neb/tasks/setup_uninstall.yml +++ b/roles/matrix-bot-go-neb/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_bot_go_neb_service_stat - name: Ensure matrix-go-neb is stopped - service: + ansible.builtin.service: name: matrix-bot-go-neb state: stopped enabled: false @@ -15,18 +15,18 @@ when: "matrix_bot_go_neb_service_stat.stat.exists|bool" - name: Ensure matrix-bot-go-neb.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-bot-go-neb.service" state: absent when: "matrix_bot_go_neb_service_stat.stat.exists|bool" - name: Ensure systemd reloaded after matrix-bot-go-neb.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_bot_go_neb_service_stat.stat.exists|bool" - name: Ensure Matrix go-neb paths don't exist - file: + ansible.builtin.file: path: "{{ matrix_bot_go_neb_base_path }}" state: absent diff --git a/roles/matrix-bot-go-neb/tasks/validate_config.yml b/roles/matrix-bot-go-neb/tasks/validate_config.yml index 7b292250..72bc3cb4 100644 --- a/roles/matrix-bot-go-neb/tasks/validate_config.yml +++ b/roles/matrix-bot-go-neb/tasks/validate_config.yml @@ -1,13 +1,13 @@ --- - name: Fail if there's not at least 1 client - fail: + ansible.builtin.fail: msg: >- You need at least 1 client in the matrix_bot_go_neb_clients block. when: matrix_bot_go_neb_clients is not defined or matrix_bot_go_neb_clients[0] is not defined - name: Fail if there's not at least 1 service - fail: + ansible.builtin.fail: msg: >- You need at least 1 service in the matrix_bot_go_neb_services block. when: matrix_bot_go_neb_services is not defined or matrix_bot_go_neb_services[0] is not defined diff --git a/roles/matrix-bot-honoroit/tasks/init.yml b/roles/matrix-bot-honoroit/tasks/init.yml index 5ace015b..2a5ea4d7 100644 --- a/roles/matrix-bot-honoroit/tasks/init.yml +++ b/roles/matrix-bot-honoroit/tasks/init.yml @@ -1,5 +1,5 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-bot-honoroit.service'] }}" when: matrix_bot_honoroit_enabled|bool diff --git a/roles/matrix-bot-honoroit/tasks/setup_install.yml b/roles/matrix-bot-honoroit/tasks/setup_install.yml index 584df9b7..2f7bb9a4 100644 --- a/roles/matrix-bot-honoroit/tasks/setup_install.yml +++ b/roles/matrix-bot-honoroit/tasks/setup_install.yml @@ -1,5 +1,5 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_bot_honoroit_requires_restart: false - block: @@ -9,7 +9,7 @@ register: matrix_bot_honoroit_sqlite_database_path_local_stat_result - block: - - set_fact: + - ansible.builtin.set_fact: matrix_postgres_db_migration_request: src: "{{ matrix_bot_honoroit_sqlite_database_path_local }}" dst: "{{ matrix_bot_honoroit_database_connection_string }}" @@ -20,13 +20,13 @@ - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" - - set_fact: + - 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_database_engine == 'postgres'" - name: Ensure honoroit paths exist - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -40,7 +40,7 @@ when: "item.when|bool" - name: Ensure honoroit environment variables file created - template: + ansible.builtin.template: src: "{{ role_path }}/templates/env.j2" dest: "{{ matrix_bot_honoroit_config_path }}/env" owner: "{{ matrix_user_username }}" @@ -60,7 +60,7 @@ until: result is not failed - name: Ensure honoroit repository is present on self-build - git: + ansible.builtin.git: repo: "{{ matrix_bot_honoroit_docker_repo }}" dest: "{{ matrix_bot_honoroit_docker_src_files_path }}" force: "yes" @@ -82,19 +82,19 @@ when: "matrix_bot_honoroit_container_image_self_build|bool" - name: Ensure matrix-bot-honoroit.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-bot-honoroit.service.j2" dest: "{{ matrix_systemd_path }}/matrix-bot-honoroit.service" mode: 0644 register: matrix_bot_honoroit_systemd_service_result - name: Ensure systemd reloaded after matrix-bot-honoroit.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_bot_honoroit_systemd_service_result.changed|bool" - name: Ensure matrix-bot-honoroit.service restarted, if necessary - service: + ansible.builtin.service: name: "matrix-bot-honoroit.service" state: restarted 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 45bccabd..7bb6b8f1 100644 --- a/roles/matrix-bot-honoroit/tasks/setup_uninstall.yml +++ b/roles/matrix-bot-honoroit/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_bot_honoroit_service_stat - name: Ensure matrix-honoroit is stopped - service: + ansible.builtin.service: name: matrix-bot-honoroit state: stopped enabled: false @@ -15,18 +15,18 @@ when: "matrix_bot_honoroit_service_stat.stat.exists|bool" - name: Ensure matrix-bot-honoroit.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-bot-honoroit.service" state: absent when: "matrix_bot_honoroit_service_stat.stat.exists|bool" - name: Ensure systemd reloaded after matrix-bot-honoroit.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_bot_honoroit_service_stat.stat.exists|bool" - name: Ensure Matrix honoroit paths don't exist - file: + ansible.builtin.file: path: "{{ matrix_bot_honoroit_base_path }}" state: absent diff --git a/roles/matrix-bot-honoroit/tasks/validate_config.yml b/roles/matrix-bot-honoroit/tasks/validate_config.yml index 562bf9fb..0057e3c2 100644 --- a/roles/matrix-bot-honoroit/tasks/validate_config.yml +++ b/roles/matrix-bot-honoroit/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). when: "vars[item] == ''" diff --git a/roles/matrix-bot-matrix-registration-bot/tasks/init.yml b/roles/matrix-bot-matrix-registration-bot/tasks/init.yml index 03235b80..c3988eb2 100644 --- a/roles/matrix-bot-matrix-registration-bot/tasks/init.yml +++ b/roles/matrix-bot-matrix-registration-bot/tasks/init.yml @@ -1,5 +1,5 @@ --- -- set_fact: +- 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 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 716d67bc..6fd17ee8 100644 --- a/roles/matrix-bot-matrix-registration-bot/tasks/setup_install.yml +++ b/roles/matrix-bot-matrix-registration-bot/tasks/setup_install.yml @@ -1,7 +1,7 @@ --- - name: Ensure matrix-registration-bot paths exist - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -14,7 +14,7 @@ when: "item.when|bool" - name: Ensure matrix-registration-bot configuration file created - template: + ansible.builtin.template: src: "{{ role_path }}/templates/config/config.yml.j2" dest: "{{ matrix_bot_matrix_registration_bot_config_path }}/config.yml" owner: "{{ matrix_user_username }}" @@ -34,7 +34,7 @@ until: result is not failed - name: Ensure matrix-registration-bot repository is present on self-build - git: + ansible.builtin.git: repo: "{{ matrix_bot_matrix_registration_bot_docker_repo }}" dest: "{{ matrix_bot_matrix_registration_bot_docker_src_files_path }}" force: "yes" @@ -56,18 +56,18 @@ when: "matrix_bot_matrix_registration_bot_container_image_self_build|bool" - name: Ensure matrix-bot-matrix-registration-bot.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-bot-matrix-registration-bot.service.j2" dest: "{{ matrix_systemd_path }}/matrix-bot-matrix-registration-bot.service" mode: 0644 register: matrix_bot_matrix_registration_bot_systemd_service_result - name: Ensure systemd reloaded after matrix-bot-matrix-registration-bot.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_bot_matrix_registration_bot_systemd_service_result.changed|bool" - name: Ensure matrix-bot-matrix-registration-bot.service restarted, if necessary - service: + ansible.builtin.service: name: "matrix-bot-matrix-registration-bot.service" state: restarted 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 9881592f..5a2dbc26 100644 --- a/roles/matrix-bot-matrix-registration-bot/tasks/setup_uninstall.yml +++ b/roles/matrix-bot-matrix-registration-bot/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_bot_matrix_registration_bot_service_stat - name: Ensure matrix-matrix-registration-bot is stopped - service: + ansible.builtin.service: name: matrix-bot-matrix-registration-bot state: stopped enabled: false @@ -15,18 +15,18 @@ when: "matrix_bot_matrix_registration_bot_service_stat.stat.exists|bool" - name: Ensure matrix-bot-matrix-registration-bot.service doesn't exist - file: + 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" - name: Ensure systemd reloaded after matrix-bot-matrix-registration-bot.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_bot_matrix_registration_bot_service_stat.stat.exists|bool" - name: Ensure Matrix matrix-registration-bot paths don't exist - file: + ansible.builtin.file: path: "{{ matrix_bot_matrix_registration_bot_base_path }}" state: absent diff --git a/roles/matrix-bot-matrix-registration-bot/tasks/validate_config.yml b/roles/matrix-bot-matrix-registration-bot/tasks/validate_config.yml index d5db028d..39e97cde 100644 --- a/roles/matrix-bot-matrix-registration-bot/tasks/validate_config.yml +++ b/roles/matrix-bot-matrix-registration-bot/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). when: "vars[item] == ''" diff --git a/roles/matrix-bot-matrix-reminder-bot/tasks/init.yml b/roles/matrix-bot-matrix-reminder-bot/tasks/init.yml index 41496955..cae7074c 100644 --- a/roles/matrix-bot-matrix-reminder-bot/tasks/init.yml +++ b/roles/matrix-bot-matrix-reminder-bot/tasks/init.yml @@ -1,5 +1,5 @@ --- -- set_fact: +- 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 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 d7f4706f..3abda733 100644 --- a/roles/matrix-bot-matrix-reminder-bot/tasks/setup_install.yml +++ b/roles/matrix-bot-matrix-reminder-bot/tasks/setup_install.yml @@ -1,6 +1,6 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_bot_matrix_reminder_bot_requires_restart: false - block: @@ -10,7 +10,7 @@ register: matrix_bot_matrix_reminder_bot_sqlite_database_path_local_stat_result - block: - - set_fact: + - ansible.builtin.set_fact: matrix_postgres_db_migration_request: src: "{{ matrix_bot_matrix_reminder_bot_sqlite_database_path_local }}" dst: "{{ matrix_bot_matrix_reminder_bot_database_connection_string }}" @@ -21,13 +21,13 @@ - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" - - set_fact: + - 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_database_engine == 'postgres'" - name: Ensure matrix-reminder-bot paths exist - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -53,7 +53,7 @@ until: result is not failed - name: Ensure matrix-reminder-bot repository is present on self-build - git: + ansible.builtin.git: repo: "{{ matrix_bot_matrix_reminder_bot_docker_repo }}" dest: "{{ matrix_bot_matrix_reminder_bot_docker_src_files_path }}" force: "yes" @@ -75,7 +75,7 @@ when: "matrix_bot_matrix_reminder_bot_container_image_self_build|bool" - name: Ensure matrix-reminder-bot config installed - copy: + ansible.builtin.copy: 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 @@ -83,19 +83,19 @@ group: "{{ matrix_user_groupname }}" - name: Ensure matrix-bot-matrix-reminder-bot.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-bot-matrix-reminder-bot.service.j2" dest: "{{ matrix_systemd_path }}/matrix-bot-matrix-reminder-bot.service" mode: 0644 register: matrix_bot_matrix_reminder_bot_systemd_service_result - name: Ensure systemd reloaded after matrix-bot-matrix-reminder-bot.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_bot_matrix_reminder_bot_systemd_service_result.changed|bool" - name: Ensure matrix-bot-matrix-reminder-bot.service restarted, if necessary - service: + ansible.builtin.service: name: "matrix-bot-matrix-reminder-bot.service" state: restarted 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 eb7543c5..1b5201e7 100644 --- a/roles/matrix-bot-matrix-reminder-bot/tasks/setup_uninstall.yml +++ b/roles/matrix-bot-matrix-reminder-bot/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_bot_matrix_reminder_bot_service_stat - name: Ensure matrix-matrix-reminder-bot is stopped - service: + ansible.builtin.service: name: matrix-bot-matrix-reminder-bot state: stopped enabled: false @@ -15,18 +15,18 @@ when: "matrix_bot_matrix_reminder_bot_service_stat.stat.exists|bool" - name: Ensure matrix-bot-matrix-reminder-bot.service doesn't exist - file: + 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" - name: Ensure systemd reloaded after matrix-bot-matrix-reminder-bot.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_bot_matrix_reminder_bot_service_stat.stat.exists|bool" - name: Ensure Matrix matrix-reminder-bot paths don't exist - file: + ansible.builtin.file: path: "{{ matrix_bot_matrix_reminder_bot_base_path }}" state: absent diff --git a/roles/matrix-bot-matrix-reminder-bot/tasks/validate_config.yml b/roles/matrix-bot-matrix-reminder-bot/tasks/validate_config.yml index 8963a312..54f38dd5 100644 --- a/roles/matrix-bot-matrix-reminder-bot/tasks/validate_config.yml +++ b/roles/matrix-bot-matrix-reminder-bot/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). when: "vars[item] == ''" @@ -10,7 +10,7 @@ - "matrix_bot_matrix_reminder_bot_reminders_timezone" - name: (Deprecation) Catch and report renamed settings - fail: + ansible.builtin.fail: msg: >- Your configuration contains a variable, which now has a different name. Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`). diff --git a/roles/matrix-bot-mjolnir/tasks/init.yml b/roles/matrix-bot-mjolnir/tasks/init.yml index e09964ec..5955a6f4 100644 --- a/roles/matrix-bot-mjolnir/tasks/init.yml +++ b/roles/matrix-bot-mjolnir/tasks/init.yml @@ -2,10 +2,10 @@ # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 - name: Fail if trying to self-build on Ansible < 2.8 - fail: + ansible.builtin.fail: msg: "To self-build the Mjolnir 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_bot_mjolnir_container_image_self_build and matrix_bot_mjolnir_enabled" -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-bot-mjolnir.service'] }}" when: matrix_bot_mjolnir_enabled|bool diff --git a/roles/matrix-bot-mjolnir/tasks/setup_install.yml b/roles/matrix-bot-mjolnir/tasks/setup_install.yml index 66f2806a..f9e73964 100644 --- a/roles/matrix-bot-mjolnir/tasks/setup_install.yml +++ b/roles/matrix-bot-mjolnir/tasks/setup_install.yml @@ -1,10 +1,10 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_bot_mjolnir_requires_restart: false - name: Ensure matrix-bot-mjolnir paths exist - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -30,7 +30,7 @@ until: result is not failed - name: Ensure mjolnir repository is present on self-build - git: + ansible.builtin.git: repo: "{{ matrix_bot_mjolnir_container_image_self_build_repo }}" dest: "{{ matrix_bot_mjolnir_docker_src_files_path }}" version: "{{ matrix_bot_mjolnir_docker_image.split(':')[1] }}" @@ -52,7 +52,7 @@ when: "matrix_bot_mjolnir_container_image_self_build|bool" - name: Ensure matrix-bot-mjolnir config installed - copy: + ansible.builtin.copy: content: "{{ matrix_bot_mjolnir_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_bot_mjolnir_config_path }}/production.yaml" mode: 0644 @@ -60,19 +60,19 @@ group: "{{ matrix_user_groupname }}" - name: Ensure matrix-bot-mjolnir.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-bot-mjolnir.service.j2" dest: "{{ matrix_systemd_path }}/matrix-bot-mjolnir.service" mode: 0644 register: matrix_bot_mjolnir_systemd_service_result - name: Ensure systemd reloaded after matrix-bot-mjolnir.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_bot_mjolnir_systemd_service_result.changed|bool" - name: Ensure matrix-bot-mjolnir.service restarted, if necessary - service: + ansible.builtin.service: name: "matrix-bot-mjolnir.service" state: restarted 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 93585977..d7a240e7 100644 --- a/roles/matrix-bot-mjolnir/tasks/setup_uninstall.yml +++ b/roles/matrix-bot-mjolnir/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_bot_mjolnir_service_stat - name: Ensure matrix-bot-mjolnir is stopped - service: + ansible.builtin.service: name: matrix-bot-mjolnir state: stopped enabled: false @@ -15,18 +15,18 @@ when: "matrix_bot_mjolnir_service_stat.stat.exists|bool" - name: Ensure matrix-bot-mjolnir.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-bot-mjolnir.service" state: absent when: "matrix_bot_mjolnir_service_stat.stat.exists|bool" - name: Ensure systemd reloaded after matrix-bot-mjolnir.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_bot_mjolnir_service_stat.stat.exists|bool" - name: Ensure matrix-bot-mjolnir paths don't exist - file: + ansible.builtin.file: path: "{{ matrix_bot_mjolnir_base_path }}" state: absent diff --git a/roles/matrix-bot-mjolnir/tasks/validate_config.yml b/roles/matrix-bot-mjolnir/tasks/validate_config.yml index cb961baf..63289d7b 100644 --- a/roles/matrix-bot-mjolnir/tasks/validate_config.yml +++ b/roles/matrix-bot-mjolnir/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required variables are undefined - fail: + ansible.builtin.fail: msg: "The `{{ item }}` variable must be defined and have a non-null value." with_items: - "matrix_bot_mjolnir_access_token" diff --git a/roles/matrix-bridge-appservice-discord/tasks/init.yml b/roles/matrix-bridge-appservice-discord/tasks/init.yml index a53112ad..df3c927b 100644 --- a/roles/matrix-bridge-appservice-discord/tasks/init.yml +++ b/roles/matrix-bridge-appservice-discord/tasks/init.yml @@ -2,17 +2,17 @@ # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # We don't want to fail in such cases. - name: Fail if matrix-synapse role already executed - fail: + 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)" -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-appservice-discord.service'] }}" when: matrix_appservice_discord_enabled|bool # If the matrix-synapse role is not used, these variables may not exist. -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ matrix_synapse_container_extra_arguments|default([]) diff --git a/roles/matrix-bridge-appservice-discord/tasks/setup_install.yml b/roles/matrix-bridge-appservice-discord/tasks/setup_install.yml index a06d38ac..5e9bf969 100644 --- a/roles/matrix-bridge-appservice-discord/tasks/setup_install.yml +++ b/roles/matrix-bridge-appservice-discord/tasks/setup_install.yml @@ -1,6 +1,6 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_appservice_discord_requires_restart: false - block: @@ -10,7 +10,7 @@ register: matrix_appservice_discord_sqlite_database_path_local_stat_result - block: - - set_fact: + - ansible.builtin.set_fact: matrix_postgres_db_migration_request: src: "{{ matrix_appservice_discord_sqlite_database_path_local }}" dst: "{{ matrix_appservice_discord_database_connString }}" @@ -21,7 +21,7 @@ - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" - - set_fact: + - 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_database_engine == 'postgres'" @@ -38,7 +38,7 @@ until: result is not failed - name: Ensure AppService Discord paths exist - file: + ansible.builtin.file: path: "{{ item }}" state: directory mode: 0750 @@ -55,7 +55,7 @@ register: matrix_appservice_discord_stat_db - name: (Data relocation) Ensure matrix-appservice-discord.service is stopped - service: + ansible.builtin.service: name: matrix-appservice-discord state: stopped enabled: false @@ -64,7 +64,7 @@ when: "matrix_appservice_discord_stat_db.stat.exists" - name: (Data relocation) Move AppService Discord discord.db file to ./data directory - command: "mv {{ matrix_appservice_discord_base_path }}/{{ item }} {{ matrix_appservice_discord_data_path }}/{{ item }}" + ansible.builtin.command: "mv {{ matrix_appservice_discord_base_path }}/{{ item }} {{ matrix_appservice_discord_data_path }}/{{ item }}" with_items: - discord.db - user-store.db @@ -72,7 +72,7 @@ when: "matrix_appservice_discord_stat_db.stat.exists" - name: Ensure AppService Discord config.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_appservice_discord_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_appservice_discord_config_path }}/config.yaml" mode: 0644 @@ -80,7 +80,7 @@ group: "{{ matrix_user_groupname }}" - name: Ensure AppService Discord registration.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_appservice_discord_registration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_appservice_discord_config_path }}/registration.yaml" mode: 0644 @@ -90,7 +90,7 @@ # If `matrix_appservice_discord_client_id` hasn't changed, the same invite link would be generated. # We intentionally suppress Ansible changes. - name: Generate AppService Discord invite link - shell: >- + ansible.builtin.shell: >- {{ matrix_host_command_docker }} run --rm --name matrix-appservice-discord-link-gen --user={{ matrix_user_uid }}:{{ matrix_user_gid }} --cap-drop=ALL @@ -101,19 +101,19 @@ changed_when: false - name: Ensure matrix-appservice-discord.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-appservice-discord.service.j2" dest: "{{ matrix_systemd_path }}/matrix-appservice-discord.service" mode: 0644 register: matrix_appservice_discord_systemd_service_result - name: Ensure systemd reloaded after matrix-appservice-discord.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_appservice_discord_systemd_service_result.changed" - name: Ensure matrix-appservice-discord.service restarted, if necessary - service: + ansible.builtin.service: name: "matrix-appservice-discord.service" state: restarted 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 ab56c26b..b844fa7c 100644 --- a/roles/matrix-bridge-appservice-discord/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-appservice-discord/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_appservice_discord_service_stat - name: Ensure matrix-appservice-discord is stopped - service: + ansible.builtin.service: name: matrix-appservice-discord state: stopped enabled: false @@ -14,12 +14,12 @@ when: "matrix_appservice_discord_service_stat.stat.exists" - name: Ensure matrix-appservice-discord.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-appservice-discord.service" state: absent when: "matrix_appservice_discord_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-appservice-discord.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_appservice_discord_service_stat.stat.exists" diff --git a/roles/matrix-bridge-appservice-discord/tasks/validate_config.yml b/roles/matrix-bridge-appservice-discord/tasks/validate_config.yml index 73253ba0..901b760b 100644 --- a/roles/matrix-bridge-appservice-discord/tasks/validate_config.yml +++ b/roles/matrix-bridge-appservice-discord/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). when: "vars[item] == ''" @@ -13,7 +13,7 @@ - "matrix_appservice_discord_homeserver_domain" - name: (Deprecation) Catch and report renamed appservice-discord variables - fail: + ansible.builtin.fail: msg: >- Your configuration contains a variable, which now has a different name. Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`). @@ -22,5 +22,5 @@ - {'old': 'matrix_appservice_discord_container_expose_client_server_api_port', 'new': ''} - name: Require a valid database engine - fail: msg="`matrix_appservice_discord_database_engine` needs to be either 'sqlite' or 'postgres'" + ansible.builtin.fail: msg="`matrix_appservice_discord_database_engine` needs to be either 'sqlite' or 'postgres'" when: "matrix_appservice_discord_database_engine not in ['sqlite', 'postgres']" diff --git a/roles/matrix-bridge-appservice-irc/tasks/init.yml b/roles/matrix-bridge-appservice-irc/tasks/init.yml index a35144f0..b318f23f 100644 --- a/roles/matrix-bridge-appservice-irc/tasks/init.yml +++ b/roles/matrix-bridge-appservice-irc/tasks/init.yml @@ -2,24 +2,24 @@ # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 - name: Fail if trying to self-build on Ansible < 2.8 - fail: + 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_appservice_irc_container_image_self_build and matrix_appservice_irc_enabled" # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # We don't want to fail in such cases. - name: Fail if matrix-synapse role already executed - fail: + 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)" -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-appservice-irc.service'] }}" when: matrix_appservice_irc_enabled|bool # If the matrix-synapse role is not used, these variables may not exist. -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ matrix_synapse_container_extra_arguments|default([]) 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 d7fcaa07..486b093b 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 @@ -1,21 +1,21 @@ --- - name: Fail if Postgres not enabled - fail: + ansible.builtin.fail: msg: "Postgres via the matrix-postgres role is not enabled (`matrix_postgres_enabled`). Cannot migrate." when: "not matrix_postgres_enabled|bool" # Defaults - name: Set postgres_start_wait_time, if not provided - set_fact: + ansible.builtin.set_fact: postgres_start_wait_time: 15 when: "postgres_start_wait_time|default('') == ''" # Actual import work - name: Ensure matrix-postgres is started - service: + ansible.builtin.service: name: matrix-postgres state: started daemon_reload: true @@ -34,13 +34,13 @@ register: matrix_appservice_irc_service_stat - name: Ensure matrix-appservice-irc is stopped - service: + ansible.builtin.service: name: matrix-appservice-irc state: stopped when: "matrix_appservice_irc_service_stat.stat.exists" - name: Import appservice-irc NeDB database into Postgres - command: + ansible.builtin.command: cmd: >- {{ matrix_host_command_docker }} run --rm @@ -54,14 +54,14 @@ '/usr/local/bin/node /app/lib/scripts/migrate-db-to-pgres.js --dbdir /data --privateKey /data/passkey.pem --connectionString {{ matrix_appservice_irc_database_connection_string }}' - name: Archive NeDB database files - command: + ansible.builtin.command: cmd: "mv {{ matrix_appservice_irc_data_path }}/{{ item }} {{ matrix_appservice_irc_data_path }}/{{ item }}.backup" with_items: - rooms.db - users.db - name: Inject result - set_fact: + ansible.builtin.set_fact: matrix_playbook_runtime_results: | {{ matrix_playbook_runtime_results|default([]) diff --git a/roles/matrix-bridge-appservice-irc/tasks/setup_install.yml b/roles/matrix-bridge-appservice-irc/tasks/setup_install.yml index 1ae0b3fa..d24de340 100644 --- a/roles/matrix-bridge-appservice-irc/tasks/setup_install.yml +++ b/roles/matrix-bridge-appservice-irc/tasks/setup_install.yml @@ -3,7 +3,7 @@ - import_tasks: "{{ role_path }}/../matrix-base/tasks/util/ensure_openssl_installed.yml" - name: Ensure Appservice IRC paths exist - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -23,24 +23,24 @@ - block: - name: (Data relocation) Ensure matrix-appservice-irc.service is stopped - service: + ansible.builtin.service: name: matrix-appservice-irc state: stopped daemon_reload: true failed_when: false - name: (Data relocation) Move AppService IRC passkey.pem file to ./data directory - command: "mv {{ matrix_appservice_irc_base_path }}/passkey.pem {{ matrix_appservice_irc_data_path }}/passkey.pem" + ansible.builtin.command: "mv {{ matrix_appservice_irc_base_path }}/passkey.pem {{ matrix_appservice_irc_data_path }}/passkey.pem" - name: (Data relocation) Move AppService IRC database files to ./data directory - command: "mv {{ matrix_appservice_irc_base_path }}/{{ item }} {{ matrix_appservice_irc_data_path }}/{{ item }}" + ansible.builtin.command: "mv {{ matrix_appservice_irc_base_path }}/{{ item }} {{ matrix_appservice_irc_data_path }}/{{ item }}" with_items: - rooms.db - users.db failed_when: false when: "matrix_appservice_irc_stat_passkey.stat.exists" -- set_fact: +- ansible.builtin.set_fact: matrix_appservice_irc_requires_restart: false - block: @@ -52,7 +52,7 @@ - block: - import_tasks: "{{ role_path }}/tasks/migrate_nedb_to_postgres.yml" - - set_fact: + - 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_database_engine == 'postgres'" @@ -70,7 +70,7 @@ until: result is not failed - name: Ensure matrix-appservice-irc repository is present when self-building - git: + ansible.builtin.git: repo: "{{ matrix_appservice_irc_docker_repo }}" dest: "{{ matrix_appservice_irc_docker_src_files_path }}" force: "yes" @@ -92,7 +92,7 @@ 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 - copy: + ansible.builtin.copy: content: "{{ matrix_appservice_irc_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_appservice_irc_config_path }}/config.yaml" mode: 0644 @@ -105,7 +105,7 @@ register: irc_passkey_file - name: Generate Appservice IRC passkey if it doesn't exist - shell: "{{ matrix_host_command_openssl }} genpkey -out {{ matrix_appservice_irc_data_path }}/passkey.pem -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:2048" + ansible.builtin.shell: "{{ matrix_host_command_openssl }} genpkey -out {{ matrix_appservice_irc_data_path }}/passkey.pem -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:2048" become: true become_user: "{{ matrix_user_username }}" when: "not irc_passkey_file.stat.exists" @@ -113,7 +113,7 @@ # In the past, we used to generate the passkey.pem file with root, so permissions may not be okay. # Fix it. - name: (Migration) Ensure Appservice IRC passkey permissions are okay - file: + ansible.builtin.file: path: "{{ matrix_appservice_irc_data_path }}/passkey.pem" mode: 0644 owner: "{{ matrix_user_username }}" @@ -139,7 +139,7 @@ # an up-to-date file, and we fix it up with some static values later on, # to produce a final registration.yaml file, as we desire. - name: Generate Appservice IRC registration-template.yaml - shell: >- + ansible.builtin.shell: >- {{ matrix_host_command_docker }} run --rm --name matrix-appservice-irc-gen --user={{ matrix_user_uid }}:{{ matrix_user_gid }} --cap-drop=ALL @@ -157,26 +157,26 @@ changed_when: false - name: Read Appservice IRC registration-template.yaml - slurp: + ansible.builtin.slurp: src: "{{ matrix_appservice_irc_config_path }}/registration-template.yaml" register: matrix_appservice_irc_registration_template_slurp - name: Remove unnecessary Appservice IRC registration-template.yaml - file: + ansible.builtin.file: path: "{{ matrix_appservice_irc_config_path }}/registration-template.yaml" state: absent changed_when: false - name: Parse registration-template.yaml - set_fact: + ansible.builtin.set_fact: matrix_appservice_irc_registration_template: "{{ matrix_appservice_irc_registration_template_slurp['content'] | b64decode | from_yaml }}" - name: Combine registration-template.yaml and own registration override config - set_fact: + ansible.builtin.set_fact: matrix_appservice_irc_registration: "{{ matrix_appservice_irc_registration_template|combine(matrix_appservice_irc_registration_override, recursive=True) }}" - name: Ensure Appservice IRC registration.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_appservice_irc_registration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_appservice_irc_config_path }}/registration.yaml" mode: 0644 @@ -184,19 +184,19 @@ group: "{{ matrix_user_groupname }}" - name: Ensure matrix-appservice-irc.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-appservice-irc.service.j2" dest: "{{ matrix_systemd_path }}/matrix-appservice-irc.service" mode: 0644 register: matrix_appservice_irc_systemd_service_result - name: Ensure systemd reloaded after matrix-appservice-irc.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_appservice_irc_systemd_service_result.changed" - name: Ensure matrix-appservice-irc.service restarted, if necessary - service: + ansible.builtin.service: name: "matrix-appservice-irc.service" state: restarted 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 a4d95df5..216ec682 100644 --- a/roles/matrix-bridge-appservice-irc/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-appservice-irc/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_appservice_irc_service_stat - name: Ensure matrix-appservice-irc is stopped - service: + ansible.builtin.service: name: matrix-appservice-irc state: stopped enabled: false @@ -14,12 +14,12 @@ when: "matrix_appservice_irc_service_stat.stat.exists" - name: Ensure matrix-appservice-irc.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-appservice-irc.service" state: absent when: "matrix_appservice_irc_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-appservice-irc.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_appservice_irc_service_stat.stat.exists" diff --git a/roles/matrix-bridge-appservice-irc/tasks/validate_config.yml b/roles/matrix-bridge-appservice-irc/tasks/validate_config.yml index 303f2640..f101e6fe 100644 --- a/roles/matrix-bridge-appservice-irc/tasks/validate_config.yml +++ b/roles/matrix-bridge-appservice-irc/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). when: "vars[item] == ''" @@ -17,7 +17,7 @@ # # This is a safety check to ensure we fail earlier and in a nicer way. - name: Fail if no additional configuration provided - fail: + ansible.builtin.fail: msg: >- Your Appservice IRC configuration is incomplete (lacking an `ircService.servers` configuration). You need to define one or more servers by either using `matrix_appservice_irc_ircService_servers` @@ -26,7 +26,7 @@ when: "matrix_appservice_irc_configuration.ircService.servers|length == 0" - name: (Deprecation) Catch and report renamed appservice-irc variables - fail: + ansible.builtin.fail: msg: >- Your configuration contains a variable, which now has a different name. Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`). diff --git a/roles/matrix-bridge-appservice-slack/tasks/init.yml b/roles/matrix-bridge-appservice-slack/tasks/init.yml index c8331817..21fee674 100644 --- a/roles/matrix-bridge-appservice-slack/tasks/init.yml +++ b/roles/matrix-bridge-appservice-slack/tasks/init.yml @@ -2,24 +2,24 @@ # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 - name: Fail if trying to self-build on Ansible < 2.8 - fail: + 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_appservice_slack_container_image_self_build and matrix_appservice_slack_enabled" # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # We don't want to fail in such cases. - name: Fail if matrix-synapse role already executed - fail: + 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)" -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-appservice-slack.service'] }}" when: matrix_appservice_slack_enabled|bool # If the matrix-synapse role is not used, these variables may not exist. -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ matrix_synapse_container_extra_arguments|default([]) @@ -38,14 +38,14 @@ # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # We don't want to fail in such cases. - name: Fail if matrix-synapse role already executed - fail: + 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)" - block: - name: Fail if matrix-nginx-proxy role already executed - fail: + ansible.builtin.fail: msg: >- Trying to append Slack Appservice's reverse-proxying configuration to matrix-nginx-proxy, but it's pointless since the matrix-nginx-proxy role had already executed. @@ -54,7 +54,7 @@ when: matrix_nginx_proxy_role_executed|default(False)|bool - name: Generate Matrix Appservice Slack proxying configuration for matrix-nginx-proxy - set_fact: + ansible.builtin.set_fact: matrix_appservice_slack_matrix_nginx_proxy_configuration: | location {{ matrix_appservice_slack_public_endpoint }} { {% if matrix_nginx_proxy_enabled|default(False) %} @@ -69,7 +69,7 @@ } - name: Register Slack Appservice proxying configuration with matrix-nginx-proxy - set_fact: + ansible.builtin.set_fact: matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: | {{ matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([]) @@ -81,7 +81,7 @@ when: matrix_appservice_slack_enabled|bool - name: Warn about reverse-proxying if matrix-nginx-proxy not used - debug: + ansible.builtin.debug: msg: >- NOTE: You've enabled the Matrix Slack bridge but are not using the matrix-nginx-proxy reverse proxy. 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 0bea65bc..6c0dd278 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 @@ -1,21 +1,21 @@ --- - name: Fail if Postgres not enabled - fail: + ansible.builtin.fail: msg: "Postgres via the matrix-postgres role is not enabled (`matrix_postgres_enabled`). Cannot migrate." when: "not matrix_postgres_enabled|bool" # Defaults - name: Set postgres_start_wait_time, if not provided - set_fact: + ansible.builtin.set_fact: postgres_start_wait_time: 15 when: "postgres_start_wait_time|default('') == ''" # Actual import work - name: Ensure matrix-postgres is started - service: + ansible.builtin.service: name: matrix-postgres state: started daemon_reload: true @@ -29,12 +29,12 @@ when: "matrix_postgres_service_start_result.changed|bool" - name: Ensure matrix-appservice-slack is stopped - service: + ansible.builtin.service: name: matrix-appservice-slack state: stopped - name: Import appservice-slack NeDB database into Postgres - command: + ansible.builtin.command: cmd: >- {{ matrix_host_command_docker }} run --rm @@ -48,7 +48,7 @@ '/usr/local/bin/node /usr/src/app/lib/scripts/migrateToPostgres.js --dbdir /data --connectionString {{ matrix_appservice_slack_database_connection_string }}' - name: Archive NeDB database files - command: + ansible.builtin.command: cmd: "mv {{ matrix_appservice_slack_data_path }}/{{ item }} {{ matrix_appservice_slack_data_path }}/{{ item }}.backup" with_items: - teams.db @@ -57,7 +57,7 @@ - event-store.db - name: Inject result - set_fact: + ansible.builtin.set_fact: matrix_playbook_runtime_results: | {{ matrix_playbook_runtime_results|default([]) diff --git a/roles/matrix-bridge-appservice-slack/tasks/setup_install.yml b/roles/matrix-bridge-appservice-slack/tasks/setup_install.yml index 42aa020c..5eb860ee 100644 --- a/roles/matrix-bridge-appservice-slack/tasks/setup_install.yml +++ b/roles/matrix-bridge-appservice-slack/tasks/setup_install.yml @@ -1,7 +1,7 @@ --- - name: Ensure AppService Slack paths exist - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -14,7 +14,7 @@ - {path: "{{ matrix_appservice_slack_docker_src_files_path }}", when: "{{ matrix_appservice_slack_container_image_self_build }}"} when: item.when|bool -- set_fact: +- ansible.builtin.set_fact: matrix_appservice_slack_requires_restart: false - block: @@ -26,7 +26,7 @@ - block: - import_tasks: "{{ role_path }}/tasks/migrate_nedb_to_postgres.yml" - - set_fact: + - 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_database_engine == 'postgres'" @@ -44,7 +44,7 @@ until: result is not failed - name: Ensure matrix-appservice-slack repository is present when self-building - git: + ansible.builtin.git: repo: "{{ matrix_appservice_slack_docker_repo }}" dest: "{{ matrix_appservice_slack_docker_src_files_path }}" force: "yes" @@ -66,7 +66,7 @@ when: "matrix_appservice_slack_container_image_self_build|bool and matrix_appservice_slack_git_pull_results.changed" - name: Ensure Matrix Appservice Slack config installed - copy: + ansible.builtin.copy: content: "{{ matrix_appservice_slack_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_appservice_slack_config_path }}/config.yaml" mode: 0644 @@ -74,7 +74,7 @@ group: "{{ matrix_user_groupname }}" - name: Ensure appservice-slack registration.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_appservice_slack_registration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_appservice_slack_config_path }}/slack-registration.yaml" mode: 0644 @@ -82,19 +82,19 @@ group: "{{ matrix_user_groupname }}" - name: Ensure matrix-appservice-slack.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-appservice-slack.service.j2" dest: "{{ matrix_systemd_path }}/matrix-appservice-slack.service" mode: 0644 register: matrix_appservice_slack_systemd_service_result - name: Ensure systemd reloaded after matrix-appservice-slack.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_appservice_slack_systemd_service_result.changed" - name: Ensure matrix-appservice-slack.service restarted, if necessary - service: + ansible.builtin.service: name: "matrix-appservice-slack.service" state: restarted 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 dffe78b3..fefa9aba 100644 --- a/roles/matrix-bridge-appservice-slack/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-appservice-slack/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_appservice_slack_service_stat - name: Ensure matrix-appservice-slack is stopped - service: + ansible.builtin.service: name: matrix-appservice-slack state: stopped enabled: false @@ -14,12 +14,12 @@ when: "matrix_appservice_slack_service_stat.stat.exists" - name: Ensure matrix-appservice-slack.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-appservice-slack.service" state: absent when: "matrix_appservice_slack_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-appservice-slack.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_appservice_slack_service_stat.stat.exists" diff --git a/roles/matrix-bridge-appservice-slack/tasks/validate_config.yml b/roles/matrix-bridge-appservice-slack/tasks/validate_config.yml index 1866c312..e00eb6d4 100644 --- a/roles/matrix-bridge-appservice-slack/tasks/validate_config.yml +++ b/roles/matrix-bridge-appservice-slack/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). when: "vars[item] == ''" @@ -13,7 +13,7 @@ - "matrix_appservice_slack_id_token" - name: (Deprecation) Catch and report renamed settings - fail: + ansible.builtin.fail: msg: >- Your configuration contains a variable, which now has a different name. Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`). diff --git a/roles/matrix-bridge-appservice-webhooks/tasks/init.yml b/roles/matrix-bridge-appservice-webhooks/tasks/init.yml index 370b835d..6b9fa87e 100644 --- a/roles/matrix-bridge-appservice-webhooks/tasks/init.yml +++ b/roles/matrix-bridge-appservice-webhooks/tasks/init.yml @@ -2,17 +2,17 @@ # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # We don't want to fail in such cases. - name: Fail if matrix-synapse role already executed - fail: + 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)" -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-appservice-webhooks.service'] }}" when: matrix_appservice_webhooks_enabled|bool # If the matrix-synapse role is not used, these variables may not exist. -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ matrix_synapse_container_extra_arguments|default([]) @@ -31,14 +31,14 @@ # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # We don't want to fail in such cases. - name: Fail if matrix-synapse role already executed - fail: + 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)" - block: - name: Fail if matrix-nginx-proxy role already executed - fail: + ansible.builtin.fail: msg: >- Trying to append webhooks Appservice's reverse-proxying configuration to matrix-nginx-proxy, but it's pointless since the matrix-nginx-proxy role had already executed. @@ -47,7 +47,7 @@ when: matrix_nginx_proxy_role_executed|default(False)|bool - name: Generate Matrix Appservice webhooks proxying configuration for matrix-nginx-proxy - set_fact: + ansible.builtin.set_fact: matrix_appservice_webhooks_matrix_nginx_proxy_configuration: | {% if matrix_nginx_proxy_enabled|default(False) %} {# Use the embedded DNS resolver in Docker containers to discover the service #} @@ -64,7 +64,7 @@ {% endif %} - name: Register webhooks Appservice proxying configuration with matrix-nginx-proxy - set_fact: + ansible.builtin.set_fact: matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: | {{ matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([]) @@ -76,7 +76,7 @@ when: matrix_appservice_webhooks_enabled|bool - name: Warn about reverse-proxying if matrix-nginx-proxy not used - debug: + ansible.builtin.debug: msg: >- NOTE: You've enabled the Matrix webhooks bridge but are not using the matrix-nginx-proxy reverse proxy. diff --git a/roles/matrix-bridge-appservice-webhooks/tasks/setup_install.yml b/roles/matrix-bridge-appservice-webhooks/tasks/setup_install.yml index 274f54c5..9228b617 100644 --- a/roles/matrix-bridge-appservice-webhooks/tasks/setup_install.yml +++ b/roles/matrix-bridge-appservice-webhooks/tasks/setup_install.yml @@ -1,7 +1,7 @@ --- - name: Ensure AppService webhooks paths exist - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -28,7 +28,7 @@ - block: - name: Ensure Appservice webhooks repository is present on self-build - git: + ansible.builtin.git: repo: "{{ matrix_appservice_webhooks_container_image_self_build_repo }}" dest: "{{ matrix_appservice_webhooks_docker_src_files_path }}" version: "{{ matrix_appservice_webhooks_container_image_self_build_repo_version }}" @@ -50,7 +50,7 @@ when: "matrix_appservice_webhooks_container_image_self_build|bool" - name: Ensure Matrix Appservice webhooks config is installed - copy: + ansible.builtin.copy: content: "{{ matrix_appservice_webhooks_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_appservice_webhooks_config_path }}/config.yaml" mode: 0644 @@ -58,7 +58,7 @@ group: "{{ matrix_user_groupname }}" - name: Ensure Matrix Appservice webhooks schema.yml template exists - template: + ansible.builtin.template: src: "{{ role_path }}/templates/schema.yml.j2" dest: "{{ matrix_appservice_webhooks_config_path }}/schema.yml" mode: 0644 @@ -66,7 +66,7 @@ group: "{{ matrix_user_groupname }}" - name: Ensure Matrix Appservice webhooks database.json template exists - template: + ansible.builtin.template: src: "{{ role_path }}/templates/database.json.j2" dest: "{{ matrix_appservice_webhooks_data_path }}/database.json" mode: 0644 @@ -74,7 +74,7 @@ group: "{{ matrix_user_groupname }}" - name: Ensure appservice-webhooks registration.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_appservice_webhooks_registration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_appservice_webhooks_config_path }}/webhooks-registration.yaml" mode: 0644 @@ -82,13 +82,13 @@ group: "{{ matrix_user_groupname }}" - name: Ensure matrix-appservice-webhooks.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-appservice-webhooks.service.j2" dest: "{{ matrix_systemd_path }}/matrix-appservice-webhooks.service" mode: 0644 register: matrix_appservice_webhooks_systemd_service_result - name: Ensure systemd reloaded after matrix-appservice-webhooks.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_appservice_webhooks_systemd_service_result.changed" diff --git a/roles/matrix-bridge-appservice-webhooks/tasks/setup_uninstall.yml b/roles/matrix-bridge-appservice-webhooks/tasks/setup_uninstall.yml index 38235652..8da6f8c2 100644 --- a/roles/matrix-bridge-appservice-webhooks/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-appservice-webhooks/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_appservice_webhooks_service_stat - name: Ensure matrix-appservice-webhooks is stopped - service: + ansible.builtin.service: name: matrix-appservice-webhooks state: stopped enabled: false @@ -14,12 +14,12 @@ when: "matrix_appservice_webhooks_service_stat.stat.exists" - name: Ensure matrix-appservice-webhooks.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-appservice-webhooks.service" state: absent when: "matrix_appservice_webhooks_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-appservice-webhooks.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_appservice_webhooks_service_stat.stat.exists" diff --git a/roles/matrix-bridge-appservice-webhooks/tasks/validate_config.yml b/roles/matrix-bridge-appservice-webhooks/tasks/validate_config.yml index 48f63e68..d7f45c6f 100644 --- a/roles/matrix-bridge-appservice-webhooks/tasks/validate_config.yml +++ b/roles/matrix-bridge-appservice-webhooks/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). when: "vars[item] == ''" diff --git a/roles/matrix-bridge-beeper-linkedin/tasks/init.yml b/roles/matrix-bridge-beeper-linkedin/tasks/init.yml index 64057301..6de40974 100644 --- a/roles/matrix-bridge-beeper-linkedin/tasks/init.yml +++ b/roles/matrix-bridge-beeper-linkedin/tasks/init.yml @@ -1,11 +1,11 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-beeper-linkedin.service'] }}" when: matrix_beeper_linkedin_enabled|bool # If the matrix-synapse role is not used, these variables may not exist. -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ matrix_synapse_container_extra_arguments|default([]) diff --git a/roles/matrix-bridge-beeper-linkedin/tasks/setup_install.yml b/roles/matrix-bridge-beeper-linkedin/tasks/setup_install.yml index 74f80314..73794efe 100644 --- a/roles/matrix-bridge-beeper-linkedin/tasks/setup_install.yml +++ b/roles/matrix-bridge-beeper-linkedin/tasks/setup_install.yml @@ -3,12 +3,12 @@ # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # We don't want to fail in such cases. - name: Fail if matrix-synapse role already executed - fail: + 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)" - name: Ensure Beeper LinkedIn paths exists - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -36,7 +36,7 @@ - block: - name: Ensure Beeper LinkedIn repository is present on self-build - git: + ansible.builtin.git: repo: "{{ matrix_beeper_linkedin_container_image_self_build_repo }}" dest: "{{ matrix_beeper_linkedin_docker_src_files_path }}" version: "{{ matrix_beeper_linkedin_container_image_self_build_branch }}" @@ -48,7 +48,7 @@ # Building the container image (using the default Dockerfile) requires that a docker-requirements.txt file be generated. # See: https://gitlab.com/beeper/linkedin/-/blob/94442db17ccb9769b377cdb8e4bf1cb3955781d7/.gitlab-ci.yml#L30-40 - name: Ensure docker-requirements.txt is generated before building Beeper LinkedIn Docker Image - command: | + ansible.builtin.command: | {{ matrix_host_command_docker }} run \ --rm \ --entrypoint=/bin/sh \ @@ -72,7 +72,7 @@ when: "matrix_beeper_linkedin_container_image_self_build|bool" - name: Ensure beeper-linkedin config.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_beeper_linkedin_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_beeper_linkedin_config_path }}/config.yaml" mode: 0644 @@ -80,7 +80,7 @@ group: "{{ matrix_user_groupname }}" - name: Ensure beeper-linkedin registration.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_beeper_linkedin_registration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_beeper_linkedin_config_path }}/registration.yaml" mode: 0644 @@ -88,13 +88,13 @@ group: "{{ matrix_user_groupname }}" - name: Ensure matrix-beeper-linkedin.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-beeper-linkedin.service.j2" dest: "{{ matrix_systemd_path }}/matrix-beeper-linkedin.service" mode: 0644 register: matrix_beeper_linkedin_systemd_service_result - name: Ensure systemd reloaded after matrix-beeper-linkedin.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_beeper_linkedin_systemd_service_result.changed" diff --git a/roles/matrix-bridge-beeper-linkedin/tasks/setup_uninstall.yml b/roles/matrix-bridge-beeper-linkedin/tasks/setup_uninstall.yml index befa2f61..be2b198f 100644 --- a/roles/matrix-bridge-beeper-linkedin/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-beeper-linkedin/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_beeper_linkedin_service_stat - name: Ensure matrix-beeper-linkedin is stopped - service: + ansible.builtin.service: name: matrix-beeper-linkedin state: stopped enabled: false @@ -14,12 +14,12 @@ when: "matrix_beeper_linkedin_service_stat.stat.exists" - name: Ensure matrix-beeper-linkedin.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-beeper-linkedin.service" state: absent when: "matrix_beeper_linkedin_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-beeper-linkedin.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_beeper_linkedin_service_stat.stat.exists" diff --git a/roles/matrix-bridge-beeper-linkedin/tasks/validate_config.yml b/roles/matrix-bridge-beeper-linkedin/tasks/validate_config.yml index d808de08..61489b7c 100644 --- a/roles/matrix-bridge-beeper-linkedin/tasks/validate_config.yml +++ b/roles/matrix-bridge-beeper-linkedin/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). when: "vars[item] == ''" diff --git a/roles/matrix-bridge-go-skype-bridge/tasks/init.yml b/roles/matrix-bridge-go-skype-bridge/tasks/init.yml index 452d835b..81baaa24 100644 --- a/roles/matrix-bridge-go-skype-bridge/tasks/init.yml +++ b/roles/matrix-bridge-go-skype-bridge/tasks/init.yml @@ -1,10 +1,10 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-go-skype-bridge.service'] }}" when: matrix_go_skype_bridge_enabled|bool # If the matrix-synapse role is not used, these variables may not exist. -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ matrix_synapse_container_extra_arguments|default([]) 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 c884625b..d43941d4 100644 --- a/roles/matrix-bridge-go-skype-bridge/tasks/setup_install.yml +++ b/roles/matrix-bridge-go-skype-bridge/tasks/setup_install.yml @@ -3,12 +3,12 @@ # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # We don't want to fail in such cases. - name: Fail if matrix-synapse role already executed - fail: + 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)" -- set_fact: +- ansible.builtin.set_fact: matrix_go_skype_bridge_requires_restart: false - block: @@ -18,7 +18,7 @@ register: matrix_go_skype_bridge_sqlite_database_path_local_stat_result - block: - - set_fact: + - ansible.builtin.set_fact: matrix_postgres_db_migration_request: src: "{{ matrix_go_skype_bridge_sqlite_database_path_local }}" dst: "{{ matrix_go_skype_bridge_database_connection_string }}" @@ -30,14 +30,14 @@ - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" - - set_fact: + - 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_database_engine == 'postgres'" - name: Ensure Go Skype Bridge paths exists - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -63,7 +63,7 @@ until: result is not failed - name: Ensure Go Skype Bridge repository is present on self-build - git: + ansible.builtin.git: repo: "{{ matrix_go_skype_bridge_container_image_self_build_repo }}" dest: "{{ matrix_go_skype_bridge_docker_src_files_path }}" version: "{{ matrix_go_skype_bridge_container_image_self_build_branch }}" @@ -96,7 +96,7 @@ register: matrix_go_skype_bridge_stat_mx_state - name: (Data relocation) Ensure matrix-go-skype-bridge.service is stopped - service: + ansible.builtin.service: name: matrix-go-skype-bridge state: stopped enabled: false @@ -105,15 +105,15 @@ when: "matrix_go_skype_bridge_stat_database.stat.exists" - name: (Data relocation) Move go-skype-bridge database file to ./data directory - command: "mv {{ matrix_go_skype_bridge_base_path }}/go-skype-bridge.db {{ matrix_go_skype_bridge_data_path }}/go-skype-bridge.db" + ansible.builtin.command: "mv {{ matrix_go_skype_bridge_base_path }}/go-skype-bridge.db {{ matrix_go_skype_bridge_data_path }}/go-skype-bridge.db" when: "matrix_go_skype_bridge_stat_database.stat.exists" - name: (Data relocation) Move go-skype-bridge mx-state file to ./data directory - command: "mv {{ matrix_go_skype_bridge_base_path }}/mx-state.json {{ matrix_go_skype_bridge_data_path }}/mx-state.json" + ansible.builtin.command: "mv {{ matrix_go_skype_bridge_base_path }}/mx-state.json {{ matrix_go_skype_bridge_data_path }}/mx-state.json" when: "matrix_go_skype_bridge_stat_mx_state.stat.exists" - name: Ensure go-skype-bridge config.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_go_skype_bridge_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_go_skype_bridge_config_path }}/config.yaml" mode: 0644 @@ -121,7 +121,7 @@ group: "{{ matrix_user_groupname }}" - name: Ensure go-skype-bridge registration.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_go_skype_bridge_registration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_go_skype_bridge_config_path }}/registration.yaml" mode: 0644 @@ -129,19 +129,19 @@ group: "{{ matrix_user_groupname }}" - name: Ensure matrix-go-skype-bridge.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-go-skype-bridge.service.j2" dest: "{{ matrix_systemd_path }}/matrix-go-skype-bridge.service" mode: 0644 register: matrix_go_skype_bridge_systemd_service_result - name: Ensure systemd reloaded after matrix-go-skype-bridge.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_go_skype_bridge_systemd_service_result.changed" - name: Ensure matrix-go-skype-bridge.service restarted, if necessary - service: + ansible.builtin.service: name: "matrix-go-skype-bridge.service" state: restarted 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 19acff85..138cdbf1 100644 --- a/roles/matrix-bridge-go-skype-bridge/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-go-skype-bridge/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_go_skype_bridge_service_stat - name: Ensure matrix-go-skype-bridge is stopped - service: + ansible.builtin.service: name: matrix-go-skype-bridge state: stopped enabled: false @@ -14,12 +14,12 @@ when: "matrix_go_skype_bridge_service_stat.stat.exists" - name: Ensure matrix-go-skype-bridge.service doesn't exist - file: + ansible.builtin.file: path: "/etc/systemd/system/matrix-go-skype-bridge.service" state: absent when: "matrix_go_skype_bridge_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-go-skype-bridge.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_go_skype_bridge_service_stat.stat.exists" diff --git a/roles/matrix-bridge-go-skype-bridge/tasks/validate_config.yml b/roles/matrix-bridge-go-skype-bridge/tasks/validate_config.yml index 7e9f3daf..d681299f 100644 --- a/roles/matrix-bridge-go-skype-bridge/tasks/validate_config.yml +++ b/roles/matrix-bridge-go-skype-bridge/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). when: "vars[item] == ''" diff --git a/roles/matrix-bridge-heisenbridge/tasks/init.yml b/roles/matrix-bridge-heisenbridge/tasks/init.yml index ef3efb76..dd08beb5 100644 --- a/roles/matrix-bridge-heisenbridge/tasks/init.yml +++ b/roles/matrix-bridge-heisenbridge/tasks/init.yml @@ -2,17 +2,17 @@ # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # We don't want to fail in such cases. - name: Fail if matrix-synapse role already executed - fail: + 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)" -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-heisenbridge.service'] }}" when: matrix_heisenbridge_enabled|bool # If the matrix-synapse role is not used, these variables may not exist. -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ matrix_synapse_container_extra_arguments|default([]) diff --git a/roles/matrix-bridge-heisenbridge/tasks/setup_install.yml b/roles/matrix-bridge-heisenbridge/tasks/setup_install.yml index f24bf926..4112f047 100644 --- a/roles/matrix-bridge-heisenbridge/tasks/setup_install.yml +++ b/roles/matrix-bridge-heisenbridge/tasks/setup_install.yml @@ -12,7 +12,7 @@ until: result is not failed - name: Ensure heisenbridge paths exist - file: + ansible.builtin.file: path: "{{ item }}" state: directory mode: 0750 @@ -22,7 +22,7 @@ - "{{ matrix_heisenbridge_base_path }}" - name: Ensure heisenbridge registration.yaml installed if provided - copy: + ansible.builtin.copy: content: "{{ matrix_heisenbridge_registration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_heisenbridge_base_path }}/registration.yaml" mode: 0644 @@ -30,13 +30,13 @@ group: "{{ matrix_user_groupname }}" - name: Ensure matrix-heisenbridge.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-heisenbridge.service.j2" dest: "{{ matrix_systemd_path }}/matrix-heisenbridge.service" mode: 0644 register: matrix_heisenbridge_systemd_service_result - name: Ensure systemd reloaded after matrix-heisenbridge.service installation - service: + ansible.builtin.service: daemon_reload: true when: matrix_heisenbridge_systemd_service_result.changed diff --git a/roles/matrix-bridge-heisenbridge/tasks/setup_uninstall.yml b/roles/matrix-bridge-heisenbridge/tasks/setup_uninstall.yml index 54d5bd67..c3bf7950 100644 --- a/roles/matrix-bridge-heisenbridge/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-heisenbridge/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_heisenbridge_service_stat - name: Ensure matrix-heisenbridge is stopped - service: + ansible.builtin.service: name: matrix-heisenbridge state: stopped enabled: false @@ -14,12 +14,12 @@ when: "matrix_heisenbridge_service_stat.stat.exists" - name: Ensure matrix-heisenbridge.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-heisenbridge.service" state: absent when: "matrix_heisenbridge_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-heisenbridge.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_heisenbridge_service_stat.stat.exists" diff --git a/roles/matrix-bridge-hookshot/tasks/init.yml b/roles/matrix-bridge-hookshot/tasks/init.yml index 96d5740a..5ac8c4f2 100644 --- a/roles/matrix-bridge-hookshot/tasks/init.yml +++ b/roles/matrix-bridge-hookshot/tasks/init.yml @@ -2,17 +2,17 @@ # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # We don't want to fail in such cases. - name: Fail if matrix-synapse role already executed - fail: + 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)" -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-hookshot.service'] }}" when: matrix_hookshot_enabled|bool # If the matrix-synapse role is not used, these variables may not exist. -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ matrix_synapse_container_extra_arguments|default([]) @@ -30,7 +30,7 @@ - block: - name: Fail if matrix-nginx-proxy role already executed - fail: + ansible.builtin.fail: msg: >- Trying to append hookshot's reverse-proxying configuration to matrix-nginx-proxy, but it's pointless since the matrix-nginx-proxy role had already executed. @@ -39,7 +39,7 @@ when: matrix_nginx_proxy_role_executed|default(False)|bool - name: Generate Matrix hookshot proxying configuration for matrix-nginx-proxy - set_fact: + ansible.builtin.set_fact: matrix_hookshot_matrix_nginx_proxy_configuration: | location ~ ^{{ matrix_hookshot_appservice_endpoint }}/(.*)$ { {% if matrix_nginx_proxy_enabled|default(False) %} @@ -95,7 +95,7 @@ } - name: Register hookshot proxying configuration with matrix-nginx-proxy - set_fact: + ansible.builtin.set_fact: matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: | {{ matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([]) @@ -104,7 +104,7 @@ }} - name: Generate hookshot metrics proxying configuration for matrix-nginx-proxy (matrix.DOMAIN/metrics/hookshot) - set_fact: + ansible.builtin.set_fact: matrix_hookshot_matrix_nginx_proxy_metrics_configuration_matrix_domain: | location /metrics/hookshot { {% if matrix_nginx_proxy_enabled|default(False) %} @@ -120,7 +120,7 @@ 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) - set_fact: + 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([]) @@ -131,7 +131,7 @@ when: matrix_hookshot_enabled|bool - name: Warn about reverse-proxying if matrix-nginx-proxy not used - debug: + ansible.builtin.debug: msg: >- NOTE: You've enabled the hookshot bridge but are not using the matrix-nginx-proxy reverse proxy. diff --git a/roles/matrix-bridge-hookshot/tasks/setup_install.yml b/roles/matrix-bridge-hookshot/tasks/setup_install.yml index 25f2978c..eb5e9a98 100644 --- a/roles/matrix-bridge-hookshot/tasks/setup_install.yml +++ b/roles/matrix-bridge-hookshot/tasks/setup_install.yml @@ -3,7 +3,7 @@ - import_tasks: "{{ role_path }}/../matrix-base/tasks/util/ensure_openssl_installed.yml" - name: Ensure hookshot paths exist - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -27,7 +27,7 @@ until: result is not failed - name: Ensure hookshot repository is present on self-build - git: + ansible.builtin.git: repo: "{{ matrix_hookshot_container_image_self_build_repo }}" dest: "{{ matrix_hookshot_docker_src_files_path }}" version: "{{ matrix_hookshot_container_image_self_build_branch }}" @@ -55,13 +55,13 @@ register: hookshot_passkey_file - name: Generate hookshot passkey if it doesn't exist - shell: "{{ matrix_host_command_openssl }} genpkey -out {{ matrix_hookshot_base_path }}/passkey.pem -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:4096" + ansible.builtin.shell: "{{ matrix_host_command_openssl }} genpkey -out {{ matrix_hookshot_base_path }}/passkey.pem -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:4096" become: true become_user: "{{ matrix_user_username }}" when: "not hookshot_passkey_file.stat.exists" - name: Ensure hookshot config.yml installed if provided - copy: + ansible.builtin.copy: content: "{{ matrix_hookshot_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_hookshot_base_path }}/config.yml" mode: 0644 @@ -69,7 +69,7 @@ group: "{{ matrix_user_groupname }}" - name: Validate hookshot config.yml - command: | + ansible.builtin.command: | {{ matrix_host_command_docker }} run --rm --name={{ matrix_hookshot_container_url }}-validate @@ -80,12 +80,12 @@ register: hookshot_config_validation_result - name: Fail if hookshot config.yml invalid - fail: + ansible.builtin.fail: msg: "Your hookshot configuration did not pass validation:\n{{ hookshot_config_validation_result.stdout }}\n{{ hookshot_config_validation_result.stderr }}" when: "hookshot_config_validation_result.rc > 0" - name: Ensure hookshot registration.yml installed if provided - copy: + ansible.builtin.copy: content: "{{ matrix_hookshot_registration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_hookshot_base_path }}/registration.yml" mode: 0644 @@ -93,7 +93,7 @@ group: "{{ matrix_user_groupname }}" - name: Ensure hookshot github private key file installed if github is enabled - copy: + ansible.builtin.copy: content: "{{ matrix_hookshot_github_private_key }}" dest: "{{ matrix_hookshot_base_path }}/{{ matrix_hookshot_github_private_key_file }}" mode: 0400 @@ -102,13 +102,13 @@ when: matrix_hookshot_github_enabled|bool and matrix_hookshot_github_private_key|length > 0 - name: Ensure matrix-hookshot.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-hookshot.service.j2" dest: "{{ matrix_systemd_path }}/matrix-hookshot.service" mode: 0644 register: matrix_hookshot_systemd_service_result - name: Ensure systemd reloaded after matrix-hookshot.service installation - service: + ansible.builtin.service: daemon_reload: true when: matrix_hookshot_systemd_service_result.changed diff --git a/roles/matrix-bridge-hookshot/tasks/setup_uninstall.yml b/roles/matrix-bridge-hookshot/tasks/setup_uninstall.yml index d8efbb02..903f46e6 100644 --- a/roles/matrix-bridge-hookshot/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-hookshot/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_hookshot_service_stat - name: Ensure matrix-hookshot is stopped - service: + ansible.builtin.service: name: matrix-hookshot state: stopped enabled: false @@ -14,12 +14,12 @@ when: "matrix_hookshot_service_stat.stat.exists" - name: Ensure matrix-hookshot.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-hookshot.service" state: absent when: "matrix_hookshot_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-hookshot.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_hookshot_service_stat.stat.exists" diff --git a/roles/matrix-bridge-hookshot/tasks/validate_config.yml b/roles/matrix-bridge-hookshot/tasks/validate_config.yml index b9622332..0fbcf53c 100644 --- a/roles/matrix-bridge-hookshot/tasks/validate_config.yml +++ b/roles/matrix-bridge-hookshot/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). when: "vars[item] == ''" @@ -10,7 +10,7 @@ - "matrix_hookshot_homeserver_token" - name: Fail if required GitHub settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`) to enable GitHub. when: "matrix_hookshot_github_enabled and vars[item] == ''" @@ -19,7 +19,7 @@ - "matrix_hookshot_github_secret" - name: Fail if required GitHub OAuth settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`) to enable GitHub OAuth. when: "matrix_hookshot_github_oauth_enabled and vars[item] == ''" @@ -28,7 +28,7 @@ - "matrix_hookshot_github_oauth_secret" - name: Fail if required Jira settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`) to enable Jira. when: "matrix_hookshot_jira_enabled and vars[item] == ''" @@ -36,7 +36,7 @@ - "matrix_hookshot_jira_secret" - name: Fail if required Jira OAuth settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`) to enable Jira OAuth. when: "matrix_hookshot_jira_oauth_enabled and vars[item] == ''" @@ -45,13 +45,13 @@ - "matrix_hookshot_jira_oauth_secret" - name: Fail if required Figma settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define at least one Figma instance to enable Figma. when: "matrix_hookshot_figma_enabled and matrix_hookshot_figma_instances is undefined" - name: Fail if required provisioning settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`) to enable provisioning. when: "matrix_hookshot_provisioning_enabled and vars[item] == ''" @@ -59,7 +59,7 @@ - "matrix_hookshot_provisioning_secret" - name: (Deprecation) Catch and report old metrics usage - fail: + ansible.builtin.fail: msg: >- Your configuration contains a variable (`{{ item }}`), which refers to the old metrics collection system for Hookshot, which exposed metrics on `https://stats.DOMAIN/hookshot/metrics`. diff --git a/roles/matrix-bridge-mautrix-facebook/tasks/init.yml b/roles/matrix-bridge-mautrix-facebook/tasks/init.yml index f2cd5963..3bad6fb2 100644 --- a/roles/matrix-bridge-mautrix-facebook/tasks/init.yml +++ b/roles/matrix-bridge-mautrix-facebook/tasks/init.yml @@ -2,16 +2,16 @@ # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 - name: Fail if trying to self-build on Ansible < 2.8 - fail: + 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_mautrix_facebook_container_image_self_build and matrix_mautrix_facebook_enabled" -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-facebook.service'] }}" when: matrix_mautrix_facebook_enabled|bool # If the matrix-synapse role is not used, these variables may not exist. -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ matrix_synapse_container_extra_arguments|default([]) @@ -29,7 +29,7 @@ - block: - name: Fail if matrix-nginx-proxy role already executed - fail: + ansible.builtin.fail: msg: >- Trying to append Mautrix Facebook's reverse-proxying configuration to matrix-nginx-proxy, but it's pointless since the matrix-nginx-proxy role had already executed. @@ -38,7 +38,7 @@ when: matrix_nginx_proxy_role_executed|default(False)|bool - name: Generate Mautrix Facebook proxying configuration for matrix-nginx-proxy - set_fact: + ansible.builtin.set_fact: matrix_mautrix_facebook_matrix_nginx_proxy_configuration: | location {{ matrix_mautrix_facebook_public_endpoint }} { {% if matrix_nginx_proxy_enabled|default(False) %} @@ -53,7 +53,7 @@ } - name: Register Mautrix Facebook proxying configuration with matrix-nginx-proxy - set_fact: + ansible.builtin.set_fact: matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: | {{ matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([]) @@ -62,7 +62,7 @@ }} - name: Warn about reverse-proxying if matrix-nginx-proxy not used - debug: + ansible.builtin.debug: msg: >- NOTE: You've enabled the Mautrix Facebook bridge but are not using the matrix-nginx-proxy reverse proxy. diff --git a/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml index 699ed88a..eaf2f139 100644 --- a/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml @@ -3,12 +3,12 @@ # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # We don't want to fail in such cases. - name: Fail if matrix-synapse role already executed - fail: + 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)" -- set_fact: +- ansible.builtin.set_fact: matrix_mautrix_facebook_requires_restart: false - block: @@ -18,7 +18,7 @@ register: matrix_mautrix_facebook_sqlite_database_path_local_stat_result - block: - - set_fact: + - ansible.builtin.set_fact: matrix_postgres_db_migration_request: src: "{{ matrix_mautrix_facebook_sqlite_database_path_local }}" dst: "{{ matrix_mautrix_facebook_database_connection_string }}" @@ -29,7 +29,7 @@ - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" - - set_fact: + - 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_database_engine == 'postgres'" @@ -47,7 +47,7 @@ until: result is not failed - name: Ensure Mautrix Facebook paths exist - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -61,7 +61,7 @@ when: item.when|bool - name: Ensure Mautrix Facebook repository is present on self-build - git: + ansible.builtin.git: repo: "{{ matrix_mautrix_facebook_container_image_self_build_repo }}" dest: "{{ matrix_mautrix_facebook_docker_src_files_path }}" version: "{{ matrix_mautrix_facebook_docker_image.split(':')[1] }}" @@ -89,7 +89,7 @@ register: matrix_mautrix_facebook_stat_database - name: (Data relocation) Ensure matrix-mautrix-facebook.service is stopped - service: + ansible.builtin.service: name: matrix-mautrix-facebook state: stopped enabled: false @@ -98,11 +98,11 @@ when: "matrix_mautrix_facebook_stat_database.stat.exists" - name: (Data relocation) Move mautrix-facebook database file to ./data directory - command: "mv {{ matrix_mautrix_facebook_base_path }}/mautrix-facebook.db {{ matrix_mautrix_facebook_data_path }}/mautrix-facebook.db" + ansible.builtin.command: "mv {{ matrix_mautrix_facebook_base_path }}/mautrix-facebook.db {{ matrix_mautrix_facebook_data_path }}/mautrix-facebook.db" when: "matrix_mautrix_facebook_stat_database.stat.exists" - name: Ensure mautrix-facebook config.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_mautrix_facebook_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_facebook_config_path }}/config.yaml" mode: 0644 @@ -110,7 +110,7 @@ group: "{{ matrix_user_groupname }}" - name: Ensure mautrix-facebook registration.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_mautrix_facebook_registration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_facebook_config_path }}/registration.yaml" mode: 0644 @@ -118,19 +118,19 @@ group: "{{ matrix_user_groupname }}" - name: Ensure matrix-mautrix-facebook.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-mautrix-facebook.service.j2" dest: "{{ matrix_systemd_path }}/matrix-mautrix-facebook.service" mode: 0644 register: matrix_mautrix_facebook_systemd_service_result - name: Ensure systemd reloaded after matrix-mautrix-facebook.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_mautrix_facebook_systemd_service_result.changed" - name: Ensure matrix-mautrix-facebook.service restarted, if necessary - service: + ansible.builtin.service: name: "matrix-mautrix-facebook.service" state: restarted 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 1c8fbd3b..cebdcdab 100644 --- a/roles/matrix-bridge-mautrix-facebook/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-mautrix-facebook/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_mautrix_facebook_service_stat - name: Ensure matrix-mautrix-facebook is stopped - service: + ansible.builtin.service: name: matrix-mautrix-facebook state: stopped enabled: false @@ -14,12 +14,12 @@ when: "matrix_mautrix_facebook_service_stat.stat.exists" - name: Ensure matrix-mautrix-facebook.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-mautrix-facebook.service" state: absent when: "matrix_mautrix_facebook_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-mautrix-facebook.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_mautrix_facebook_service_stat.stat.exists" diff --git a/roles/matrix-bridge-mautrix-facebook/tasks/validate_config.yml b/roles/matrix-bridge-mautrix-facebook/tasks/validate_config.yml index 7fcd6bea..986fbc63 100644 --- a/roles/matrix-bridge-mautrix-facebook/tasks/validate_config.yml +++ b/roles/matrix-bridge-mautrix-facebook/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). when: "vars[item] == ''" @@ -12,7 +12,7 @@ - block: - name: Inject warning if on an old SQLite-supporting version - set_fact: + ansible.builtin.set_fact: matrix_playbook_runtime_results: | {{ matrix_playbook_runtime_results|default([]) diff --git a/roles/matrix-bridge-mautrix-googlechat/tasks/init.yml b/roles/matrix-bridge-mautrix-googlechat/tasks/init.yml index 27845148..67cdd4a5 100644 --- a/roles/matrix-bridge-mautrix-googlechat/tasks/init.yml +++ b/roles/matrix-bridge-mautrix-googlechat/tasks/init.yml @@ -2,16 +2,16 @@ # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 - name: Fail if trying to self-build on Ansible < 2.8 - fail: + 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_mautrix_googlechat_container_image_self_build and matrix_mautrix_googlechat_enabled" -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-googlechat.service'] }}" when: matrix_mautrix_googlechat_enabled|bool # If the matrix-synapse role is not used, these variables may not exist. -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ matrix_synapse_container_extra_arguments|default([]) @@ -29,7 +29,7 @@ - block: - name: Fail if matrix-nginx-proxy role already executed - fail: + ansible.builtin.fail: msg: >- Trying to append Mautrix googlechat's reverse-proxying configuration to matrix-nginx-proxy, but it's pointless since the matrix-nginx-proxy role had already executed. @@ -38,7 +38,7 @@ when: matrix_nginx_proxy_role_executed|default(False)|bool - name: Generate Mautrix googlechat proxying configuration for matrix-nginx-proxy - set_fact: + ansible.builtin.set_fact: matrix_mautrix_googlechat_matrix_nginx_proxy_configuration: | location {{ matrix_mautrix_googlechat_public_endpoint }} { {% if matrix_nginx_proxy_enabled|default(False) %} @@ -52,7 +52,7 @@ {% endif %} } - name: Register Mautrix googlechat proxying configuration with matrix-nginx-proxy - set_fact: + ansible.builtin.set_fact: matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: | {{ matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([]) @@ -64,7 +64,7 @@ when: matrix_mautrix_googlechat_enabled|bool - name: Warn about reverse-proxying if matrix-nginx-proxy not used - debug: + ansible.builtin.debug: msg: >- NOTE: You've enabled the Mautrix googlechat bridge but are not using the matrix-nginx-proxy reverse proxy. diff --git a/roles/matrix-bridge-mautrix-googlechat/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-googlechat/tasks/setup_install.yml index bf04e834..a2544c57 100644 --- a/roles/matrix-bridge-mautrix-googlechat/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-googlechat/tasks/setup_install.yml @@ -3,12 +3,12 @@ # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # We don't want to fail in such cases. - name: Fail if matrix-synapse role already executed - fail: + 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)" -- set_fact: +- ansible.builtin.set_fact: matrix_mautrix_googlechat_requires_restart: false - block: @@ -18,7 +18,7 @@ register: matrix_mautrix_googlechat_sqlite_database_path_local_stat_result - block: - - set_fact: + - ansible.builtin.set_fact: matrix_postgres_db_migration_request: src: "{{ matrix_mautrix_googlechat_sqlite_database_path_local }}" dst: "{{ matrix_mautrix_googlechat_database_connection_string }}" @@ -29,7 +29,7 @@ - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" - - set_fact: + - 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_database_engine == 'postgres'" @@ -47,7 +47,7 @@ until: result is not failed - name: Ensure Mautrix googlechat paths exist - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -61,7 +61,7 @@ when: "item.when|bool" - name: Ensure Mautrix Hangots repository is present on self build - git: + ansible.builtin.git: repo: "{{ matrix_mautrix_googlechat_container_image_self_build_repo }}" dest: "{{ matrix_mautrix_googlechat_docker_src_files_path }}" force: "yes" @@ -88,7 +88,7 @@ register: matrix_mautrix_googlechat_stat_database - name: (Data relocation) Ensure matrix-mautrix-googlechat.service is stopped - service: + ansible.builtin.service: name: matrix-mautrix-googlechat state: stopped enabled: false @@ -97,11 +97,11 @@ when: "matrix_mautrix_googlechat_stat_database.stat.exists" - name: (Data relocation) Move mautrix-googlechat database file to ./data directory - command: "mv {{ matrix_mautrix_googlechat_base_path }}/mautrix-googlechat.db {{ matrix_mautrix_googlechat_data_path }}/mautrix-googlechat.db" + ansible.builtin.command: "mv {{ matrix_mautrix_googlechat_base_path }}/mautrix-googlechat.db {{ matrix_mautrix_googlechat_data_path }}/mautrix-googlechat.db" when: "matrix_mautrix_googlechat_stat_database.stat.exists" - name: Ensure mautrix-googlechat config.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_mautrix_googlechat_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_googlechat_config_path }}/config.yaml" mode: 0644 @@ -109,7 +109,7 @@ group: "{{ matrix_user_groupname }}" - name: Ensure mautrix-googlechat registration.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_mautrix_googlechat_registration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_googlechat_config_path }}/registration.yaml" mode: 0644 @@ -117,19 +117,19 @@ group: "{{ matrix_user_groupname }}" - name: Ensure matrix-mautrix-googlechat.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-mautrix-googlechat.service.j2" dest: "{{ matrix_systemd_path }}/matrix-mautrix-googlechat.service" mode: 0644 register: matrix_mautrix_googlechat_systemd_service_result - name: Ensure systemd reloaded after matrix-mautrix-googlechat.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_mautrix_googlechat_systemd_service_result.changed" - name: Ensure matrix-mautrix-googlechat.service restarted, if necessary - service: + ansible.builtin.service: name: "matrix-mautrix-googlechat.service" state: restarted 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 a315c0c8..88955868 100644 --- a/roles/matrix-bridge-mautrix-googlechat/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-mautrix-googlechat/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_mautrix_googlechat_service_stat - name: Ensure matrix-mautrix-googlechat is stopped - service: + ansible.builtin.service: name: matrix-mautrix-googlechat state: stopped enabled: false @@ -14,12 +14,12 @@ when: "matrix_mautrix_googlechat_service_stat.stat.exists" - name: Ensure matrix-mautrix-googlechat.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-mautrix-googlechat.service" state: absent when: "matrix_mautrix_googlechat_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-mautrix-googlechat.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_mautrix_googlechat_service_stat.stat.exists" diff --git a/roles/matrix-bridge-mautrix-googlechat/tasks/validate_config.yml b/roles/matrix-bridge-mautrix-googlechat/tasks/validate_config.yml index 083e8d34..fc36472e 100644 --- a/roles/matrix-bridge-mautrix-googlechat/tasks/validate_config.yml +++ b/roles/matrix-bridge-mautrix-googlechat/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). when: "vars[item] == ''" @@ -9,6 +9,6 @@ - "matrix_mautrix_googlechat_public_endpoint" - "matrix_mautrix_googlechat_appservice_token" - "matrix_mautrix_googlechat_homeserver_token" -- debug: +- ansible.builtin.debug: msg: - '`matrix_mautrix_googlechat_homeserver_domain` == {{ matrix_mautrix_googlechat_homeserver_domain }}' diff --git a/roles/matrix-bridge-mautrix-hangouts/tasks/init.yml b/roles/matrix-bridge-mautrix-hangouts/tasks/init.yml index d00e5252..6f7374ee 100644 --- a/roles/matrix-bridge-mautrix-hangouts/tasks/init.yml +++ b/roles/matrix-bridge-mautrix-hangouts/tasks/init.yml @@ -2,16 +2,16 @@ # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 - name: Fail if trying to self-build on Ansible < 2.8 - fail: + 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_mautrix_hangouts_container_image_self_build and matrix_mautrix_hangouts_enabled" -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-hangouts.service'] }}" when: matrix_mautrix_hangouts_enabled|bool # If the matrix-synapse role is not used, these variables may not exist. -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ matrix_synapse_container_extra_arguments|default([]) @@ -29,7 +29,7 @@ - block: - name: Fail if matrix-nginx-proxy role already executed - fail: + ansible.builtin.fail: msg: >- Trying to append Mautrix Hangouts's reverse-proxying configuration to matrix-nginx-proxy, but it's pointless since the matrix-nginx-proxy role had already executed. @@ -38,7 +38,7 @@ when: matrix_nginx_proxy_role_executed|default(False)|bool - name: Generate Mautrix Hangouts proxying configuration for matrix-nginx-proxy - set_fact: + ansible.builtin.set_fact: matrix_mautrix_hangouts_matrix_nginx_proxy_configuration: | location {{ matrix_mautrix_hangouts_public_endpoint }} { {% if matrix_nginx_proxy_enabled|default(False) %} @@ -52,7 +52,7 @@ {% endif %} } - name: Register Mautrix Hangouts proxying configuration with matrix-nginx-proxy - set_fact: + ansible.builtin.set_fact: matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: | {{ matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([]) @@ -64,7 +64,7 @@ when: matrix_mautrix_hangouts_enabled|bool - name: Warn about reverse-proxying if matrix-nginx-proxy not used - debug: + ansible.builtin.debug: msg: >- NOTE: You've enabled the Mautrix Hangouts bridge but are not using the matrix-nginx-proxy reverse proxy. diff --git a/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml index 6a880815..11456cc4 100644 --- a/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml @@ -3,12 +3,12 @@ # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # We don't want to fail in such cases. - name: Fail if matrix-synapse role already executed - fail: + 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)" -- set_fact: +- ansible.builtin.set_fact: matrix_mautrix_hangouts_requires_restart: false - block: @@ -18,7 +18,7 @@ register: matrix_mautrix_hangouts_sqlite_database_path_local_stat_result - block: - - set_fact: + - ansible.builtin.set_fact: matrix_postgres_db_migration_request: src: "{{ matrix_mautrix_hangouts_sqlite_database_path_local }}" dst: "{{ matrix_mautrix_hangouts_database_connection_string }}" @@ -29,7 +29,7 @@ - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" - - set_fact: + - 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_database_engine == 'postgres'" @@ -47,7 +47,7 @@ until: result is not failed - name: Ensure Mautrix Hangouts paths exist - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -61,7 +61,7 @@ when: "item.when|bool" - name: Ensure Mautrix Hangots repository is present on self build - git: + ansible.builtin.git: repo: "{{ matrix_mautrix_hangouts_container_image_self_build_repo }}" dest: "{{ matrix_mautrix_hangouts_docker_src_files_path }}" force: "yes" @@ -88,7 +88,7 @@ register: matrix_mautrix_hangouts_stat_database - name: (Data relocation) Ensure matrix-mautrix-hangouts.service is stopped - service: + ansible.builtin.service: name: matrix-mautrix-hangouts state: stopped enabled: false @@ -97,11 +97,11 @@ when: "matrix_mautrix_hangouts_stat_database.stat.exists" - name: (Data relocation) Move mautrix-hangouts database file to ./data directory - command: "mv {{ matrix_mautrix_hangouts_base_path }}/mautrix-hangouts.db {{ matrix_mautrix_hangouts_data_path }}/mautrix-hangouts.db" + ansible.builtin.command: "mv {{ matrix_mautrix_hangouts_base_path }}/mautrix-hangouts.db {{ matrix_mautrix_hangouts_data_path }}/mautrix-hangouts.db" when: "matrix_mautrix_hangouts_stat_database.stat.exists" - name: Ensure mautrix-hangouts config.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_mautrix_hangouts_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_hangouts_config_path }}/config.yaml" mode: 0644 @@ -109,7 +109,7 @@ group: "{{ matrix_user_groupname }}" - name: Ensure mautrix-hangouts registration.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_mautrix_hangouts_registration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_hangouts_config_path }}/registration.yaml" mode: 0644 @@ -117,19 +117,19 @@ group: "{{ matrix_user_groupname }}" - name: Ensure matrix-mautrix-hangouts.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-mautrix-hangouts.service.j2" dest: "{{ matrix_systemd_path }}/matrix-mautrix-hangouts.service" mode: 0644 register: matrix_mautrix_hangouts_systemd_service_result - name: Ensure systemd reloaded after matrix-mautrix-hangouts.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_mautrix_hangouts_systemd_service_result.changed" - name: Ensure matrix-mautrix-hangouts.service restarted, if necessary - service: + ansible.builtin.service: name: "matrix-mautrix-hangouts.service" state: restarted 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 8ce859c8..f3234a2e 100644 --- a/roles/matrix-bridge-mautrix-hangouts/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-mautrix-hangouts/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_mautrix_hangouts_service_stat - name: Ensure matrix-mautrix-hangouts is stopped - service: + ansible.builtin.service: name: matrix-mautrix-hangouts state: stopped enabled: false @@ -14,12 +14,12 @@ when: "matrix_mautrix_hangouts_service_stat.stat.exists" - name: Ensure matrix-mautrix-hangouts.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-mautrix-hangouts.service" state: absent when: "matrix_mautrix_hangouts_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-mautrix-hangouts.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_mautrix_hangouts_service_stat.stat.exists" diff --git a/roles/matrix-bridge-mautrix-hangouts/tasks/validate_config.yml b/roles/matrix-bridge-mautrix-hangouts/tasks/validate_config.yml index 0242ef16..c80586e0 100644 --- a/roles/matrix-bridge-mautrix-hangouts/tasks/validate_config.yml +++ b/roles/matrix-bridge-mautrix-hangouts/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). when: "vars[item] == ''" @@ -9,6 +9,6 @@ - "matrix_mautrix_hangouts_public_endpoint" - "matrix_mautrix_hangouts_appservice_token" - "matrix_mautrix_hangouts_homeserver_token" -- debug: +- ansible.builtin.debug: msg: - '`matrix_mautrix_hangouts_homeserver_domain` == {{ matrix_mautrix_hangouts_homeserver_domain }}' diff --git a/roles/matrix-bridge-mautrix-instagram/tasks/init.yml b/roles/matrix-bridge-mautrix-instagram/tasks/init.yml index 86713380..e3b4c58c 100644 --- a/roles/matrix-bridge-mautrix-instagram/tasks/init.yml +++ b/roles/matrix-bridge-mautrix-instagram/tasks/init.yml @@ -2,16 +2,16 @@ # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 - name: Fail if trying to self-build on Ansible < 2.8 - fail: + 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_mautrix_instagram_container_image_self_build and matrix_mautrix_instagram_enabled" -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-instagram.service'] }}" when: matrix_mautrix_instagram_enabled|bool # If the matrix-synapse role is not used, these variables may not exist. -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ matrix_synapse_container_extra_arguments|default([]) diff --git a/roles/matrix-bridge-mautrix-instagram/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-instagram/tasks/setup_install.yml index 5e30adbe..98fa1157 100644 --- a/roles/matrix-bridge-mautrix-instagram/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-instagram/tasks/setup_install.yml @@ -2,7 +2,7 @@ # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # We don't want to fail in such cases. - name: Fail if matrix-synapse role already executed - fail: + 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)" @@ -20,7 +20,7 @@ until: result is not failed - name: Ensure Mautrix instagram paths exist - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -34,7 +34,7 @@ when: item.when|bool - name: Ensure Mautrix instagram repository is present on self-build - git: + ansible.builtin.git: repo: "{{ matrix_mautrix_instagram_container_image_self_build_repo }}" dest: "{{ matrix_mautrix_instagram_docker_src_files_path }}" force: "yes" @@ -56,7 +56,7 @@ when: "matrix_mautrix_instagram_container_image_self_build|bool" - name: Ensure mautrix-instagram config.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_mautrix_instagram_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_instagram_config_path }}/config.yaml" mode: 0644 @@ -64,7 +64,7 @@ group: "{{ matrix_user_groupname }}" - name: Ensure mautrix-instagram registration.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_mautrix_instagram_registration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_instagram_config_path }}/registration.yaml" mode: 0644 @@ -72,13 +72,13 @@ group: "{{ matrix_user_groupname }}" - name: Ensure matrix-mautrix-instagram.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-mautrix-instagram.service.j2" dest: "{{ matrix_systemd_path }}/matrix-mautrix-instagram.service" mode: 0644 register: matrix_mautrix_instagram_systemd_service_result - name: Ensure systemd reloaded after matrix-mautrix-instagram.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_mautrix_instagram_systemd_service_result.changed" diff --git a/roles/matrix-bridge-mautrix-instagram/tasks/setup_uninstall.yml b/roles/matrix-bridge-mautrix-instagram/tasks/setup_uninstall.yml index 2cc0e0e9..ef90f01f 100644 --- a/roles/matrix-bridge-mautrix-instagram/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-mautrix-instagram/tasks/setup_uninstall.yml @@ -5,7 +5,7 @@ register: matrix_mautrix_instagram_service_stat - name: Ensure matrix-mautrix-instagram is stopped - service: + ansible.builtin.service: name: matrix-mautrix-instagram state: stopped enabled: false @@ -13,12 +13,12 @@ when: "matrix_mautrix_instagram_service_stat.stat.exists" - name: Ensure matrix-mautrix-instagram.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-mautrix-instagram.service" state: absent when: "matrix_mautrix_instagram_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-mautrix-instagram.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_mautrix_instagram_service_stat.stat.exists" diff --git a/roles/matrix-bridge-mautrix-instagram/tasks/validate_config.yml b/roles/matrix-bridge-mautrix-instagram/tasks/validate_config.yml index 24992ff5..99f7b015 100644 --- a/roles/matrix-bridge-mautrix-instagram/tasks/validate_config.yml +++ b/roles/matrix-bridge-mautrix-instagram/tasks/validate_config.yml @@ -1,6 +1,6 @@ --- - name: Fail if required settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). when: "vars[item] == ''" diff --git a/roles/matrix-bridge-mautrix-signal/tasks/init.yml b/roles/matrix-bridge-mautrix-signal/tasks/init.yml index b9b698c5..4d9a2448 100644 --- a/roles/matrix-bridge-mautrix-signal/tasks/init.yml +++ b/roles/matrix-bridge-mautrix-signal/tasks/init.yml @@ -1,11 +1,11 @@ --- -- set_fact: +- 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 # If the matrix-synapse role is not used, these variables may not exist. -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ matrix_synapse_container_extra_arguments|default([]) diff --git a/roles/matrix-bridge-mautrix-signal/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-signal/tasks/setup_install.yml index 06f77348..b7afb351 100644 --- a/roles/matrix-bridge-mautrix-signal/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-signal/tasks/setup_install.yml @@ -3,7 +3,7 @@ # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # We don't want to fail in such cases. - name: Fail if matrix-synapse role already executed - fail: + 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)" @@ -22,7 +22,7 @@ - name: Ensure Mautrix Signal repository is present on self-build - git: + ansible.builtin.git: repo: "{{ matrix_mautrix_signal_docker_repo }}" dest: "{{ matrix_mautrix_signal_docker_src_files_path }}" force: "yes" @@ -54,7 +54,7 @@ register: matrix_mautrix_signal_daemon_pull_results - name: Ensure Mautrix Signal Daemon repository is present on self-build - git: + ansible.builtin.git: repo: "{{ matrix_mautrix_signal_daemon_docker_repo }}" dest: "{{ matrix_mautrix_signal_daemon_docker_src_files_path }}" force: "yes" @@ -76,7 +76,7 @@ when: "matrix_mautrix_signal_daemon_container_image_self_build|bool" - name: Ensure Mautrix Signal paths exist - file: + ansible.builtin.file: path: "{{ item }}" state: directory mode: 0750 @@ -91,7 +91,7 @@ - "{{ matrix_mautrix_signal_daemon_path }}/data" - name: Ensure mautrix-signal config.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_mautrix_signal_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_signal_config_path }}/config.yaml" mode: 0644 @@ -99,7 +99,7 @@ group: "{{ matrix_user_groupname }}" - name: Ensure mautrix-signal registration.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_mautrix_signal_registration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_signal_config_path }}/registration.yaml" mode: 0644 @@ -107,20 +107,20 @@ group: "{{ matrix_user_groupname }}" - name: Ensure matrix-mautrix-signal-daemon.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-mautrix-signal-daemon.service.j2" dest: "{{ matrix_systemd_path }}/matrix-mautrix-signal-daemon.service" mode: 0644 register: matrix_mautrix_signal_daemon_systemd_service_result - name: Ensure matrix-mautrix-signal.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-mautrix-signal.service.j2" dest: "{{ matrix_systemd_path }}/matrix-mautrix-signal.service" mode: 0644 register: matrix_mautrix_signal_systemd_service_result - name: Ensure systemd reloaded after matrix-mautrix-signal.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_mautrix_signal_systemd_service_result.changed or matrix_mautrix_signal_daemon_systemd_service_result.changed" diff --git a/roles/matrix-bridge-mautrix-signal/tasks/setup_uninstall.yml b/roles/matrix-bridge-mautrix-signal/tasks/setup_uninstall.yml index 8ca2be3f..33f1b9f5 100644 --- a/roles/matrix-bridge-mautrix-signal/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-mautrix-signal/tasks/setup_uninstall.yml @@ -7,7 +7,7 @@ register: matrix_mautrix_signal_daemon_service_stat - name: Ensure matrix-mautrix-signal-daemon is stopped - service: + ansible.builtin.service: name: matrix-mautrix-signal-daemon state: stopped enabled: false @@ -15,7 +15,7 @@ when: "matrix_mautrix_signal_daemon_service_stat.stat.exists" - name: Ensure matrix-mautrix-signal-daemon.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-mautrix-signal-daemon.service" state: absent when: "matrix_mautrix_signal_daemon_service_stat.stat.exists" @@ -27,7 +27,7 @@ register: matrix_mautrix_signal_service_stat - name: Ensure matrix-mautrix-signal is stopped - service: + ansible.builtin.service: name: matrix-mautrix-signal state: stopped enabled: false @@ -35,13 +35,13 @@ when: "matrix_mautrix_signal_service_stat.stat.exists" - name: Ensure matrix-mautrix-signal.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-mautrix-signal.service" state: absent when: "matrix_mautrix_signal_service_stat.stat.exists" # All services - name: Ensure systemd reloaded after matrix-mautrix-signal_X.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_mautrix_signal_service_stat.stat.exists or matrix_mautrix_signal_daemon_service_stat.stat.exists" diff --git a/roles/matrix-bridge-mautrix-signal/tasks/validate_config.yml b/roles/matrix-bridge-mautrix-signal/tasks/validate_config.yml index 108ac044..01a02c2f 100644 --- a/roles/matrix-bridge-mautrix-signal/tasks/validate_config.yml +++ b/roles/matrix-bridge-mautrix-signal/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). when: "vars[item] == ''" @@ -12,7 +12,7 @@ - "matrix_mautrix_signal_appservice_token" - name: (Deprecation) Catch and report renamed Signal variables - fail: + ansible.builtin.fail: msg: >- Your configuration contains a variable, which now has a different name. Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`). diff --git a/roles/matrix-bridge-mautrix-telegram/tasks/init.yml b/roles/matrix-bridge-mautrix-telegram/tasks/init.yml index 93b4d9f8..a9cc0425 100644 --- a/roles/matrix-bridge-mautrix-telegram/tasks/init.yml +++ b/roles/matrix-bridge-mautrix-telegram/tasks/init.yml @@ -2,16 +2,16 @@ # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 - name: Fail if trying to self-build on Ansible < 2.8 - fail: + 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_mautrix_telegram_container_image_self_build and matrix_mautrix_telegram_enabled" -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-telegram.service'] }}" when: matrix_mautrix_telegram_enabled|bool # If the matrix-synapse role is not used, these variables may not exist. -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ matrix_synapse_container_extra_arguments|default([]) @@ -29,7 +29,7 @@ - block: - name: Fail if matrix-nginx-proxy role already executed - fail: + ansible.builtin.fail: msg: >- Trying to append Mautrix Telegram's reverse-proxying configuration to matrix-nginx-proxy, but it's pointless since the matrix-nginx-proxy role had already executed. @@ -38,7 +38,7 @@ when: matrix_nginx_proxy_role_executed|default(False)|bool - name: Generate Mautrix Telegram proxying configuration for matrix-nginx-proxy - set_fact: + ansible.builtin.set_fact: matrix_mautrix_telegram_matrix_nginx_proxy_configuration: | location {{ matrix_mautrix_telegram_public_endpoint }} { {% if matrix_nginx_proxy_enabled|default(False) %} @@ -53,7 +53,7 @@ } - name: Register Mautrix Telegram proxying configuration with matrix-nginx-proxy - set_fact: + ansible.builtin.set_fact: matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: | {{ matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([]) @@ -61,7 +61,7 @@ [matrix_mautrix_telegram_matrix_nginx_proxy_configuration] }} - name: Warn about reverse-proxying if matrix-nginx-proxy not used - debug: + ansible.builtin.debug: msg: >- NOTE: You've enabled the Mautrix Telegram bridge but are not using the matrix-nginx-proxy reverse proxy. diff --git a/roles/matrix-bridge-mautrix-telegram/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-telegram/tasks/setup_install.yml index 55e7d016..d530d2b9 100644 --- a/roles/matrix-bridge-mautrix-telegram/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-telegram/tasks/setup_install.yml @@ -3,12 +3,12 @@ # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # We don't want to fail in such cases. - name: Fail if matrix-synapse role already executed - fail: + 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)" -- set_fact: +- ansible.builtin.set_fact: matrix_mautrix_telegram_requires_restart: false - block: @@ -18,7 +18,7 @@ register: matrix_mautrix_telegram_sqlite_database_path_local_stat_result - block: - - set_fact: + - ansible.builtin.set_fact: matrix_postgres_db_migration_request: src: "{{ matrix_mautrix_telegram_sqlite_database_path_local }}" dst: "{{ matrix_mautrix_telegram_database_connection_string }}" @@ -29,13 +29,13 @@ - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" - - set_fact: + - 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_database_engine == 'postgres'" - name: Ensure Mautrix Telegram paths exist - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -61,7 +61,7 @@ until: result is not failed - name: Ensure lottieconverter is present when self-building - git: + ansible.builtin.git: repo: "{{ matrix_telegram_lottieconverter_docker_repo }}" dest: "{{ matrix_telegram_lottieconverter_docker_src_files_path }}" force: "yes" @@ -83,7 +83,7 @@ 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 - git: + ansible.builtin.git: repo: "{{ matrix_mautrix_telegram_docker_repo }}" dest: "{{ matrix_mautrix_telegram_docker_src_files_path }}" force: "yes" @@ -112,7 +112,7 @@ register: matrix_mautrix_telegram_stat_database - name: (Data relocation) Ensure matrix-mautrix-telegram.service is stopped - service: + ansible.builtin.service: name: matrix-mautrix-telegram state: stopped enabled: false @@ -121,11 +121,11 @@ when: "matrix_mautrix_telegram_stat_database.stat.exists" - name: (Data relocation) Move mautrix-telegram database file to ./data directory - command: "mv {{ matrix_mautrix_telegram_base_path }}/mautrix-telegram.db {{ matrix_mautrix_telegram_data_path }}/mautrix-telegram.db" + ansible.builtin.command: "mv {{ matrix_mautrix_telegram_base_path }}/mautrix-telegram.db {{ matrix_mautrix_telegram_data_path }}/mautrix-telegram.db" when: "matrix_mautrix_telegram_stat_database.stat.exists" - name: Ensure mautrix-telegram config.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_mautrix_telegram_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_telegram_config_path }}/config.yaml" mode: 0644 @@ -133,7 +133,7 @@ group: "{{ matrix_user_groupname }}" - name: Ensure mautrix-telegram registration.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_mautrix_telegram_registration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_telegram_config_path }}/registration.yaml" mode: 0644 @@ -141,19 +141,19 @@ group: "{{ matrix_user_groupname }}" - name: Ensure matrix-mautrix-telegram.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-mautrix-telegram.service.j2" dest: "{{ matrix_systemd_path }}/matrix-mautrix-telegram.service" mode: 0644 register: matrix_mautrix_telegram_systemd_service_result - name: Ensure systemd reloaded after matrix-mautrix-telegram.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_mautrix_telegram_systemd_service_result.changed" - name: Ensure matrix-mautrix-telegram.service restarted, if necessary - service: + ansible.builtin.service: name: "matrix-mautrix-telegram.service" state: restarted 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 a713898b..01b58313 100644 --- a/roles/matrix-bridge-mautrix-telegram/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-mautrix-telegram/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_mautrix_telegram_service_stat - name: Ensure matrix-mautrix-telegram is stopped - service: + ansible.builtin.service: name: matrix-mautrix-telegram state: stopped enabled: false @@ -14,12 +14,12 @@ when: "matrix_mautrix_telegram_service_stat.stat.exists" - name: Ensure matrix-mautrix-telegram.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-mautrix-telegram.service" state: absent when: "matrix_mautrix_telegram_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-mautrix-telegram.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_mautrix_telegram_service_stat.stat.exists" diff --git a/roles/matrix-bridge-mautrix-telegram/tasks/validate_config.yml b/roles/matrix-bridge-mautrix-telegram/tasks/validate_config.yml index 2067b97b..9711448b 100644 --- a/roles/matrix-bridge-mautrix-telegram/tasks/validate_config.yml +++ b/roles/matrix-bridge-mautrix-telegram/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). when: "vars[item] == ''" @@ -13,7 +13,7 @@ - "matrix_mautrix_telegram_homeserver_token" - name: (Deprecation) Catch and report renamed Telegram variables - fail: + ansible.builtin.fail: msg: >- Your configuration contains a variable, which now has a different name. Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`). diff --git a/roles/matrix-bridge-mautrix-twitter/tasks/init.yml b/roles/matrix-bridge-mautrix-twitter/tasks/init.yml index 34f4ebde..3fdd66d8 100644 --- a/roles/matrix-bridge-mautrix-twitter/tasks/init.yml +++ b/roles/matrix-bridge-mautrix-twitter/tasks/init.yml @@ -1,11 +1,11 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-twitter.service'] }}" when: matrix_mautrix_twitter_enabled|bool # If the matrix-synapse role is not used, these variables may not exist. -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ matrix_synapse_container_extra_arguments|default([]) @@ -24,6 +24,6 @@ # ansible lower than 2.8, does not support docker_image build parameters # for self buildig it is explicitly needed, so we rather fail here - name: Fail if running on Ansible lower than 2.8 and trying self building - fail: + ansible.builtin.fail: msg: "To self build Mautrix Twitter image, you should usa ansible 2.8 or higher. E.g. pip contains such packages." when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_mautrix_twitter_container_image_self_build" diff --git a/roles/matrix-bridge-mautrix-twitter/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-twitter/tasks/setup_install.yml index 552c9d52..167176a8 100644 --- a/roles/matrix-bridge-mautrix-twitter/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-twitter/tasks/setup_install.yml @@ -3,12 +3,12 @@ # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # We don't want to fail in such cases. - name: Fail if matrix-synapse role already executed - fail: + 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)" -- set_fact: +- ansible.builtin.set_fact: matrix_mautrix_twitter_requires_restart: false - name: Ensure Mautrix Twitter image is pulled @@ -24,7 +24,7 @@ until: result is not failed - name: Ensure Mautrix Twitter paths exist - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -38,7 +38,7 @@ when: item.when|bool - name: Ensure Mautrix Twitter repository is present on self-build - git: + ansible.builtin.git: repo: "{{ matrix_mautrix_twitter_container_image_self_build_repo }}" dest: "{{ matrix_mautrix_twitter_docker_src_files_path }}" # version: "{{ matrix_coturn_docker_image.split(':')[1] }}" @@ -60,7 +60,7 @@ when: "matrix_mautrix_twitter_enabled|bool and matrix_mautrix_twitter_container_image_self_build|bool" - name: Ensure mautrix-twitter config.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_mautrix_twitter_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_twitter_config_path }}/config.yaml" mode: 0644 @@ -68,7 +68,7 @@ group: "{{ matrix_user_groupname }}" - name: Ensure mautrix-twitter registration.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_mautrix_twitter_registration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_twitter_config_path }}/registration.yaml" mode: 0644 @@ -76,19 +76,19 @@ group: "{{ matrix_user_groupname }}" - name: Ensure matrix-mautrix-twitter.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-mautrix-twitter.service.j2" dest: "{{ matrix_systemd_path }}/matrix-mautrix-twitter.service" mode: 0644 register: matrix_mautrix_twitter_systemd_service_result - name: Ensure systemd reloaded after matrix-mautrix-twitter.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_mautrix_twitter_systemd_service_result.changed" - name: Ensure matrix-mautrix-twitter.service restarted, if necessary - service: + ansible.builtin.service: name: "matrix-mautrix-twitter.service" state: restarted 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 024603e7..9c357931 100644 --- a/roles/matrix-bridge-mautrix-twitter/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-mautrix-twitter/tasks/setup_uninstall.yml @@ -6,19 +6,19 @@ register: matrix_mautrix_twitter_service_stat - name: Ensure matrix-mautrix-twitter is stopped - service: + ansible.builtin.service: name: matrix-mautrix-twitter state: stopped daemon_reload: true when: "matrix_mautrix_twitter_service_stat.stat.exists" - name: Ensure matrix-mautrix-twitter.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-mautrix-twitter.service" state: absent when: "matrix_mautrix_twitter_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-mautrix-twitter.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_mautrix_twitter_service_stat.stat.exists" diff --git a/roles/matrix-bridge-mautrix-twitter/tasks/validate_config.yml b/roles/matrix-bridge-mautrix-twitter/tasks/validate_config.yml index 5b6e3d02..326dca83 100644 --- a/roles/matrix-bridge-mautrix-twitter/tasks/validate_config.yml +++ b/roles/matrix-bridge-mautrix-twitter/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). when: "vars[item] == ''" diff --git a/roles/matrix-bridge-mautrix-whatsapp/tasks/init.yml b/roles/matrix-bridge-mautrix-whatsapp/tasks/init.yml index d4fb8221..75a0134b 100644 --- a/roles/matrix-bridge-mautrix-whatsapp/tasks/init.yml +++ b/roles/matrix-bridge-mautrix-whatsapp/tasks/init.yml @@ -1,10 +1,10 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-whatsapp.service'] }}" when: matrix_mautrix_whatsapp_enabled|bool # If the matrix-synapse role is not used, these variables may not exist. -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ matrix_synapse_container_extra_arguments|default([]) diff --git a/roles/matrix-bridge-mautrix-whatsapp/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-whatsapp/tasks/setup_install.yml index f47675b5..59e5fe0e 100644 --- a/roles/matrix-bridge-mautrix-whatsapp/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-whatsapp/tasks/setup_install.yml @@ -3,12 +3,12 @@ # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # We don't want to fail in such cases. - name: Fail if matrix-synapse role already executed - fail: + 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)" -- set_fact: +- ansible.builtin.set_fact: matrix_mautrix_whatsapp_requires_restart: false - block: @@ -18,7 +18,7 @@ register: matrix_mautrix_whatsapp_sqlite_database_path_local_stat_result - block: - - set_fact: + - ansible.builtin.set_fact: matrix_postgres_db_migration_request: src: "{{ matrix_mautrix_whatsapp_sqlite_database_path_local }}" dst: "{{ matrix_mautrix_whatsapp_database_connection_string }}" @@ -30,14 +30,14 @@ - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" - - set_fact: + - 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_database_engine == 'postgres'" - name: Ensure Mautrix Whatsapp paths exists - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -63,7 +63,7 @@ until: result is not failed - name: Ensure Mautrix Whatsapp repository is present on self-build - git: + ansible.builtin.git: repo: "{{ matrix_mautrix_whatsapp_container_image_self_build_repo }}" dest: "{{ matrix_mautrix_whatsapp_docker_src_files_path }}" version: "{{ matrix_mautrix_whatsapp_container_image_self_build_branch }}" @@ -96,7 +96,7 @@ register: matrix_mautrix_whatsapp_stat_mx_state - name: (Data relocation) Ensure matrix-mautrix-whatsapp.service is stopped - service: + ansible.builtin.service: name: matrix-mautrix-whatsapp state: stopped enabled: false @@ -105,15 +105,15 @@ when: "matrix_mautrix_whatsapp_stat_database.stat.exists" - name: (Data relocation) Move mautrix-whatsapp database file to ./data directory - command: "mv {{ matrix_mautrix_whatsapp_base_path }}/mautrix-whatsapp.db {{ matrix_mautrix_whatsapp_data_path }}/mautrix-whatsapp.db" + ansible.builtin.command: "mv {{ matrix_mautrix_whatsapp_base_path }}/mautrix-whatsapp.db {{ matrix_mautrix_whatsapp_data_path }}/mautrix-whatsapp.db" when: "matrix_mautrix_whatsapp_stat_database.stat.exists" - name: (Data relocation) Move mautrix-whatsapp mx-state file to ./data directory - command: "mv {{ matrix_mautrix_whatsapp_base_path }}/mx-state.json {{ matrix_mautrix_whatsapp_data_path }}/mx-state.json" + ansible.builtin.command: "mv {{ matrix_mautrix_whatsapp_base_path }}/mx-state.json {{ matrix_mautrix_whatsapp_data_path }}/mx-state.json" when: "matrix_mautrix_whatsapp_stat_mx_state.stat.exists" - name: Ensure mautrix-whatsapp config.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_mautrix_whatsapp_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_whatsapp_config_path }}/config.yaml" mode: 0644 @@ -121,7 +121,7 @@ group: "{{ matrix_user_groupname }}" - name: Ensure mautrix-whatsapp registration.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_mautrix_whatsapp_registration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mautrix_whatsapp_config_path }}/registration.yaml" mode: 0644 @@ -129,19 +129,19 @@ group: "{{ matrix_user_groupname }}" - name: Ensure matrix-mautrix-whatsapp.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-mautrix-whatsapp.service.j2" dest: "{{ matrix_systemd_path }}/matrix-mautrix-whatsapp.service" mode: 0644 register: matrix_mautrix_whatsapp_systemd_service_result - name: Ensure systemd reloaded after matrix-mautrix-whatsapp.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_mautrix_whatsapp_systemd_service_result.changed" - name: Ensure matrix-mautrix-whatsapp.service restarted, if necessary - service: + ansible.builtin.service: name: "matrix-mautrix-whatsapp.service" state: restarted 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 3884f9e7..94f7f30a 100644 --- a/roles/matrix-bridge-mautrix-whatsapp/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-mautrix-whatsapp/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_mautrix_whatsapp_service_stat - name: Ensure matrix-mautrix-whatsapp is stopped - service: + ansible.builtin.service: name: matrix-mautrix-whatsapp state: stopped enabled: false @@ -14,12 +14,12 @@ when: "matrix_mautrix_whatsapp_service_stat.stat.exists" - name: Ensure matrix-mautrix-whatsapp.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-mautrix-whatsapp.service" state: absent when: "matrix_mautrix_whatsapp_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-mautrix-whatsapp.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_mautrix_whatsapp_service_stat.stat.exists" diff --git a/roles/matrix-bridge-mautrix-whatsapp/tasks/validate_config.yml b/roles/matrix-bridge-mautrix-whatsapp/tasks/validate_config.yml index 9b0a725c..863dc926 100644 --- a/roles/matrix-bridge-mautrix-whatsapp/tasks/validate_config.yml +++ b/roles/matrix-bridge-mautrix-whatsapp/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). when: "vars[item] == ''" @@ -11,7 +11,7 @@ - name: (Deprecation) Catch and report renamed settings - fail: + ansible.builtin.fail: msg: >- Your configuration contains a variable, which now has a different name. Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`). diff --git a/roles/matrix-bridge-mx-puppet-discord/tasks/init.yml b/roles/matrix-bridge-mx-puppet-discord/tasks/init.yml index 115ccf35..ca009028 100644 --- a/roles/matrix-bridge-mx-puppet-discord/tasks/init.yml +++ b/roles/matrix-bridge-mx-puppet-discord/tasks/init.yml @@ -2,16 +2,16 @@ # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 - name: Fail if trying to self-build on Ansible < 2.8 - fail: + 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_mx_puppet_discord_container_image_self_build and matrix_mx_puppet_discord_enabled" -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mx-puppet-discord.service'] }}" when: matrix_mx_puppet_discord_enabled|bool # If the matrix-synapse role is not used, these variables may not exist. -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ matrix_synapse_container_extra_arguments|default([]) 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 3ddfa39d..3c3c43a0 100644 --- a/roles/matrix-bridge-mx-puppet-discord/tasks/setup_install.yml +++ b/roles/matrix-bridge-mx-puppet-discord/tasks/setup_install.yml @@ -3,13 +3,13 @@ # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # We don't want to fail in such cases. - name: Fail if matrix-synapse role already executed - fail: + 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)" - name: Ensure MX Puppet Discord paths exist - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -29,17 +29,17 @@ - block: - name: (Data relocation) Ensure matrix-mx-puppet-discord.service is stopped - service: + ansible.builtin.service: name: matrix-mx-puppet-discord state: stopped daemon_reload: true failed_when: false - name: (Data relocation) Move mx-puppet-discord database file to ./data directory - command: "mv {{ matrix_mx_puppet_discord_base_path }}/database.db {{ matrix_mx_puppet_discord_data_path }}/database.db" + ansible.builtin.command: "mv {{ matrix_mx_puppet_discord_base_path }}/database.db {{ matrix_mx_puppet_discord_data_path }}/database.db" when: "matrix_mx_puppet_discord_stat_database.stat.exists" -- set_fact: +- ansible.builtin.set_fact: matrix_mx_puppet_discord_requires_restart: false - block: @@ -49,7 +49,7 @@ register: matrix_mx_puppet_discord_sqlite_database_path_local_stat_result - block: - - set_fact: + - ansible.builtin.set_fact: matrix_postgres_db_migration_request: src: "{{ matrix_mx_puppet_discord_sqlite_database_path_local }}" dst: "{{ matrix_mx_puppet_discord_database_connection_string }}" @@ -60,7 +60,7 @@ - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" - - set_fact: + - 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_database_engine == 'postgres'" @@ -78,7 +78,7 @@ until: result is not failed - name: Ensure MX Puppet Discord repository is present on self build - git: + ansible.builtin.git: repo: "{{ matrix_mx_puppet_discord_container_image_self_build_repo }}" dest: "{{ matrix_mx_puppet_discord_docker_src_files_path }}" force: "yes" @@ -101,7 +101,7 @@ 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 - copy: + ansible.builtin.copy: content: "{{ matrix_mx_puppet_discord_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mx_puppet_discord_config_path }}/config.yaml" mode: 0644 @@ -109,7 +109,7 @@ group: "{{ matrix_user_groupname }}" - name: Ensure mx-puppet-discord discord-registration.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_mx_puppet_discord_registration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mx_puppet_discord_config_path }}/registration.yaml" mode: 0644 @@ -117,19 +117,19 @@ group: "{{ matrix_user_groupname }}" - name: Ensure matrix-mx-puppet-discord.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-mx-puppet-discord.service.j2" dest: "/etc/systemd/system/matrix-mx-puppet-discord.service" mode: 0644 register: matrix_mx_puppet_discord_systemd_service_result - name: Ensure systemd reloaded after matrix-mx-puppet-discord.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_mx_puppet_discord_systemd_service_result.changed" - name: Ensure matrix-mx-puppet-discord.service restarted, if necessary - service: + ansible.builtin.service: name: "matrix-mx-puppet-discord.service" state: restarted 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 b3ab8e39..beff6c5d 100644 --- a/roles/matrix-bridge-mx-puppet-discord/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-mx-puppet-discord/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_mx_puppet_discord_service_stat - name: Ensure matrix-mx-puppet-discord is stopped - service: + ansible.builtin.service: name: matrix-mx-puppet-discord state: stopped enabled: false @@ -14,12 +14,12 @@ when: "matrix_mx_puppet_discord_service_stat.stat.exists" - name: Ensure matrix-mx-puppet-discord.service doesn't exist - file: + ansible.builtin.file: path: "/etc/systemd/system/matrix-mx-puppet-discord.service" state: absent when: "matrix_mx_puppet_discord_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-mx-puppet-discord.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_mx_puppet_discord_service_stat.stat.exists" diff --git a/roles/matrix-bridge-mx-puppet-discord/tasks/validate_config.yml b/roles/matrix-bridge-mx-puppet-discord/tasks/validate_config.yml index c253eda2..e73a868a 100644 --- a/roles/matrix-bridge-mx-puppet-discord/tasks/validate_config.yml +++ b/roles/matrix-bridge-mx-puppet-discord/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). when: "vars[item] == ''" diff --git a/roles/matrix-bridge-mx-puppet-groupme/tasks/init.yml b/roles/matrix-bridge-mx-puppet-groupme/tasks/init.yml index 9bada5d8..0791546d 100644 --- a/roles/matrix-bridge-mx-puppet-groupme/tasks/init.yml +++ b/roles/matrix-bridge-mx-puppet-groupme/tasks/init.yml @@ -2,16 +2,16 @@ # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 - name: Fail if trying to self-build on Ansible < 2.8 - fail: + 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_mx_puppet_groupme_container_image_self_build and matrix_mx_puppet_groupme_enabled" -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mx-puppet-groupme.service'] }}" when: matrix_mx_puppet_groupme_enabled|bool # If the matrix-synapse role is not used, these variables may not exist. -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ matrix_synapse_container_extra_arguments|default([]) 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 286c5611..9ca9c7ea 100644 --- a/roles/matrix-bridge-mx-puppet-groupme/tasks/setup_install.yml +++ b/roles/matrix-bridge-mx-puppet-groupme/tasks/setup_install.yml @@ -3,13 +3,13 @@ # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # We don't want to fail in such cases. - name: Fail if matrix-synapse role already executed - fail: + 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)" - name: Ensure MX Puppet Groupme paths exist - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -28,7 +28,7 @@ register: matrix_mx_puppet_groupme_stat_database - name: (Data relocation) Ensure matrix-mx-puppet-groupme.service is stopped - service: + ansible.builtin.service: name: matrix-mx-puppet-groupme state: stopped enabled: false @@ -37,10 +37,10 @@ when: "matrix_mx_puppet_groupme_stat_database.stat.exists" - name: (Data relocation) Move mx-puppet-groupme database file to ./data directory - command: "mv {{ matrix_mx_puppet_groupme_base_path }}/database.db {{ matrix_mx_puppet_groupme_data_path }}/database.db" + ansible.builtin.command: "mv {{ matrix_mx_puppet_groupme_base_path }}/database.db {{ matrix_mx_puppet_groupme_data_path }}/database.db" when: "matrix_mx_puppet_groupme_stat_database.stat.exists" -- set_fact: +- ansible.builtin.set_fact: matrix_mx_puppet_groupme_requires_restart: false - block: @@ -50,7 +50,7 @@ register: matrix_mx_puppet_groupme_sqlite_database_path_local_stat_result - block: - - set_fact: + - ansible.builtin.set_fact: matrix_postgres_db_migration_request: src: "{{ matrix_mx_puppet_groupme_sqlite_database_path_local }}" dst: "{{ matrix_mx_puppet_groupme_database_connection_string }}" @@ -61,7 +61,7 @@ - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" - - set_fact: + - 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_database_engine == 'postgres'" @@ -79,7 +79,7 @@ until: result is not failed - name: Ensure MX Puppet Groupme repository is present on self build - git: + ansible.builtin.git: repo: "{{ matrix_mx_puppet_groupme_container_image_self_build_repo }}" dest: "{{ matrix_mx_puppet_groupme_docker_src_files_path }}" force: "yes" @@ -101,7 +101,7 @@ when: "matrix_mx_puppet_groupme_enabled|bool and matrix_mx_puppet_groupme_container_image_self_build" - name: Ensure mx-puppet-groupme config.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_mx_puppet_groupme_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mx_puppet_groupme_config_path }}/config.yaml" mode: 0644 @@ -109,7 +109,7 @@ group: "{{ matrix_user_groupname }}" - name: Ensure mx-puppet-groupme groupme-registration.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_mx_puppet_groupme_registration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mx_puppet_groupme_config_path }}/registration.yaml" mode: 0644 @@ -117,19 +117,19 @@ group: "{{ matrix_user_groupname }}" - name: Ensure matrix-mx-puppet-groupme.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-mx-puppet-groupme.service.j2" dest: "/etc/systemd/system/matrix-mx-puppet-groupme.service" mode: 0644 register: matrix_mx_puppet_groupme_systemd_service_result - name: Ensure systemd reloaded after matrix-mx-puppet-groupme.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_mx_puppet_groupme_systemd_service_result.changed" - name: Ensure matrix-mx-puppet-groupme.service restarted, if necessary - service: + ansible.builtin.service: name: "matrix-mx-puppet-groupme.service" state: restarted 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 24daf7be..faf5ac0a 100644 --- a/roles/matrix-bridge-mx-puppet-groupme/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-mx-puppet-groupme/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_mx_puppet_groupme_service_stat - name: Ensure matrix-mx-puppet-groupme is stopped - service: + ansible.builtin.service: name: matrix-mx-puppet-groupme state: stopped enabled: false @@ -14,12 +14,12 @@ when: "matrix_mx_puppet_groupme_service_stat.stat.exists" - name: Ensure matrix-mx-puppet-groupme.service doesn't exist - file: + ansible.builtin.file: path: "/etc/systemd/system/matrix-mx-puppet-groupme.service" state: absent when: "matrix_mx_puppet_groupme_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-mx-puppet-groupme.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_mx_puppet_groupme_service_stat.stat.exists" diff --git a/roles/matrix-bridge-mx-puppet-groupme/tasks/validate_config.yml b/roles/matrix-bridge-mx-puppet-groupme/tasks/validate_config.yml index 5c5463ce..d091de6d 100644 --- a/roles/matrix-bridge-mx-puppet-groupme/tasks/validate_config.yml +++ b/roles/matrix-bridge-mx-puppet-groupme/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). when: "vars[item] == ''" diff --git a/roles/matrix-bridge-mx-puppet-instagram/tasks/init.yml b/roles/matrix-bridge-mx-puppet-instagram/tasks/init.yml index ae6302b3..3f2b98dc 100644 --- a/roles/matrix-bridge-mx-puppet-instagram/tasks/init.yml +++ b/roles/matrix-bridge-mx-puppet-instagram/tasks/init.yml @@ -2,16 +2,16 @@ # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 - name: Fail if trying to self-build on Ansible < 2.8 - fail: + 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_mx_puppet_instagram_container_image_self_build and matrix_mx_puppet_instagram_enabled" -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mx-puppet-instagram.service'] }}" when: matrix_mx_puppet_instagram_enabled|bool # If the matrix-synapse role is not used, these variables may not exist. -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ matrix_synapse_container_extra_arguments|default([]) 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 2e74c059..4048e175 100644 --- a/roles/matrix-bridge-mx-puppet-instagram/tasks/setup_install.yml +++ b/roles/matrix-bridge-mx-puppet-instagram/tasks/setup_install.yml @@ -3,13 +3,13 @@ # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # We don't want to fail in such cases. - name: Fail if matrix-synapse role already executed - fail: + 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)" -- set_fact: +- ansible.builtin.set_fact: matrix_mx_puppet_instagram_requires_restart: false - block: @@ -19,7 +19,7 @@ register: matrix_mx_puppet_instagram_sqlite_database_path_local_stat_result - block: - - set_fact: + - ansible.builtin.set_fact: matrix_postgres_db_migration_request: src: "{{ matrix_mx_puppet_instagram_sqlite_database_path_local }}" dst: "{{ matrix_mx_puppet_instagram_database_connection_string }}" @@ -30,7 +30,7 @@ - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" - - set_fact: + - 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_database_engine == 'postgres'" @@ -48,7 +48,7 @@ until: result is not failed - name: Ensure mx-puppet-instagram paths exist - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -62,7 +62,7 @@ when: matrix_mx_puppet_instagram_enabled|bool and item.when|bool - name: Ensure mx-puppet-instagram repository is present on self build - git: + ansible.builtin.git: repo: "{{ matrix_mx_puppet_instagram_container_image_self_build_repo }}" dest: "{{ matrix_mx_puppet_instagram_docker_src_files_path }}" force: "yes" @@ -84,7 +84,7 @@ 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 - copy: + ansible.builtin.copy: content: "{{ matrix_mx_puppet_instagram_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mx_puppet_instagram_config_path }}/config.yaml" mode: 0644 @@ -92,7 +92,7 @@ group: "{{ matrix_user_groupname }}" - name: Ensure mx-puppet-instagram-registration.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_mx_puppet_instagram_registration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mx_puppet_instagram_config_path }}/registration.yaml" mode: 0644 @@ -100,19 +100,19 @@ group: "{{ matrix_user_groupname }}" - name: Ensure matrix-mx-puppet-instagram.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-mx-puppet-instagram.service.j2" dest: "/etc/systemd/system/matrix-mx-puppet-instagram.service" mode: 0644 register: matrix_mx_puppet_instagram_systemd_service_result - name: Ensure systemd reloaded after matrix-mx-puppet-instagram.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_mx_puppet_instagram_systemd_service_result.changed" - name: Ensure matrix-mx-puppet-instagram.service restarted, if necessary - service: + ansible.builtin.service: name: "matrix-mx-puppet-instagram.service" state: restarted 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 e4435a3e..cb876e2a 100644 --- a/roles/matrix-bridge-mx-puppet-instagram/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-mx-puppet-instagram/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_mx_puppet_instagram_service_stat - name: Ensure matrix-mx-puppet-instagram is stopped - service: + ansible.builtin.service: name: matrix-mx-puppet-instagram state: stopped enabled: false @@ -14,12 +14,12 @@ when: "matrix_mx_puppet_instagram_service_stat.stat.exists" - name: Ensure matrix-mx-puppet-instagram.service doesn't exist - file: + ansible.builtin.file: path: "/etc/systemd/system/matrix-mx-puppet-instagram.service" state: absent when: "matrix_mx_puppet_instagram_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-mx-puppet-instagram.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_mx_puppet_instagram_service_stat.stat.exists" diff --git a/roles/matrix-bridge-mx-puppet-instagram/tasks/validate_config.yml b/roles/matrix-bridge-mx-puppet-instagram/tasks/validate_config.yml index b6d9d994..383fe502 100644 --- a/roles/matrix-bridge-mx-puppet-instagram/tasks/validate_config.yml +++ b/roles/matrix-bridge-mx-puppet-instagram/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). when: "vars[item] == ''" diff --git a/roles/matrix-bridge-mx-puppet-slack/tasks/init.yml b/roles/matrix-bridge-mx-puppet-slack/tasks/init.yml index ed6753a2..74a6ed44 100644 --- a/roles/matrix-bridge-mx-puppet-slack/tasks/init.yml +++ b/roles/matrix-bridge-mx-puppet-slack/tasks/init.yml @@ -2,16 +2,16 @@ # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 - name: Fail if trying to self-build on Ansible < 2.8 - fail: + 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_mx_puppet_slack_container_image_self_build and matrix_mx_puppet_slack_enabled" -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mx-puppet-slack.service'] }}" when: matrix_mx_puppet_slack_enabled|bool # If the matrix-synapse role is not used, these variables may not exist. -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ matrix_synapse_container_extra_arguments|default([]) @@ -29,7 +29,7 @@ - block: - name: Fail if matrix-nginx-proxy role already executed - fail: + ansible.builtin.fail: msg: >- Trying to append Slack Appservice's reverse-proxying configuration to matrix-nginx-proxy, but it's pointless since the matrix-nginx-proxy role had already executed. @@ -38,7 +38,7 @@ when: matrix_nginx_proxy_role_executed|default(False)|bool - name: Generate Matrix MX Puppet Slack proxying configuration for matrix-nginx-proxy - set_fact: + 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) %} @@ -53,7 +53,7 @@ } - name: Register Slack Appservice proxying configuration with matrix-nginx-proxy - set_fact: + ansible.builtin.set_fact: matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: | {{ matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([]) @@ -65,7 +65,7 @@ when: matrix_mx_puppet_slack_enabled|bool - name: Warn about reverse-proxying if matrix-nginx-proxy not used - debug: + ansible.builtin.debug: msg: >- NOTE: You've enabled the Matrix Slack bridge but are not using the matrix-nginx-proxy reverse proxy. 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 3a7dfb40..48408b5a 100644 --- a/roles/matrix-bridge-mx-puppet-slack/tasks/setup_install.yml +++ b/roles/matrix-bridge-mx-puppet-slack/tasks/setup_install.yml @@ -3,13 +3,13 @@ # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # We don't want to fail in such cases. - name: Fail if matrix-synapse role already executed - fail: + 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)" - name: Ensure MX Puppet Slack paths exist - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -28,7 +28,7 @@ register: matrix_mx_puppet_slack_stat_database - name: (Data relocation) Ensure matrix-mx-puppet-slack.service is stopped - service: + ansible.builtin.service: name: matrix-mx-puppet-slack state: stopped enabled: false @@ -36,7 +36,7 @@ failed_when: false when: "matrix_mx_puppet_slack_stat_database.stat.exists" -- set_fact: +- ansible.builtin.set_fact: matrix_mx_puppet_slack_requires_restart: false - block: @@ -46,7 +46,7 @@ register: matrix_mx_puppet_slack_sqlite_database_path_local_stat_result - block: - - set_fact: + - ansible.builtin.set_fact: matrix_postgres_db_migration_request: src: "{{ matrix_mx_puppet_slack_sqlite_database_path_local }}" dst: "{{ matrix_mx_puppet_slack_database_connection_string }}" @@ -57,7 +57,7 @@ - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" - - set_fact: + - 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_database_engine == 'postgres'" @@ -75,7 +75,7 @@ until: result is not failed - name: Ensure MX Puppet Slack repository is present on self build - git: + ansible.builtin.git: repo: "{{ matrix_mx_puppet_slack_container_image_self_build_repo }}" dest: "{{ matrix_mx_puppet_slack_docker_src_files_path }}" force: "yes" @@ -98,11 +98,11 @@ 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 - command: "mv {{ matrix_mx_puppet_slack_base_path }}/database.db {{ matrix_mx_puppet_slack_data_path }}/database.db" + ansible.builtin.command: "mv {{ matrix_mx_puppet_slack_base_path }}/database.db {{ matrix_mx_puppet_slack_data_path }}/database.db" when: "matrix_mx_puppet_slack_stat_database.stat.exists" - name: Ensure mx-puppet-slack config.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_mx_puppet_slack_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mx_puppet_slack_config_path }}/config.yaml" mode: 0644 @@ -110,7 +110,7 @@ group: "{{ matrix_user_groupname }}" - name: Ensure mx-puppet-slack slack-registration.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_mx_puppet_slack_registration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mx_puppet_slack_config_path }}/registration.yaml" mode: 0644 @@ -118,19 +118,19 @@ group: "{{ matrix_user_groupname }}" - name: Ensure matrix-mx-puppet-slack.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-mx-puppet-slack.service.j2" dest: "/etc/systemd/system/matrix-mx-puppet-slack.service" mode: 0644 register: matrix_mx_puppet_slack_systemd_service_result - name: Ensure systemd reloaded after matrix-mx-puppet-slack.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_mx_puppet_slack_systemd_service_result.changed" - name: Ensure matrix-mx-puppet-slack.service restarted, if necessary - service: + ansible.builtin.service: name: "matrix-mx-puppet-slack.service" state: restarted 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 3a119267..835e20d7 100644 --- a/roles/matrix-bridge-mx-puppet-slack/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-mx-puppet-slack/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_mx_puppet_slack_service_stat - name: Ensure matrix-mx-puppet-slack is stopped - service: + ansible.builtin.service: name: matrix-mx-puppet-slack state: stopped enabled: false @@ -14,12 +14,12 @@ when: "matrix_mx_puppet_slack_service_stat.stat.exists" - name: Ensure matrix-mx-puppet-slack.service doesn't exist - file: + ansible.builtin.file: path: "/etc/systemd/system/matrix-mx-puppet-slack.service" state: absent when: "matrix_mx_puppet_slack_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-mx-puppet-slack.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_mx_puppet_slack_service_stat.stat.exists" diff --git a/roles/matrix-bridge-mx-puppet-slack/tasks/validate_config.yml b/roles/matrix-bridge-mx-puppet-slack/tasks/validate_config.yml index 3a0bca11..ea917f97 100644 --- a/roles/matrix-bridge-mx-puppet-slack/tasks/validate_config.yml +++ b/roles/matrix-bridge-mx-puppet-slack/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). when: "vars[item] == ''" diff --git a/roles/matrix-bridge-mx-puppet-steam/tasks/init.yml b/roles/matrix-bridge-mx-puppet-steam/tasks/init.yml index 9a171af7..7c5487f4 100644 --- a/roles/matrix-bridge-mx-puppet-steam/tasks/init.yml +++ b/roles/matrix-bridge-mx-puppet-steam/tasks/init.yml @@ -2,16 +2,16 @@ # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 - name: Fail if trying to self-build on Ansible < 2.8 - fail: + 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_mx_puppet_steam_container_image_self_build and matrix_mx_puppet_steam_enabled" -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mx-puppet-steam.service'] }}" when: matrix_mx_puppet_steam_enabled|bool # If the matrix-synapse role is not used, these variables may not exist. -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ matrix_synapse_container_extra_arguments|default([]) 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 ac2a2fda..dfb7c6c9 100644 --- a/roles/matrix-bridge-mx-puppet-steam/tasks/setup_install.yml +++ b/roles/matrix-bridge-mx-puppet-steam/tasks/setup_install.yml @@ -3,13 +3,13 @@ # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # We don't want to fail in such cases. - name: Fail if matrix-synapse role already executed - fail: + 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)" - name: Ensure MX Puppet Steam paths exist - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -28,7 +28,7 @@ register: matrix_mx_puppet_steam_stat_database - name: (Data relocation) Ensure matrix-mx-puppet-steam.service is stopped - service: + ansible.builtin.service: name: matrix-mx-puppet-steam state: stopped enabled: false @@ -37,10 +37,10 @@ when: "matrix_mx_puppet_steam_stat_database.stat.exists" - name: (Data relocation) Move mx-puppet-steam database file to ./data directory - command: "mv {{ matrix_mx_puppet_steam_base_path }}/database.db {{ matrix_mx_puppet_steam_data_path }}/database.db" + ansible.builtin.command: "mv {{ matrix_mx_puppet_steam_base_path }}/database.db {{ matrix_mx_puppet_steam_data_path }}/database.db" when: "matrix_mx_puppet_steam_stat_database.stat.exists" -- set_fact: +- ansible.builtin.set_fact: matrix_mx_puppet_steam_requires_restart: false - block: @@ -50,7 +50,7 @@ register: matrix_mx_puppet_steam_sqlite_database_path_local_stat_result - block: - - set_fact: + - ansible.builtin.set_fact: matrix_postgres_db_migration_request: src: "{{ matrix_mx_puppet_steam_sqlite_database_path_local }}" dst: "{{ matrix_mx_puppet_steam_database_connection_string }}" @@ -61,7 +61,7 @@ - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" - - set_fact: + - 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_database_engine == 'postgres'" @@ -79,7 +79,7 @@ until: result is not failed - name: Ensure MX Puppet Steam repository is present on self build - git: + ansible.builtin.git: repo: "{{ matrix_mx_puppet_steam_container_image_self_build_repo }}" dest: "{{ matrix_mx_puppet_steam_docker_src_files_path }}" force: "yes" @@ -101,7 +101,7 @@ when: "matrix_mx_puppet_steam_enabled|bool and matrix_mx_puppet_steam_container_image_self_build" - name: Ensure mx-puppet-steam config.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_mx_puppet_steam_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mx_puppet_steam_config_path }}/config.yaml" mode: 0644 @@ -109,7 +109,7 @@ group: "{{ matrix_user_groupname }}" - name: Ensure mx-puppet-steam steam-registration.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_mx_puppet_steam_registration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mx_puppet_steam_config_path }}/registration.yaml" mode: 0644 @@ -117,19 +117,19 @@ group: "{{ matrix_user_groupname }}" - name: Ensure matrix-mx-puppet-steam.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-mx-puppet-steam.service.j2" dest: "/etc/systemd/system/matrix-mx-puppet-steam.service" mode: 0644 register: matrix_mx_puppet_steam_systemd_service_result - name: Ensure systemd reloaded after matrix-mx-puppet-steam.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_mx_puppet_steam_systemd_service_result.changed" - name: Ensure matrix-mx-puppet-steam.service restarted, if necessary - service: + ansible.builtin.service: name: "matrix-mx-puppet-steam.service" state: restarted 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 2e152ef6..7ec8245d 100644 --- a/roles/matrix-bridge-mx-puppet-steam/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-mx-puppet-steam/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_mx_puppet_steam_service_stat - name: Ensure matrix-mx-puppet-steam is stopped - service: + ansible.builtin.service: name: matrix-mx-puppet-steam state: stopped enabled: false @@ -14,12 +14,12 @@ when: "matrix_mx_puppet_steam_service_stat.stat.exists" - name: Ensure matrix-mx-puppet-steam.service doesn't exist - file: + ansible.builtin.file: path: "/etc/systemd/system/matrix-mx-puppet-steam.service" state: absent when: "matrix_mx_puppet_steam_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-mx-puppet-steam.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_mx_puppet_steam_service_stat.stat.exists" diff --git a/roles/matrix-bridge-mx-puppet-steam/tasks/validate_config.yml b/roles/matrix-bridge-mx-puppet-steam/tasks/validate_config.yml index a8bc6a42..2e54d6ff 100644 --- a/roles/matrix-bridge-mx-puppet-steam/tasks/validate_config.yml +++ b/roles/matrix-bridge-mx-puppet-steam/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). when: "vars[item] == ''" diff --git a/roles/matrix-bridge-mx-puppet-twitter/tasks/init.yml b/roles/matrix-bridge-mx-puppet-twitter/tasks/init.yml index d774de15..53e2f2f5 100644 --- a/roles/matrix-bridge-mx-puppet-twitter/tasks/init.yml +++ b/roles/matrix-bridge-mx-puppet-twitter/tasks/init.yml @@ -2,16 +2,16 @@ # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 - name: Fail if trying to self-build on Ansible < 2.8 - fail: + 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_mx_puppet_twitter_container_image_self_build and matrix_mx_puppet_twitter_enabled" -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mx-puppet-twitter.service'] }}" when: matrix_mx_puppet_twitter_enabled|bool # If the matrix-synapse role is not used, these variables may not exist. -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ matrix_synapse_container_extra_arguments|default([]) @@ -29,7 +29,7 @@ - block: - name: Fail if matrix-nginx-proxy role already executed - fail: + ansible.builtin.fail: msg: >- Trying to append Twitter Appservice's reverse-proxying configuration to matrix-nginx-proxy, but it's pointless since the matrix-nginx-proxy role had already executed. @@ -38,7 +38,7 @@ when: matrix_nginx_proxy_role_executed|default(False)|bool - name: Generate Matrix MX Puppet Twitter proxying configuration for matrix-nginx-proxy - set_fact: + 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) %} @@ -53,7 +53,7 @@ } - name: Register Twitter Appservice proxying configuration with matrix-nginx-proxy - set_fact: + ansible.builtin.set_fact: matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: | {{ matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([]) @@ -65,7 +65,7 @@ when: matrix_mx_puppet_twitter_enabled|bool - name: Warn about reverse-proxying if matrix-nginx-proxy not used - debug: + ansible.builtin.debug: msg: >- NOTE: You've enabled the Matrix Twitter bridge but are not using the matrix-nginx-proxy reverse proxy. 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 6336b0a0..34d522f5 100644 --- a/roles/matrix-bridge-mx-puppet-twitter/tasks/setup_install.yml +++ b/roles/matrix-bridge-mx-puppet-twitter/tasks/setup_install.yml @@ -3,13 +3,13 @@ # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # We don't want to fail in such cases. - name: Fail if matrix-synapse role already executed - fail: + 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)" - name: Ensure MX Puppet Twitter paths exist - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -28,7 +28,7 @@ register: matrix_mx_puppet_twitter_stat_database - name: (Data relocation) Ensure matrix-mx-puppet-twitter.service is stopped - service: + ansible.builtin.service: name: matrix-mx-puppet-twitter state: stopped enabled: false @@ -37,10 +37,10 @@ when: "matrix_mx_puppet_twitter_stat_database.stat.exists" - name: (Data relocation) Move mx-puppet-twitter database file to ./data directory - command: "mv {{ matrix_mx_puppet_twitter_base_path }}/database.db {{ matrix_mx_puppet_twitter_data_path }}/database.db" + ansible.builtin.command: "mv {{ matrix_mx_puppet_twitter_base_path }}/database.db {{ matrix_mx_puppet_twitter_data_path }}/database.db" when: "matrix_mx_puppet_twitter_stat_database.stat.exists" -- set_fact: +- ansible.builtin.set_fact: matrix_mx_puppet_twitter_requires_restart: false - block: @@ -50,7 +50,7 @@ register: matrix_mx_puppet_twitter_sqlite_database_path_local_stat_result - block: - - set_fact: + - ansible.builtin.set_fact: matrix_postgres_db_migration_request: src: "{{ matrix_mx_puppet_twitter_sqlite_database_path_local }}" dst: "{{ matrix_mx_puppet_twitter_database_connection_string }}" @@ -61,7 +61,7 @@ - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" - - set_fact: + - 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_database_engine == 'postgres'" @@ -79,7 +79,7 @@ until: result is not failed - name: Ensure MX Puppet Twitter repository is present on self build - git: + ansible.builtin.git: repo: "{{ matrix_mx_puppet_twitter_container_image_self_build_repo }}" dest: "{{ matrix_mx_puppet_twitter_docker_src_files_path }}" force: "yes" @@ -101,7 +101,7 @@ when: "matrix_mx_puppet_twitter_enabled|bool and matrix_mx_puppet_twitter_container_image_self_build" - name: Ensure mx-puppet-twitter config.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_mx_puppet_twitter_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mx_puppet_twitter_config_path }}/config.yaml" mode: 0644 @@ -109,7 +109,7 @@ group: "{{ matrix_user_groupname }}" - name: Ensure mx-puppet-twitter twitter-registration.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_mx_puppet_twitter_registration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_mx_puppet_twitter_config_path }}/registration.yaml" mode: 0644 @@ -117,19 +117,19 @@ group: "{{ matrix_user_groupname }}" - name: Ensure matrix-mx-puppet-twitter.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-mx-puppet-twitter.service.j2" dest: "/etc/systemd/system/matrix-mx-puppet-twitter.service" mode: 0644 register: matrix_mx_puppet_twitter_systemd_service_result - name: Ensure systemd reloaded after matrix-mx-puppet-twitter.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_mx_puppet_twitter_systemd_service_result.changed" - name: Ensure matrix-mx-puppet-twitter.service restarted, if necessary - service: + ansible.builtin.service: name: "matrix-mx-puppet-twitter.service" state: restarted 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 56dcd9ce..2718634d 100644 --- a/roles/matrix-bridge-mx-puppet-twitter/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-mx-puppet-twitter/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_mx_puppet_twitter_service_stat - name: Ensure matrix-mx-puppet-twitter is stopped - service: + ansible.builtin.service: name: matrix-mx-puppet-twitter state: stopped enabled: false @@ -14,12 +14,12 @@ when: "matrix_mx_puppet_twitter_service_stat.stat.exists" - name: Ensure matrix-mx-puppet-twitter.service doesn't exist - file: + ansible.builtin.file: path: "/etc/systemd/system/matrix-mx-puppet-twitter.service" state: absent when: "matrix_mx_puppet_twitter_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-mx-puppet-twitter.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_mx_puppet_twitter_service_stat.stat.exists" diff --git a/roles/matrix-bridge-mx-puppet-twitter/tasks/validate_config.yml b/roles/matrix-bridge-mx-puppet-twitter/tasks/validate_config.yml index d13a39e1..b5b7ef5b 100644 --- a/roles/matrix-bridge-mx-puppet-twitter/tasks/validate_config.yml +++ b/roles/matrix-bridge-mx-puppet-twitter/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). when: "vars[item] == ''" diff --git a/roles/matrix-bridge-sms/tasks/init.yml b/roles/matrix-bridge-sms/tasks/init.yml index 9ee96b3e..4a3d1719 100644 --- a/roles/matrix-bridge-sms/tasks/init.yml +++ b/roles/matrix-bridge-sms/tasks/init.yml @@ -3,17 +3,17 @@ # If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist. # We don't want to fail in such cases. - name: Fail if matrix-synapse role already executed - fail: + 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)" -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-sms-bridge.service'] }}" when: matrix_sms_bridge_enabled|bool # If the matrix-synapse role is not used, these variables may not exist. -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_container_extra_arguments: > {{ matrix_synapse_container_extra_arguments|default([]) diff --git a/roles/matrix-bridge-sms/tasks/setup_install.yml b/roles/matrix-bridge-sms/tasks/setup_install.yml index 412c26fe..ad6a9185 100644 --- a/roles/matrix-bridge-sms/tasks/setup_install.yml +++ b/roles/matrix-bridge-sms/tasks/setup_install.yml @@ -10,7 +10,7 @@ until: result is not failed - name: Ensure matrix-sms-bridge paths exist - file: + ansible.builtin.file: path: "{{ item }}" state: directory mode: 0750 @@ -22,7 +22,7 @@ - "{{ matrix_sms_bridge_data_path }}" - name: Ensure matrix-sms-bridge application.yml installed - copy: + ansible.builtin.copy: content: "{{ matrix_sms_bridge_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_sms_bridge_config_path }}/application.yml" mode: 0644 @@ -30,7 +30,7 @@ group: "{{ matrix_user_groupname }}" - name: Ensure matrix-sms-bridge registration.yaml installed - copy: + ansible.builtin.copy: content: "{{ matrix_sms_bridge_registration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_sms_bridge_config_path }}/registration.yaml" mode: 0644 @@ -38,7 +38,7 @@ group: "{{ matrix_user_groupname }}" - name: Ensure android-sms-gateway-server cert installed - copy: + ansible.builtin.copy: src: "{{ matrix_sms_bridge_provider_android_truststore_local_path }}" dest: "{{ matrix_sms_bridge_config_path }}/matrix-sms-gateway-server.p12" mode: 0644 @@ -47,13 +47,13 @@ when: matrix_sms_bridge_provider_android_truststore_local_path != "" - name: Ensure matrix-sms-bridge.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-sms-bridge.service.j2" dest: "{{ matrix_systemd_path }}/matrix-sms-bridge.service" mode: 0644 register: matrix_sms_bridge_systemd_service_result - name: Ensure systemd reloaded after matrix-sms-bridge.service installation - service: + ansible.builtin.service: daemon_reload: true when: matrix_sms_bridge_systemd_service_result.changed diff --git a/roles/matrix-bridge-sms/tasks/setup_uninstall.yml b/roles/matrix-bridge-sms/tasks/setup_uninstall.yml index d74476eb..f0f966b2 100644 --- a/roles/matrix-bridge-sms/tasks/setup_uninstall.yml +++ b/roles/matrix-bridge-sms/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_sms_bridge_service_stat - name: Ensure matrix-sms-bridge is stopped - service: + ansible.builtin.service: name: matrix-sms-bridge state: stopped enabled: false @@ -14,7 +14,7 @@ when: "matrix_sms_bridge_service_stat.stat.exists" - name: Ensure matrix-sms-bridge.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-sms-bridge.service" state: absent when: "matrix_sms_bridge_service_stat.stat.exists" diff --git a/roles/matrix-bridge-sms/tasks/validate_config.yml b/roles/matrix-bridge-sms/tasks/validate_config.yml index 96e41755..fa7dcfbd 100644 --- a/roles/matrix-bridge-sms/tasks/validate_config.yml +++ b/roles/matrix-bridge-sms/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). when: "vars[item] == ''" diff --git a/roles/matrix-client-cinny/tasks/init.yml b/roles/matrix-client-cinny/tasks/init.yml index 04fbd8a2..4d1190dc 100644 --- a/roles/matrix-client-cinny/tasks/init.yml +++ b/roles/matrix-client-cinny/tasks/init.yml @@ -2,10 +2,10 @@ # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 - name: Fail if trying to self-build on Ansible < 2.8 - fail: + ansible.builtin.fail: msg: "To self-build the Cinny 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_client_cinny_container_image_self_build and matrix_client_cinny_enabled" -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-client-cinny.service'] }}" when: matrix_client_cinny_enabled|bool diff --git a/roles/matrix-client-cinny/tasks/self_check.yml b/roles/matrix-client-cinny/tasks/self_check.yml index d00408da..e0f9bfc1 100644 --- a/roles/matrix-client-cinny/tasks/self_check.yml +++ b/roles/matrix-client-cinny/tasks/self_check.yml @@ -1,10 +1,10 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_client_cinny_url_endpoint_public: "https://{{ matrix_server_fqn_cinny }}/config.json" - name: Check Cinny - uri: + ansible.builtin.uri: url: "{{ matrix_client_cinny_url_endpoint_public }}" follow_redirects: none validate_certs: "{{ matrix_client_cinny_self_check_validate_certificates }}" @@ -13,10 +13,10 @@ ignore_errors: true - name: Fail if Cinny not working - fail: + ansible.builtin.fail: msg: "Failed checking Cinny is up at `{{ matrix_server_fqn_cinny }}` (checked endpoint: `{{ matrix_client_cinny_url_endpoint_public }}`). Is Cinny running? Is port 443 open in your firewall? Full error: {{ matrix_client_cinny_self_check_result }}" when: "matrix_client_cinny_self_check_result.failed or 'json' not in matrix_client_cinny_self_check_result" - name: Report working Cinny - debug: + ansible.builtin.debug: msg: "Cinny at `{{ matrix_server_fqn_cinny }}` is working (checked endpoint: `{{ matrix_client_cinny_url_endpoint_public }}`)" diff --git a/roles/matrix-client-cinny/tasks/setup_install.yml b/roles/matrix-client-cinny/tasks/setup_install.yml index da979f56..3689586f 100644 --- a/roles/matrix-client-cinny/tasks/setup_install.yml +++ b/roles/matrix-client-cinny/tasks/setup_install.yml @@ -1,6 +1,6 @@ --- - name: Ensure Cinny paths exists - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -24,7 +24,7 @@ until: result is not failed - name: Ensure Cinny repository is present on self-build - git: + ansible.builtin.git: repo: "{{ matrix_client_cinny_container_image_self_build_repo }}" dest: "{{ matrix_client_cinny_docker_src_files_path }}" version: "{{ matrix_client_cinny_docker_image.split(':')[1] }}" @@ -35,7 +35,7 @@ when: "matrix_client_cinny_container_image_self_build|bool" - name: Ensure Cinny configuration installed - copy: + ansible.builtin.copy: content: "{{ matrix_client_cinny_configuration|to_nice_json }}" dest: "{{ matrix_client_cinny_data_path }}/config.json" mode: 0644 @@ -43,7 +43,7 @@ group: "{{ matrix_user_groupname }}" - name: Ensure Cinny additional config files installed - template: + ansible.builtin.template: src: "{{ item.src }}" dest: "{{ matrix_client_cinny_data_path }}/{{ item.name }}" mode: 0644 @@ -65,13 +65,13 @@ when: "matrix_client_cinny_container_image_self_build|bool" - name: Ensure matrix-client-cinny.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-client-cinny.service.j2" dest: "{{ matrix_systemd_path }}/matrix-client-cinny.service" mode: 0644 register: matrix_client_cinny_systemd_service_result - name: Ensure systemd reloaded after matrix-client-cinny.service installation - service: + ansible.builtin.service: daemon_reload: true 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 507c5d70..866308dd 100644 --- a/roles/matrix-client-cinny/tasks/setup_uninstall.yml +++ b/roles/matrix-client-cinny/tasks/setup_uninstall.yml @@ -5,7 +5,7 @@ register: matrix_client_cinny_service_stat - name: Ensure matrix-client-cinny is stopped - service: + ansible.builtin.service: name: matrix-client-cinny state: stopped enabled: false @@ -14,18 +14,18 @@ when: "matrix_client_cinny_service_stat.stat.exists|bool" - name: Ensure matrix-client-cinny.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-client-cinny.service" state: absent when: "matrix_client_cinny_service_stat.stat.exists|bool" - name: Ensure systemd reloaded after matrix-client-cinny.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_client_cinny_service_stat.stat.exists|bool" - name: Ensure Cinny paths doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_client_cinny_data_path }}" state: absent diff --git a/roles/matrix-client-cinny/tasks/validate_config.yml b/roles/matrix-client-cinny/tasks/validate_config.yml index d8e804c5..10f64fee 100644 --- a/roles/matrix-client-cinny/tasks/validate_config.yml +++ b/roles/matrix-client-cinny/tasks/validate_config.yml @@ -1,6 +1,6 @@ --- - name: Fail if required Cinny settings not defined - fail: + ansible.builtin.fail: msg: > You need to define a required configuration setting (`{{ item }}`) to use Cinny. when: "vars[item] == '' or vars[item] is none" diff --git a/roles/matrix-client-element/tasks/init.yml b/roles/matrix-client-element/tasks/init.yml index cb1df0b5..65edf53a 100644 --- a/roles/matrix-client-element/tasks/init.yml +++ b/roles/matrix-client-element/tasks/init.yml @@ -1,12 +1,12 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-client-element.service'] }}" 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 - name: Fail if trying to self-build on Ansible < 2.8 - fail: + 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_client_element_container_image_self_build and matrix_client_element_enabled" diff --git a/roles/matrix-client-element/tasks/migrate_riot_web.yml b/roles/matrix-client-element/tasks/migrate_riot_web.yml index ee0fd446..b570d892 100644 --- a/roles/matrix-client-element/tasks/migrate_riot_web.yml +++ b/roles/matrix-client-element/tasks/migrate_riot_web.yml @@ -7,7 +7,7 @@ when: "matrix_client_element_enabled|bool" - name: Ensure matrix-riot-web is stopped - service: + ansible.builtin.service: name: matrix-riot-web state: stopped enabled: false @@ -16,13 +16,13 @@ when: "matrix_client_element_enabled|bool and matrix_client_riot_web_service_stat.stat.exists" - name: Ensure matrix-riot-web.service doesn't exist - file: + 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" - name: Ensure systemd reloaded after matrix-riot-web.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_client_element_enabled|bool and matrix_client_riot_web_service_stat.stat.exists" @@ -33,5 +33,5 @@ when: "matrix_client_element_enabled|bool" - name: Relocate /matrix/riot-web to /matrix/client-element - command: "mv /matrix/riot-web /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" diff --git a/roles/matrix-client-element/tasks/prepare_themes.yml b/roles/matrix-client-element/tasks/prepare_themes.yml index bfb9837b..7d5c1019 100644 --- a/roles/matrix-client-element/tasks/prepare_themes.yml +++ b/roles/matrix-client-element/tasks/prepare_themes.yml @@ -6,7 +6,7 @@ - block: - name: Ensure Element themes repository is pulled - git: + ansible.builtin.git: repo: "{{ matrix_client_element_themes_repository_url }}" dest: "{{ role_path }}/files/scratchpad/themes" @@ -18,13 +18,13 @@ register: matrix_client_element_theme_file_list - name: Read Element theme - slurp: + ansible.builtin.slurp: path: "{{ item.path }}" register: "matrix_client_element_theme_file_contents" with_items: "{{ matrix_client_element_theme_file_list.files }}" - name: Load Element theme - set_fact: + ansible.builtin.set_fact: matrix_client_element_settingDefaults_custom_themes: "{{ matrix_client_element_settingDefaults_custom_themes + [item['content'] | b64decode | from_json] }}" with_items: "{{ matrix_client_element_theme_file_contents.results }}" @@ -39,7 +39,7 @@ # - name: Ensure Element themes repository is removed - file: + ansible.builtin.file: path: "{{ role_path }}/files/scratchpad/themes" state: absent run_once: true diff --git a/roles/matrix-client-element/tasks/self_check.yml b/roles/matrix-client-element/tasks/self_check.yml index d05644c8..031bb5f9 100644 --- a/roles/matrix-client-element/tasks/self_check.yml +++ b/roles/matrix-client-element/tasks/self_check.yml @@ -1,10 +1,10 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_client_element_url_endpoint_public: "https://{{ matrix_server_fqn_element }}/config.json" - name: Check Element - uri: + ansible.builtin.uri: url: "{{ matrix_client_element_url_endpoint_public }}" follow_redirects: none validate_certs: "{{ matrix_client_element_self_check_validate_certificates }}" @@ -13,10 +13,10 @@ ignore_errors: true - name: Fail if Element not working - fail: + ansible.builtin.fail: msg: "Failed checking Element is up at `{{ matrix_server_fqn_element }}` (checked endpoint: `{{ matrix_client_element_url_endpoint_public }}`). Is Element running? Is port 443 open in your firewall? Full error: {{ matrix_client_element_self_check_result }}" when: "matrix_client_element_self_check_result.failed or 'json' not in matrix_client_element_self_check_result" - name: Report working Element - debug: + ansible.builtin.debug: msg: "Element at `{{ matrix_server_fqn_element }}` is working (checked endpoint: `{{ matrix_client_element_url_endpoint_public }}`)" diff --git a/roles/matrix-client-element/tasks/setup_install.yml b/roles/matrix-client-element/tasks/setup_install.yml index 4d0af82d..6a4fe3f3 100644 --- a/roles/matrix-client-element/tasks/setup_install.yml +++ b/roles/matrix-client-element/tasks/setup_install.yml @@ -1,7 +1,7 @@ --- - name: Ensure Element paths exists - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -25,7 +25,7 @@ until: result is not failed - name: Ensure Element repository is present on self-build - git: + ansible.builtin.git: repo: "{{ matrix_client_element_container_image_self_build_repo }}" dest: "{{ matrix_client_element_docker_src_files_path }}" version: "{{ matrix_client_element_docker_image.split(':')[1] }}" @@ -39,13 +39,13 @@ # - https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1357 # - https://github.com/vector-im/element-web/issues/19544 - name: Patch webpack.config.js to support building on low-memory (<4G RAM) devices - lineinfile: + ansible.builtin.lineinfile: path: "{{ matrix_client_element_docker_src_files_path }}/webpack.config.js" regexp: '(\s+)splitChunks: \{' line: '\1splitChunks: { maxSize: 100000,' backrefs: true owner: root - group: 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" @@ -62,7 +62,7 @@ when: "matrix_client_element_container_image_self_build|bool" - name: Ensure Element configuration installed - copy: + ansible.builtin.copy: content: "{{ matrix_client_element_configuration|to_nice_json }}" dest: "{{ matrix_client_element_data_path }}/config.json" mode: 0644 @@ -70,7 +70,7 @@ group: "{{ matrix_user_groupname }}" - name: Ensure Element config files installed - template: + ansible.builtin.template: src: "{{ item.src }}" dest: "{{ matrix_client_element_data_path }}/{{ item.name }}" mode: 0644 @@ -83,7 +83,7 @@ when: "item.src is not none" - name: Ensure Element config files removed - file: + ansible.builtin.file: path: "{{ matrix_client_element_data_path }}/{{ item.name }}" state: absent with_items: @@ -91,13 +91,13 @@ when: "item.src is none" - name: Ensure matrix-client-element.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-client-element.service.j2" dest: "{{ matrix_systemd_path }}/matrix-client-element.service" mode: 0644 register: matrix_client_element_systemd_service_result - name: Ensure systemd reloaded after matrix-client-element.service installation - service: + ansible.builtin.service: daemon_reload: true 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 55bc20d6..83b4a795 100644 --- a/roles/matrix-client-element/tasks/setup_uninstall.yml +++ b/roles/matrix-client-element/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_client_element_service_stat - name: Ensure matrix-client-element is stopped - service: + ansible.builtin.service: name: matrix-client-element state: stopped enabled: false @@ -15,18 +15,18 @@ when: "matrix_client_element_service_stat.stat.exists|bool" - name: Ensure matrix-client-element.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-client-element.service" state: absent when: "matrix_client_element_service_stat.stat.exists|bool" - name: Ensure systemd reloaded after matrix-client-element.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_client_element_service_stat.stat.exists|bool" - name: Ensure Element paths doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_client_element_data_path }}" state: absent diff --git a/roles/matrix-client-element/tasks/validate_config.yml b/roles/matrix-client-element/tasks/validate_config.yml index d246b612..fdf74f07 100644 --- a/roles/matrix-client-element/tasks/validate_config.yml +++ b/roles/matrix-client-element/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required Element settings not defined - fail: + ansible.builtin.fail: msg: > You need to define a required configuration setting (`{{ item }}`) for using Element. when: "vars[item] == ''" @@ -9,7 +9,7 @@ - "matrix_client_element_default_hs_url" - name: (Deprecation) Catch and report riot-web variables - fail: + ansible.builtin.fail: msg: >- Riot has been renamed to Element (https://element.io/blog/welcome-to-element/). The playbook will migrate your existing configuration and data automatically, but you need to adjust variable names. diff --git a/roles/matrix-client-hydrogen/tasks/init.yml b/roles/matrix-client-hydrogen/tasks/init.yml index c6801e51..70454d92 100644 --- a/roles/matrix-client-hydrogen/tasks/init.yml +++ b/roles/matrix-client-hydrogen/tasks/init.yml @@ -2,10 +2,10 @@ # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 - name: Fail if trying to self-build on Ansible < 2.8 - fail: + ansible.builtin.fail: msg: "To self-build the Hydrogen 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_client_hydrogen_container_image_self_build and matrix_client_hydrogen_enabled" -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-client-hydrogen.service'] }}" when: matrix_client_hydrogen_enabled|bool diff --git a/roles/matrix-client-hydrogen/tasks/self_check.yml b/roles/matrix-client-hydrogen/tasks/self_check.yml index 0c664231..978e531f 100644 --- a/roles/matrix-client-hydrogen/tasks/self_check.yml +++ b/roles/matrix-client-hydrogen/tasks/self_check.yml @@ -1,10 +1,10 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_client_hydrogen_url_endpoint_public: "https://{{ matrix_server_fqn_hydrogen }}/config.json" - name: Check Hydrogen - uri: + ansible.builtin.uri: url: "{{ matrix_client_hydrogen_url_endpoint_public }}" follow_redirects: none validate_certs: "{{ matrix_client_hydrogen_self_check_validate_certificates }}" @@ -13,10 +13,10 @@ ignore_errors: true - name: Fail if Hydrogen not working - fail: + ansible.builtin.fail: msg: "Failed checking Hydrogen is up at `{{ matrix_server_fqn_hydrogen }}` (checked endpoint: `{{ matrix_client_hydrogen_url_endpoint_public }}`). Is Hydrogen running? Is port 443 open in your firewall? Full error: {{ matrix_client_hydrogen_self_check_result }}" when: "matrix_client_hydrogen_self_check_result.failed or 'json' not in matrix_client_hydrogen_self_check_result" - name: Report working Hydrogen - debug: + ansible.builtin.debug: msg: "Hydrogen at `{{ matrix_server_fqn_hydrogen }}` is working (checked endpoint: `{{ matrix_client_hydrogen_url_endpoint_public }}`)" diff --git a/roles/matrix-client-hydrogen/tasks/setup_install.yml b/roles/matrix-client-hydrogen/tasks/setup_install.yml index db866178..b7a63fb7 100644 --- a/roles/matrix-client-hydrogen/tasks/setup_install.yml +++ b/roles/matrix-client-hydrogen/tasks/setup_install.yml @@ -1,7 +1,7 @@ --- - name: Ensure Hydrogen paths exists - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -25,7 +25,7 @@ until: result is not failed - name: Ensure Hydrogen repository is present on self-build - git: + ansible.builtin.git: repo: "{{ matrix_client_hydrogen_container_image_self_build_repo }}" dest: "{{ matrix_client_hydrogen_docker_src_files_path }}" version: "{{ matrix_client_hydrogen_docker_image.split(':')[1] }}" @@ -36,7 +36,7 @@ when: "matrix_client_hydrogen_container_image_self_build|bool" - name: Ensure Hydrogen configuration installed - copy: + ansible.builtin.copy: content: "{{ matrix_client_hydrogen_configuration|to_nice_json }}" dest: "{{ matrix_client_hydrogen_docker_src_files_path }}/src/platform/web/assets/config.json" mode: 0644 @@ -45,7 +45,7 @@ when: "matrix_client_hydrogen_container_image_self_build|bool" - name: Ensure Hydrogen additional config files installed - template: + ansible.builtin.template: src: "{{ item.src }}" dest: "{{ matrix_client_hydrogen_data_path }}/{{ item.name }}" mode: 0644 @@ -69,13 +69,13 @@ when: "matrix_client_hydrogen_container_image_self_build|bool" - name: Ensure matrix-client-hydrogen.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-client-hydrogen.service.j2" dest: "{{ matrix_systemd_path }}/matrix-client-hydrogen.service" mode: 0644 register: matrix_client_hydrogen_systemd_service_result - name: Ensure systemd reloaded after matrix-client-hydrogen.service installation - service: + ansible.builtin.service: daemon_reload: true 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 7aff2916..ac0c11c7 100644 --- a/roles/matrix-client-hydrogen/tasks/setup_uninstall.yml +++ b/roles/matrix-client-hydrogen/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_client_hydrogen_service_stat - name: Ensure matrix-client-hydrogen is stopped - service: + ansible.builtin.service: name: matrix-client-hydrogen state: stopped enabled: false @@ -15,18 +15,18 @@ when: "matrix_client_hydrogen_service_stat.stat.exists|bool" - name: Ensure matrix-client-hydrogen.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-client-hydrogen.service" state: absent when: "matrix_client_hydrogen_service_stat.stat.exists|bool" - name: Ensure systemd reloaded after matrix-client-hydrogen.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_client_hydrogen_service_stat.stat.exists|bool" - name: Ensure Hydrogen paths doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_client_hydrogen_data_path }}" state: absent diff --git a/roles/matrix-client-hydrogen/tasks/validate_config.yml b/roles/matrix-client-hydrogen/tasks/validate_config.yml index d3b9a709..4188acba 100644 --- a/roles/matrix-client-hydrogen/tasks/validate_config.yml +++ b/roles/matrix-client-hydrogen/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required Hydrogen settings not defined - fail: + 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" diff --git a/roles/matrix-common-after/tasks/dump_runtime_results.yml b/roles/matrix-common-after/tasks/dump_runtime_results.yml index 44ae1a30..4074a625 100644 --- a/roles/matrix-common-after/tasks/dump_runtime_results.yml +++ b/roles/matrix-common-after/tasks/dump_runtime_results.yml @@ -1,7 +1,7 @@ --- # Ansible outputs the message in the `item=` field. # It's unnecessary to output it again in the actual message, so we don't. -- debug: +- ansible.builtin.debug: msg: "" with_items: "{{ matrix_playbook_runtime_results }}" when: "matrix_playbook_runtime_results is defined and matrix_playbook_runtime_results|length > 0" diff --git a/roles/matrix-common-after/tasks/run_docker_prune.yml b/roles/matrix-common-after/tasks/run_docker_prune.yml index a7e35a03..27fc1615 100644 --- a/roles/matrix-common-after/tasks/run_docker_prune.yml +++ b/roles/matrix-common-after/tasks/run_docker_prune.yml @@ -1,4 +1,4 @@ --- - name: Run Docker System Prune - command: "{{ matrix_host_command_docker }} system prune -a -f" + ansible.builtin.command: "{{ matrix_host_command_docker }} system prune -a -f" diff --git a/roles/matrix-common-after/tasks/start.yml b/roles/matrix-common-after/tasks/start.yml index 02fa672e..35126fc1 100644 --- a/roles/matrix-common-after/tasks/start.yml +++ b/roles/matrix-common-after/tasks/start.yml @@ -1,22 +1,22 @@ --- - name: Determine whether we should make services autostart - set_fact: + ansible.builtin.set_fact: matrix_services_autostart_enabled_bool: "{{ true if matrix_services_autostart_enabled|default('') == '' else matrix_services_autostart_enabled|bool }}" - name: Ensure systemd is reloaded - service: + ansible.builtin.service: daemon_reload: true - name: Ensure Matrix services are stopped - service: + ansible.builtin.service: name: "{{ item }}" state: stopped with_items: "{{ matrix_systemd_services_list }}" when: not ansible_check_mode - name: Ensure Matrix services are started - service: + ansible.builtin.service: name: "{{ item }}" enabled: "{{ matrix_services_autostart_enabled_bool }}" state: started @@ -39,7 +39,7 @@ service_facts: - name: Fail if service isn't detected to be running - fail: + ansible.builtin.fail: msg: >- {{ item }} was not detected to be running. It's possible that there's a configuration problem or another service on your server interferes with it (uses the same ports, etc.). @@ -57,13 +57,13 @@ # service_facts is not collecting the data successfully. # Therefore iterating here manually - name: Fetch systemd information - systemd: + ansible.builtin.systemd: name: "{{ item }}" register: systemdstatus with_items: "{{ matrix_systemd_services_list }}" - name: Fail if service isn't detected to be running - fail: + ansible.builtin.fail: msg: >- {{ item.item }} was not detected to be running. It's possible that there's a configuration problem or another service on your server interferes with it (uses the same ports, etc.). diff --git a/roles/matrix-common-after/tasks/stop.yml b/roles/matrix-common-after/tasks/stop.yml index 5ae0afbb..a343999c 100644 --- a/roles/matrix-common-after/tasks/stop.yml +++ b/roles/matrix-common-after/tasks/stop.yml @@ -1,7 +1,7 @@ --- - name: Ensure Matrix services stopped - service: + ansible.builtin.service: name: "{{ item }}" state: stopped with_items: "{{ matrix_systemd_services_list }}" diff --git a/roles/matrix-corporal/tasks/init.yml b/roles/matrix-corporal/tasks/init.yml index b2f50e93..08ef7c88 100644 --- a/roles/matrix-corporal/tasks/init.yml +++ b/roles/matrix-corporal/tasks/init.yml @@ -2,10 +2,10 @@ # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 - name: Fail if trying to self-build on Ansible < 2.8 - fail: + 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_corporal_container_image_self_build and matrix_corporal_enabled" -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-corporal.service'] }}" when: matrix_corporal_enabled|bool diff --git a/roles/matrix-corporal/tasks/self_check_corporal.yml b/roles/matrix-corporal/tasks/self_check_corporal.yml index b702c00f..3ddda8e0 100644 --- a/roles/matrix-corporal/tasks/self_check_corporal.yml +++ b/roles/matrix-corporal/tasks/self_check_corporal.yml @@ -1,10 +1,10 @@ --- -- set_fact: +- ansible.builtin.set_fact: corporal_client_api_url_endpoint_public: "https://{{ matrix_server_fqn_matrix }}/_matrix/client/corporal" - name: Check Matrix Corporal HTTP gateway - uri: + ansible.builtin.uri: url: "{{ corporal_client_api_url_endpoint_public }}" follow_redirects: none return_content: true @@ -13,10 +13,10 @@ ignore_errors: true - name: Fail if Matrix Corporal HTTP gateway not working - fail: + ansible.builtin.fail: msg: "Failed checking Matrix Corporal is fronting the Matrix Client API at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ corporal_client_api_url_endpoint_public }}`). Is matrix-corporal running? Is port 443 open in your firewall? Full error: {{ result_corporal_client_api }}" when: "result_corporal_client_api.failed or 'Matrix Client-Server API protected by Matrix Corporal' not in result_corporal_client_api.content" - name: Report working Matrix Corporal HTTP gateway - debug: + ansible.builtin.debug: msg: "Matrix Corporal is fronting the Matrix Client API at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ corporal_client_api_url_endpoint_public }}`)" diff --git a/roles/matrix-corporal/tasks/setup_corporal.yml b/roles/matrix-corporal/tasks/setup_corporal.yml index a3582592..58039bf4 100644 --- a/roles/matrix-corporal/tasks/setup_corporal.yml +++ b/roles/matrix-corporal/tasks/setup_corporal.yml @@ -5,7 +5,7 @@ # - name: Ensure Matrix Corporal paths exist - file: + ansible.builtin.file: path: "{{ item }}" state: directory mode: 0750 @@ -18,7 +18,7 @@ when: matrix_corporal_enabled|bool - name: Ensure Matrix Corporal repository is present on self-build - git: + ansible.builtin.git: repo: "{{ matrix_corporal_container_image_self_build_repo }}" dest: "{{ matrix_corporal_container_src_files_path }}" version: "{{ matrix_corporal_docker_image.split(':')[1] }}" @@ -53,7 +53,7 @@ until: result is not failed - name: Ensure Matrix Corporal config installed - copy: + ansible.builtin.copy: content: "{{ matrix_corporal_configuration|to_nice_json }}" dest: "{{ matrix_corporal_config_dir_path }}/config.json" mode: 0644 @@ -62,7 +62,7 @@ when: matrix_corporal_enabled|bool - name: Ensure matrix-corporal.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-corporal.service.j2" dest: "{{ matrix_systemd_path }}/matrix-corporal.service" mode: 0644 @@ -70,7 +70,7 @@ when: matrix_corporal_enabled|bool - name: Ensure systemd reloaded after matrix-corporal.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_corporal_enabled|bool and matrix_corporal_systemd_service_result.changed" @@ -86,7 +86,7 @@ when: "not matrix_corporal_enabled|bool" - name: Ensure matrix-corporal is stopped - service: + ansible.builtin.service: name: matrix-corporal state: stopped enabled: false @@ -95,18 +95,18 @@ when: "not matrix_corporal_enabled|bool and matrix_corporal_service_stat.stat.exists" - name: Ensure matrix-corporal.service doesn't exist - file: + 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" - name: Ensure systemd reloaded after matrix-corporal.service removal - service: + ansible.builtin.service: daemon_reload: true when: "not matrix_corporal_enabled|bool and matrix_corporal_service_stat.stat.exists" - name: Ensure matrix-corporal files don't exist - file: + ansible.builtin.file: path: "{{ item }}" state: absent with_items: diff --git a/roles/matrix-corporal/tasks/validate_config.yml b/roles/matrix-corporal/tasks/validate_config.yml index a8930e7e..50848810 100644 --- a/roles/matrix-corporal/tasks/validate_config.yml +++ b/roles/matrix-corporal/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required matrix-corporal settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`) for using matrix-corporal. when: "vars[item] == ''" @@ -12,12 +12,12 @@ - "matrix_corporal_policy_provider_config" - name: Fail if HTTP API enabled, but no token set - fail: + 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 == ''" - name: (Deprecation) Catch and report renamed corporal variables - fail: + ansible.builtin.fail: msg: >- Your configuration contains a variable, which now has a different name. Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`). diff --git a/roles/matrix-coturn/tasks/init.yml b/roles/matrix-coturn/tasks/init.yml index 93e4fa3a..726e3065 100644 --- a/roles/matrix-coturn/tasks/init.yml +++ b/roles/matrix-coturn/tasks/init.yml @@ -2,14 +2,14 @@ # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 - name: Fail if trying to self-build on Ansible < 2.8 - fail: + 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_coturn_container_image_self_build and matrix_coturn_enabled" -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-coturn.service'] }}" when: matrix_coturn_enabled|bool -- set_fact: +- 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" diff --git a/roles/matrix-coturn/tasks/setup_install.yml b/roles/matrix-coturn/tasks/setup_install.yml index a721f186..d24e4313 100644 --- a/roles/matrix-coturn/tasks/setup_install.yml +++ b/roles/matrix-coturn/tasks/setup_install.yml @@ -2,12 +2,12 @@ # This is a cleanup/migration task. It can be removed some time in the future. - name: (Migration) Remove deprecated cronjob - file: + ansible.builtin.file: path: "{{ matrix_cron_path }}/matrix-coturn-ssl-reload" state: absent - name: Ensure Matrix Coturn path exists - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -31,7 +31,7 @@ - block: - name: Ensure Coturn repository is present on self-build - git: + ansible.builtin.git: repo: "{{ matrix_coturn_container_image_self_build_repo }}" dest: "{{ matrix_coturn_docker_src_files_path }}" version: "{{ matrix_coturn_container_image_self_build_repo_version }}" @@ -53,7 +53,7 @@ when: "matrix_coturn_container_image_self_build|bool" - name: Ensure Coturn configuration path exists - file: + ansible.builtin.file: path: "{{ matrix_coturn_base_path }}" state: directory mode: 0750 @@ -61,7 +61,7 @@ group: "{{ matrix_user_groupname }}" - name: Ensure turnserver.conf installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/turnserver.conf.j2" dest: "{{ matrix_coturn_config_path }}" mode: 0644 @@ -74,7 +74,7 @@ driver: bridge - name: Ensure matrix-coturn.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-coturn.service.j2" dest: "{{ matrix_systemd_path }}/matrix-coturn.service" mode: 0644 @@ -84,7 +84,7 @@ # We optimize for the common use-case though (short-lived Let's Encrypt certificates). # Reloading doesn't hurt anyway, so there's no need to make this more flexible. - name: Ensure reloading systemd units installed, if necessary - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/{{ item }}.j2" dest: "{{ matrix_systemd_path }}/{{ item }}" mode: 0644 @@ -96,7 +96,7 @@ # A similar task exists in `setup_uninstall.yml` - name: Ensure reloading systemd units uninstalled, if unnecessary - file: + ansible.builtin.file: path: "{{ item }}" state: absent register: "matrix_coturn_systemd_service_change_results" @@ -106,6 +106,6 @@ - matrix-coturn-reload.timer - name: Ensure systemd reloaded if systemd units changed - service: + ansible.builtin.service: daemon_reload: true when: "matrix_coturn_systemd_service_change_results.changed" diff --git a/roles/matrix-coturn/tasks/setup_uninstall.yml b/roles/matrix-coturn/tasks/setup_uninstall.yml index 097ba873..b3d77e40 100644 --- a/roles/matrix-coturn/tasks/setup_uninstall.yml +++ b/roles/matrix-coturn/tasks/setup_uninstall.yml @@ -7,7 +7,7 @@ when: "not matrix_coturn_enabled|bool" - name: Ensure matrix-coturn is stopped - service: + ansible.builtin.service: name: matrix-coturn state: stopped enabled: false @@ -15,7 +15,7 @@ when: "matrix_coturn_service_stat.stat.exists|bool" - name: Ensure matrix-coturn-reload.timer is stopped - service: + ansible.builtin.service: name: matrix-coturn state: stopped enabled: false @@ -24,7 +24,7 @@ when: "matrix_coturn_service_stat.stat.exists|bool" - name: Ensure systemd units don't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/{{ item }}" state: absent register: matrix_coturn_systemd_unit_uninstallation_result @@ -34,12 +34,12 @@ - matrix-coturn-reload.timer - name: Ensure systemd reloaded after unit removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_coturn_systemd_unit_uninstallation_result.changed|bool" - name: Ensure Matrix coturn paths don't exist - file: + ansible.builtin.file: path: "{{ matrix_coturn_base_path }}" state: absent diff --git a/roles/matrix-coturn/tasks/validate_config.yml b/roles/matrix-coturn/tasks/validate_config.yml index 637f720d..90e842e1 100644 --- a/roles/matrix-coturn/tasks/validate_config.yml +++ b/roles/matrix-coturn/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required Coturn settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`) for using Coturn. when: "vars[item] == ''" diff --git a/roles/matrix-dendrite/tasks/dendrite/setup_install.yml b/roles/matrix-dendrite/tasks/dendrite/setup_install.yml index a18ad065..47cf5513 100644 --- a/roles/matrix-dendrite/tasks/dendrite/setup_install.yml +++ b/roles/matrix-dendrite/tasks/dendrite/setup_install.yml @@ -9,7 +9,7 @@ # This is separate and conditional, to ensure we don't execute it # if the path already exists or we failed to check, because it's mounted using fuse. - name: Ensure Dendrite media store path exists - file: + ansible.builtin.file: path: "{{ matrix_dendrite_media_store_path }}" state: directory mode: 0750 @@ -37,7 +37,7 @@ # We don't use the `docker_container` module, because using it with `cap_drop` requires # a very recent version, which is not available for a lot of people yet. - name: Generate Dendrite signing key - command: | + ansible.builtin.command: | docker run --rm --name=matrix-dendrite-config @@ -48,14 +48,14 @@ when: "not matrix_dendrite_signing_key_stat.stat.exists" - name: Ensure Dendrite server key exists - file: + ansible.builtin.file: path: "{{ matrix_dendrite_config_dir_path }}/{{ matrix_server_fqn_matrix }}.signing.pem" mode: 0644 owner: "{{ matrix_user_username }}" group: "{{ matrix_user_groupname }}" - name: Ensure Dendrite configuration installed - copy: + ansible.builtin.copy: content: "{{ matrix_dendrite_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_dendrite_config_dir_path }}/dendrite.yaml" mode: 0644 @@ -63,19 +63,19 @@ group: "{{ matrix_user_groupname }}" - name: Ensure matrix-dendrite.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/dendrite/systemd/matrix-dendrite.service.j2" dest: "{{ matrix_systemd_path }}/matrix-dendrite.service" mode: 0644 register: matrix_dendrite_systemd_service_result - name: Ensure systemd reloaded after matrix-dendrite.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_dendrite_systemd_service_result.changed|bool" - name: Ensure matrix-dendrite-create-account script created - template: + ansible.builtin.template: src: "{{ role_path }}/templates/dendrite/usr-local-bin/matrix-dendrite-create-account.j2" dest: "{{ matrix_local_bin_path }}/matrix-dendrite-create-account" mode: 0750 diff --git a/roles/matrix-dendrite/tasks/dendrite/setup_uninstall.yml b/roles/matrix-dendrite/tasks/dendrite/setup_uninstall.yml index 89d5481c..88122256 100644 --- a/roles/matrix-dendrite/tasks/dendrite/setup_uninstall.yml +++ b/roles/matrix-dendrite/tasks/dendrite/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_dendrite_service_stat - name: Ensure matrix-dendrite is stopped - service: + ansible.builtin.service: name: matrix-dendrite state: stopped daemon_reload: true @@ -14,13 +14,13 @@ when: "matrix_dendrite_service_stat.stat.exists" - name: Ensure matrix-dendrite.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-dendrite.service" state: absent when: "matrix_dendrite_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-dendrite.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_dendrite_service_stat.stat.exists" diff --git a/roles/matrix-dendrite/tasks/init.yml b/roles/matrix-dendrite/tasks/init.yml index 524ef6ee..20e34ef5 100644 --- a/roles/matrix-dendrite/tasks/init.yml +++ b/roles/matrix-dendrite/tasks/init.yml @@ -1,5 +1,5 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-dendrite.service'] }}" when: matrix_dendrite_enabled|bool diff --git a/roles/matrix-dendrite/tasks/main.yml b/roles/matrix-dendrite/tasks/main.yml index 5483adec..a08f45bd 100644 --- a/roles/matrix-dendrite/tasks/main.yml +++ b/roles/matrix-dendrite/tasks/main.yml @@ -36,7 +36,7 @@ - self-check - name: Mark matrix-dendrite role as executed - set_fact: + ansible.builtin.set_fact: matrix_dendrite_role_executed: true tags: - always diff --git a/roles/matrix-dendrite/tasks/register_user.yml b/roles/matrix-dendrite/tasks/register_user.yml index b8e3ae5e..e18af138 100644 --- a/roles/matrix-dendrite/tasks/register_user.yml +++ b/roles/matrix-dendrite/tasks/register_user.yml @@ -1,16 +1,16 @@ --- - name: Fail if playbook called incorrectly - fail: + ansible.builtin.fail: msg: "The `username` variable needs to be provided to this playbook, via --extra-vars" when: "username is not defined or username == ''" - name: Fail if playbook called incorrectly - fail: + ansible.builtin.fail: msg: "The `password` variable needs to be provided to this playbook, via --extra-vars" when: "password is not defined or password == ''" - name: Ensure matrix-dendrite is started - service: + ansible.builtin.service: name: matrix-dendrite state: started daemon_reload: true @@ -22,4 +22,4 @@ when: "start_result.changed" - name: Register user - command: "{{ matrix_local_bin_path }}/matrix-dendrite-create-account {{ username|quote }} {{ password|quote }}" + ansible.builtin.command: "{{ matrix_local_bin_path }}/matrix-dendrite-create-account {{ username|quote }} {{ password|quote }}" diff --git a/roles/matrix-dendrite/tasks/self_check_client_api.yml b/roles/matrix-dendrite/tasks/self_check_client_api.yml index 2470d818..99b6cb40 100644 --- a/roles/matrix-dendrite/tasks/self_check_client_api.yml +++ b/roles/matrix-dendrite/tasks/self_check_client_api.yml @@ -1,6 +1,6 @@ --- - name: Check Matrix Client API - uri: + ansible.builtin.uri: url: "{{ matrix_dendrite_client_api_url_endpoint_public }}" follow_redirects: none validate_certs: "{{ matrix_dendrite_self_check_validate_certificates }}" @@ -9,10 +9,10 @@ check_mode: false - name: Fail if Matrix Client API not working - fail: + ansible.builtin.fail: msg: "Failed checking Matrix Client API is up at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_dendrite_client_api_url_endpoint_public }}`). Is Dendrite running? Is port 443 open in your firewall? Full error: {{ result_matrix_dendrite_client_api }}" when: "(result_matrix_dendrite_client_api.failed or 'json' not in result_matrix_dendrite_client_api)" - name: Report working Matrix Client API - debug: + ansible.builtin.debug: msg: "The Matrix Client API at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_dendrite_client_api_url_endpoint_public }}`) is working" diff --git a/roles/matrix-dendrite/tasks/self_check_federation_api.yml b/roles/matrix-dendrite/tasks/self_check_federation_api.yml index 0afca2cb..0d817afe 100644 --- a/roles/matrix-dendrite/tasks/self_check_federation_api.yml +++ b/roles/matrix-dendrite/tasks/self_check_federation_api.yml @@ -1,6 +1,6 @@ --- - name: Check Matrix Federation API - uri: + ansible.builtin.uri: url: "{{ matrix_dendrite_federation_api_url_endpoint_public }}" follow_redirects: none validate_certs: "{{ matrix_dendrite_self_check_validate_certificates }}" @@ -9,16 +9,16 @@ check_mode: false - name: Fail if Matrix Federation API not working - fail: + 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)" - name: Fail if Matrix Federation API unexpectedly enabled - fail: + 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" - name: Report working Matrix Federation API - debug: + 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" diff --git a/roles/matrix-dendrite/tasks/setup_dendrite.yml b/roles/matrix-dendrite/tasks/setup_dendrite.yml index fc306759..792e9c4f 100644 --- a/roles/matrix-dendrite/tasks/setup_dendrite.yml +++ b/roles/matrix-dendrite/tasks/setup_dendrite.yml @@ -1,6 +1,6 @@ --- - name: Ensure Dendrite paths exist - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 diff --git a/roles/matrix-dendrite/tasks/validate_config.yml b/roles/matrix-dendrite/tasks/validate_config.yml index 2d2cf4c5..390da938 100644 --- a/roles/matrix-dendrite/tasks/validate_config.yml +++ b/roles/matrix-dendrite/tasks/validate_config.yml @@ -1,6 +1,6 @@ --- - name: Fail if required Dendrite settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`) for using Dendrite. when: "vars[item] == ''" @@ -8,7 +8,7 @@ - "matrix_dendrite_registration_shared_secret" - name: (Deprecation) Catch and report renamed settings - fail: + ansible.builtin.fail: msg: >- Your configuration contains a variable, which now has a different name. Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`). diff --git a/roles/matrix-dimension/tasks/init.yml b/roles/matrix-dimension/tasks/init.yml index 6336cb4d..4ee1bb0e 100644 --- a/roles/matrix-dimension/tasks/init.yml +++ b/roles/matrix-dimension/tasks/init.yml @@ -1,4 +1,4 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-dimension.service'] }}" when: matrix_dimension_enabled|bool diff --git a/roles/matrix-dimension/tasks/setup_install.yml b/roles/matrix-dimension/tasks/setup_install.yml index b999383e..01bab7cf 100644 --- a/roles/matrix-dimension/tasks/setup_install.yml +++ b/roles/matrix-dimension/tasks/setup_install.yml @@ -1,6 +1,6 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_dimension_requires_restart: false - block: @@ -12,10 +12,10 @@ - block: # pgloader makes a few columns `smallint`, instead of `boolean`. # We need to fix them up. - - set_fact: + - ansible.builtin.set_fact: matrix_dimension_pgloader_additional_psql_statements_list: [] - - set_fact: + - ansible.builtin.set_fact: matrix_dimension_pgloader_additional_psql_statements_list: | {{ matrix_dimension_pgloader_additional_psql_statements_list @@ -49,7 +49,7 @@ - {'table': 'dimension_bridges', 'column': 'isEnabled', 'default': ''} - {'table': 'dimension_bridges', 'column': 'isPublic', 'default': ''} - - set_fact: + - ansible.builtin.set_fact: matrix_postgres_db_migration_request: src: "{{ matrix_dimension_sqlite_database_path_local }}" dst: "{{ matrix_dimension_database_connection_string }}" @@ -63,13 +63,13 @@ - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" - - set_fact: + - ansible.builtin.set_fact: matrix_dimension_requires_restart: true when: "matrix_dimension_sqlite_database_path_local_stat_result.stat.exists|bool" when: "matrix_dimension_database_engine == 'postgres'" - name: Ensure Dimension base path exists - file: + ansible.builtin.file: path: "{{ matrix_dimension_base_path }}" state: directory mode: 0770 @@ -77,7 +77,7 @@ group: "{{ matrix_dimension_user_gid }}" - name: Ensure Dimension config installed - copy: + ansible.builtin.copy: content: "{{ matrix_dimension_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_dimension_base_path }}/config.yaml" mode: 0640 @@ -97,7 +97,7 @@ until: matrix_dimension_pull_results is not failed - name: Ensure dimension repository is present on self-build - git: + ansible.builtin.git: repo: "{{ matrix_dimension_container_image_self_build_repo }}" dest: "{{ matrix_dimension_docker_src_files_path }}" version: "{{ matrix_dimension_container_image_self_build_branch }}" @@ -120,19 +120,19 @@ when: "matrix_dimension_container_image_self_build|bool" - name: Ensure matrix-dimension.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-dimension.service.j2" dest: "{{ matrix_systemd_path }}/matrix-dimension.service" mode: 0644 register: matrix_dimension_systemd_service_result - name: Ensure systemd reloaded after matrix-dimension.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_dimension_systemd_service_result.changed|bool" - name: Ensure matrix-dimension.service restarted, if necessary - service: + ansible.builtin.service: name: "matrix-dimension.service" state: restarted 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 cdfbe07a..5a181893 100644 --- a/roles/matrix-dimension/tasks/setup_uninstall.yml +++ b/roles/matrix-dimension/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_dimension_service_stat - name: Ensure matrix-dimension is stopped - service: + ansible.builtin.service: name: matrix-dimension state: stopped enabled: false @@ -15,18 +15,18 @@ when: "matrix_dimension_service_stat.stat.exists|bool" - name: Ensure matrix-dimension.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-dimension.service" state: absent when: "matrix_dimension_service_stat.stat.exists|bool" - name: Ensure systemd reloaded after matrix-dimension.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_dimension_service_stat.stat.exists|bool" - name: Ensure Dimension base directory doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_dimension_base_path }}" state: absent diff --git a/roles/matrix-dimension/tasks/validate_config.yml b/roles/matrix-dimension/tasks/validate_config.yml index 8413c42f..5af0ba6d 100644 --- a/roles/matrix-dimension/tasks/validate_config.yml +++ b/roles/matrix-dimension/tasks/validate_config.yml @@ -1,6 +1,6 @@ --- - name: Fail if required Dimension settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`) for using Dimension. with_items: @@ -8,7 +8,7 @@ when: "matrix_dimension_enabled and vars[item] == ''" - name: (Deprecation) Catch and report renamed Dimension variables - fail: + ansible.builtin.fail: msg: >- Your configuration contains a variable, which now has a different name. Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`). diff --git a/roles/matrix-dynamic-dns/tasks/init.yml b/roles/matrix-dynamic-dns/tasks/init.yml index 6ea6a60b..2604270e 100644 --- a/roles/matrix-dynamic-dns/tasks/init.yml +++ b/roles/matrix-dynamic-dns/tasks/init.yml @@ -2,10 +2,10 @@ # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 - name: Fail if trying to self-build on Ansible < 2.8 - fail: + 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_dynamic_dns_container_image_self_build and matrix_dynamic_dns_enabled" -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-dynamic-dns.service'] }}" 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 60f07937..664f1854 100644 --- a/roles/matrix-dynamic-dns/tasks/install.yml +++ b/roles/matrix-dynamic-dns/tasks/install.yml @@ -13,7 +13,7 @@ until: result is not failed - name: Ensure Dynamic DNS paths exist - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0751 @@ -26,7 +26,7 @@ when: matrix_dynamic_dns_enabled|bool and item.when|bool - name: Ensure Dynamic DNS repository is present on self build - git: + ansible.builtin.git: repo: "{{ matrix_dynamic_dns_container_image_self_build_repo }}" dest: "{{ matrix_dynamic_dns_docker_src_files_path }}" force: "yes" @@ -48,7 +48,7 @@ when: "matrix_dynamic_dns_enabled|bool and matrix_dynamic_dns_container_image_self_build|bool" - name: Ensure Dynamic DNS ddclient.conf installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/ddclient.conf.j2" dest: "{{ matrix_dynamic_dns_config_path }}/ddclient.conf" mode: 0644 @@ -56,13 +56,13 @@ group: "{{ matrix_user_groupname }}" - name: Ensure matrix-dynamic-dns.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-dynamic-dns.service.j2" dest: "/etc/systemd/system/matrix-dynamic-dns.service" mode: 0644 register: matrix_dynamic_dns_systemd_service_result - name: Ensure systemd reloaded after matrix-dynamic-dns.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_dynamic_dns_systemd_service_result.changed" diff --git a/roles/matrix-dynamic-dns/tasks/uninstall.yml b/roles/matrix-dynamic-dns/tasks/uninstall.yml index 80842c9c..1583344d 100644 --- a/roles/matrix-dynamic-dns/tasks/uninstall.yml +++ b/roles/matrix-dynamic-dns/tasks/uninstall.yml @@ -6,7 +6,7 @@ register: matrix_dynamic_dns_service_stat - name: Ensure matrix-dynamic-dns is stopped - service: + ansible.builtin.service: name: matrix-dynamic-dns state: stopped enabled: false @@ -14,13 +14,13 @@ when: "matrix_dynamic_dns_service_stat.stat.exists" - name: Ensure matrix-dynamic-dns.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-dynamic-dns.service" state: absent when: "matrix_dynamic_dns_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-dynamic-dns.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_dynamic_dns_service_stat.stat.exists" diff --git a/roles/matrix-dynamic-dns/tasks/validate_config.yml b/roles/matrix-dynamic-dns/tasks/validate_config.yml index 8f0001ea..610dc2f8 100644 --- a/roles/matrix-dynamic-dns/tasks/validate_config.yml +++ b/roles/matrix-dynamic-dns/tasks/validate_config.yml @@ -1,13 +1,13 @@ --- - name: Fail if no configurations specified - fail: + ansible.builtin.fail: msg: >- You need to define at least one configuration in `matrix_dynamic_dns_domain_configurations` for using matrix-dynamic-dns. when: "matrix_dynamic_dns_domain_configurations|length == 0" - name: Fail if required settings not defined in configuration blocks - fail: + ansible.builtin.fail: msg: >- One of the configurations in matrix_dynamic_dns_domain_configurations is missing a required key (domain, provider, protocol). when: "'domain' not in configuration or 'provider' not in configuration or 'protocol' not in configuration" diff --git a/roles/matrix-email2matrix/tasks/init.yml b/roles/matrix-email2matrix/tasks/init.yml index 5f582212..5e81b40a 100644 --- a/roles/matrix-email2matrix/tasks/init.yml +++ b/roles/matrix-email2matrix/tasks/init.yml @@ -1,5 +1,5 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-email2matrix.service'] }}" when: matrix_email2matrix_enabled|bool diff --git a/roles/matrix-email2matrix/tasks/setup_install.yml b/roles/matrix-email2matrix/tasks/setup_install.yml index a2470728..3828e36e 100644 --- a/roles/matrix-email2matrix/tasks/setup_install.yml +++ b/roles/matrix-email2matrix/tasks/setup_install.yml @@ -1,7 +1,7 @@ --- - name: Ensure Email2Matrix paths exist - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -14,7 +14,7 @@ when: "item.when|bool" - name: Ensure Email2Matrix configuration file created - template: + ansible.builtin.template: src: "{{ role_path }}/templates/config.json.j2" dest: "{{ matrix_email2matrix_config_dir_path }}/config.json" owner: "{{ matrix_user_username }}" @@ -34,7 +34,7 @@ until: result is not failed - name: Ensure Email2Matrix repository is present on self-build - git: + ansible.builtin.git: repo: "{{ matrix_email2matrix_container_image_self_build_repo }}" dest: "{{ matrix_email2matrix_docker_src_files_path }}" version: "{{ matrix_email2matrix_container_image_self_build_branch }}" @@ -57,13 +57,13 @@ when: "matrix_email2matrix_container_image_self_build|bool" - name: Ensure matrix-email2matrix.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-email2matrix.service.j2" dest: "{{ matrix_systemd_path }}/matrix-email2matrix.service" mode: 0644 register: matrix_email2matrix_systemd_service_result - name: Ensure systemd reloaded after matrix-email2matrix.service installation - service: + ansible.builtin.service: daemon_reload: true 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 27d35f2d..4b76adcc 100644 --- a/roles/matrix-email2matrix/tasks/setup_uninstall.yml +++ b/roles/matrix-email2matrix/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_email2matrix_service_stat - name: Ensure matrix-email2matrix is stopped - service: + ansible.builtin.service: name: matrix-email2matrix state: stopped enabled: false @@ -15,18 +15,18 @@ when: "matrix_email2matrix_service_stat.stat.exists|bool" - name: Ensure matrix-email2matrix.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-email2matrix.service" state: absent when: "matrix_email2matrix_service_stat.stat.exists|bool" - name: Ensure systemd reloaded after matrix-email2matrix.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_email2matrix_service_stat.stat.exists|bool" - name: Ensure Email2Matrix data path doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_email2matrix_base_path }}" state: absent diff --git a/roles/matrix-email2matrix/tasks/validate_config.yml b/roles/matrix-email2matrix/tasks/validate_config.yml index d8beecf4..59a3581e 100644 --- a/roles/matrix-email2matrix/tasks/validate_config.yml +++ b/roles/matrix-email2matrix/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if no mappings - fail: + ansible.builtin.fail: msg: > You need to define at least one mapping in `matrix_email2matrix_matrix_mappings` for enabling Email2Matrix. when: "matrix_email2matrix_matrix_mappings|length == 0" diff --git a/roles/matrix-etherpad/tasks/init.yml b/roles/matrix-etherpad/tasks/init.yml index 392addd0..a3cda068 100644 --- a/roles/matrix-etherpad/tasks/init.yml +++ b/roles/matrix-etherpad/tasks/init.yml @@ -1,12 +1,12 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-etherpad.service'] }}" when: matrix_etherpad_enabled|bool - block: - name: Fail if matrix-nginx-proxy role already executed - fail: + ansible.builtin.fail: msg: >- Trying to append Etherpad's reverse-proxying configuration to matrix-nginx-proxy, but it's pointless since the matrix-nginx-proxy role had already executed. @@ -15,7 +15,7 @@ when: matrix_nginx_proxy_role_executed|default(False)|bool - name: Generate Etherpad proxying configuration for matrix-nginx-proxy - set_fact: + ansible.builtin.set_fact: matrix_etherpad_matrix_nginx_proxy_configuration: | rewrite ^{{ matrix_etherpad_public_endpoint }}$ {{ matrix_nginx_proxy_x_forwarded_proto_value }}://$server_name{{ matrix_etherpad_public_endpoint }}/ permanent; @@ -42,7 +42,7 @@ } - name: Register Etherpad proxying configuration with matrix-nginx-proxy - set_fact: + ansible.builtin.set_fact: matrix_nginx_proxy_proxy_dimension_additional_server_configuration_blocks: | {{ matrix_nginx_proxy_proxy_dimension_additional_server_configuration_blocks|default([]) @@ -54,7 +54,7 @@ when: matrix_etherpad_enabled|bool - name: Warn about reverse-proxying if matrix-nginx-proxy not used - debug: + ansible.builtin.debug: msg: >- NOTE: You've enabled the Etherpad tool but are not using the matrix-nginx-proxy reverse proxy. diff --git a/roles/matrix-etherpad/tasks/setup_install.yml b/roles/matrix-etherpad/tasks/setup_install.yml index 6f276e05..d11545a5 100644 --- a/roles/matrix-etherpad/tasks/setup_install.yml +++ b/roles/matrix-etherpad/tasks/setup_install.yml @@ -1,7 +1,7 @@ --- - name: Ensure Etherpad base path exists - file: + ansible.builtin.file: path: "{{ matrix_etherpad_base_path }}" state: directory mode: 0770 @@ -9,7 +9,7 @@ group: "{{ matrix_etherpad_user_gid }}" - name: Ensure Etherpad config installed - copy: + ansible.builtin.copy: content: "{{ matrix_etherpad_configuration|to_nice_json }}" dest: "{{ matrix_etherpad_base_path }}/settings.json" mode: 0640 @@ -28,13 +28,13 @@ until: result is not failed - name: Ensure matrix-etherpad.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-etherpad.service.j2" dest: "{{ matrix_systemd_path }}/matrix-etherpad.service" mode: 0644 register: matrix_etherpad_systemd_service_result - name: Ensure systemd reloaded after matrix-etherpad.service installation - service: + ansible.builtin.service: daemon_reload: true 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 ae1f2604..b72b70bc 100644 --- a/roles/matrix-etherpad/tasks/setup_uninstall.yml +++ b/roles/matrix-etherpad/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_etherpad_service_stat - name: Ensure matrix-etherpad is stopped - service: + ansible.builtin.service: name: matrix-etherpad state: stopped enabled: false @@ -15,18 +15,18 @@ when: "matrix_etherpad_service_stat.stat.exists|bool" - name: Ensure matrix-etherpad.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-etherpad.service" state: absent when: "matrix_etherpad_service_stat.stat.exists|bool" - name: Ensure systemd reloaded after matrix-etherpad.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_etherpad_service_stat.stat.exists|bool" - name: Ensure Etherpad base directory doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_etherpad_base_path }}" state: absent diff --git a/roles/matrix-etherpad/tasks/validate_config.yml b/roles/matrix-etherpad/tasks/validate_config.yml index f9438e7b..07194d65 100644 --- a/roles/matrix-etherpad/tasks/validate_config.yml +++ b/roles/matrix-etherpad/tasks/validate_config.yml @@ -1,13 +1,13 @@ --- - name: Fail if Etherpad is enabled without the Dimension integrations manager - fail: + 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" - name: Fail if no database is configured for Etherpad - fail: + ansible.builtin.fail: msg: >- Etherpad requires a dedicated Postgres database. Please enable the built in one, or configure an external DB by redefining "matrix_etherpad_database_hostname" when: matrix_etherpad_database_hostname == "matrix-postgres" and not matrix_postgres_enabled diff --git a/roles/matrix-grafana/tasks/init.yml b/roles/matrix-grafana/tasks/init.yml index 4c2cbf06..e01743b7 100644 --- a/roles/matrix-grafana/tasks/init.yml +++ b/roles/matrix-grafana/tasks/init.yml @@ -1,5 +1,5 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-grafana.service'] }}" when: matrix_grafana_enabled|bool diff --git a/roles/matrix-grafana/tasks/setup.yml b/roles/matrix-grafana/tasks/setup.yml index 16b9fa65..da25db59 100644 --- a/roles/matrix-grafana/tasks/setup.yml +++ b/roles/matrix-grafana/tasks/setup.yml @@ -17,7 +17,7 @@ until: result is not failed - name: Ensure grafana paths exists - file: + ansible.builtin.file: path: "{{ item }}" state: directory mode: 0750 @@ -34,7 +34,7 @@ when: matrix_grafana_enabled|bool - name: Ensure grafana.ini present - template: + ansible.builtin.template: src: "{{ role_path }}/templates/grafana.ini.j2" dest: "{{ matrix_grafana_config_path }}/grafana.ini" mode: 0440 @@ -43,7 +43,7 @@ when: matrix_grafana_enabled|bool - name: Ensure provisioning/datasources/default.yaml present - template: + ansible.builtin.template: src: "{{ role_path }}/templates/datasources.yaml.j2" dest: "{{ matrix_grafana_config_path }}/provisioning/datasources/default.yaml" mode: 0440 @@ -52,7 +52,7 @@ when: matrix_grafana_enabled|bool - name: Ensure provisioning/dashboards/default.yaml present - template: + ansible.builtin.template: src: "{{ role_path }}/templates/dashboards.yaml.j2" dest: "{{ matrix_grafana_config_path }}/provisioning/dashboards/default.yaml" mode: 0440 @@ -61,7 +61,7 @@ when: matrix_grafana_enabled|bool - name: Ensure dashboard(s) downloaded - get_url: + ansible.builtin.get_url: url: "{{ item }}" dest: "{{ matrix_grafana_config_path }}/dashboards/" force: true @@ -76,7 +76,7 @@ until: result is not failed - name: Ensure matrix-grafana.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-grafana.service.j2" dest: "{{ matrix_systemd_path }}/matrix-grafana.service" mode: 0644 @@ -84,7 +84,7 @@ when: matrix_grafana_enabled|bool - name: Ensure systemd reloaded after matrix-grafana.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_grafana_enabled|bool and matrix_grafana_systemd_service_result.changed" @@ -98,7 +98,7 @@ register: matrix_grafana_service_stat - name: Ensure matrix-grafana is stopped - service: + ansible.builtin.service: name: matrix-grafana state: stopped enabled: false @@ -107,12 +107,12 @@ when: "not matrix_grafana_enabled|bool and matrix_grafana_service_stat.stat.exists" - name: Ensure matrix-grafana.service doesn't exist - file: + 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" - name: Ensure systemd reloaded after matrix-grafana.service removal - service: + ansible.builtin.service: daemon_reload: true when: "not matrix_grafana_enabled|bool and matrix_grafana_service_stat.stat.exists" diff --git a/roles/matrix-grafana/tasks/validate_config.yml b/roles/matrix-grafana/tasks/validate_config.yml index 63d4919a..cc48c559 100644 --- a/roles/matrix-grafana/tasks/validate_config.yml +++ b/roles/matrix-grafana/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if Prometheus not enabled - fail: + ansible.builtin.fail: msg: > You need to enable `matrix_prometheus_enabled` to use Prometheus as data source for Grafana. when: "not matrix_prometheus_enabled" diff --git a/roles/matrix-jitsi/tasks/init.yml b/roles/matrix-jitsi/tasks/init.yml index 58567d92..9a64ac63 100644 --- a/roles/matrix-jitsi/tasks/init.yml +++ b/roles/matrix-jitsi/tasks/init.yml @@ -1,10 +1,10 @@ --- -- set_fact: +- 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 - name: Fail if on an unsupported architecture - fail: + 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'] diff --git a/roles/matrix-jitsi/tasks/setup_jitsi_base.yml b/roles/matrix-jitsi/tasks/setup_jitsi_base.yml index 4b390c18..a945450e 100644 --- a/roles/matrix-jitsi/tasks/setup_jitsi_base.yml +++ b/roles/matrix-jitsi/tasks/setup_jitsi_base.yml @@ -7,7 +7,7 @@ # - name: Ensure Matrix jitsi base path exists - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 diff --git a/roles/matrix-jitsi/tasks/setup_jitsi_jicofo.yml b/roles/matrix-jitsi/tasks/setup_jitsi_jicofo.yml index 0cb7043f..98569a13 100644 --- a/roles/matrix-jitsi/tasks/setup_jitsi_jicofo.yml +++ b/roles/matrix-jitsi/tasks/setup_jitsi_jicofo.yml @@ -5,7 +5,7 @@ # - name: Ensure Matrix jitsi-jicofo path exists - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0777 @@ -29,7 +29,7 @@ until: result is not failed - name: Ensure jitsi-jicofo environment variables file created - template: + ansible.builtin.template: src: "{{ role_path }}/templates/jicofo/env.j2" dest: "{{ matrix_jitsi_jicofo_base_path }}/env" owner: "{{ matrix_user_username }}" @@ -38,7 +38,7 @@ when: matrix_jitsi_enabled|bool - name: Ensure jitsi-jicofo configuration files created - template: + ansible.builtin.template: src: "{{ role_path }}/templates/jicofo/{{ item }}.j2" dest: "{{ matrix_jitsi_jicofo_config_path }}/{{ item }}" owner: "{{ matrix_user_username }}" @@ -50,7 +50,7 @@ when: matrix_jitsi_enabled|bool - name: Ensure matrix-jitsi-jicofo.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/jicofo/matrix-jitsi-jicofo.service.j2" dest: "{{ matrix_systemd_path }}/matrix-jitsi-jicofo.service" mode: 0644 @@ -58,7 +58,7 @@ when: matrix_jitsi_enabled|bool - name: Ensure systemd reloaded after matrix-jitsi-jicofo.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_jitsi_enabled and matrix_jitsi_jicofo_systemd_service_result.changed" @@ -73,7 +73,7 @@ when: "not matrix_jitsi_enabled|bool" - name: Ensure matrix-jitsi-jicofo is stopped - service: + ansible.builtin.service: name: matrix-jitsi-jicofo state: stopped enabled: false @@ -82,18 +82,18 @@ when: "not matrix_jitsi_enabled|bool and matrix_jitsi_jicofo_service_stat.stat.exists" - name: Ensure matrix-jitsi-jicofo.service doesn't exist - file: + 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" - name: Ensure systemd reloaded after matrix-jitsi-jicofo.service removal - service: + ansible.builtin.service: daemon_reload: true when: "not matrix_jitsi_enabled|bool and matrix_jitsi_jicofo_service_stat.stat.exists" - name: Ensure Matrix jitsi-jicofo paths doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_jitsi_jicofo_base_path }}" state: absent when: "not matrix_jitsi_enabled|bool" diff --git a/roles/matrix-jitsi/tasks/setup_jitsi_jvb.yml b/roles/matrix-jitsi/tasks/setup_jitsi_jvb.yml index 90bf4a69..94425dc5 100644 --- a/roles/matrix-jitsi/tasks/setup_jitsi_jvb.yml +++ b/roles/matrix-jitsi/tasks/setup_jitsi_jvb.yml @@ -5,7 +5,7 @@ # - name: Ensure Matrix jitsi-jvb path exists - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0777 @@ -29,7 +29,7 @@ until: result is not failed - name: Ensure jitsi-jvb configuration files created - template: + ansible.builtin.template: src: "{{ role_path }}/templates/jvb/{{ item }}.j2" dest: "{{ matrix_jitsi_jvb_config_path }}/{{ item }}" owner: "{{ matrix_user_username }}" @@ -41,7 +41,7 @@ when: matrix_jitsi_enabled|bool - name: Ensure jitsi-jvb environment variables file created - template: + ansible.builtin.template: src: "{{ role_path }}/templates/jvb/env.j2" dest: "{{ matrix_jitsi_jvb_base_path }}/env" owner: "{{ matrix_user_username }}" @@ -50,7 +50,7 @@ when: matrix_jitsi_enabled|bool - name: Ensure matrix-jitsi-jvb.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/jvb/matrix-jitsi-jvb.service.j2" dest: "{{ matrix_systemd_path }}/matrix-jitsi-jvb.service" mode: 0644 @@ -58,7 +58,7 @@ when: matrix_jitsi_enabled|bool - name: Ensure systemd reloaded after matrix-jitsi-jvb.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_jitsi_enabled and matrix_jitsi_jvb_systemd_service_result.changed" @@ -73,7 +73,7 @@ when: "not matrix_jitsi_enabled|bool" - name: Ensure matrix-jitsi-jvb is stopped - service: + ansible.builtin.service: name: matrix-jitsi-jvb state: stopped enabled: false @@ -82,18 +82,18 @@ when: "not matrix_jitsi_enabled|bool and matrix_jitsi_jvb_service_stat.stat.exists" - name: Ensure matrix-jitsi-jvb.service doesn't exist - file: + 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" - name: Ensure systemd reloaded after matrix-jitsi-jvb.service removal - service: + ansible.builtin.service: daemon_reload: true when: "not matrix_jitsi_enabled|bool and matrix_jitsi_jvb_service_stat.stat.exists" - name: Ensure Matrix jitsi-jvb paths doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_jitsi_jvb_base_path }}" state: absent when: "not matrix_jitsi_enabled|bool" diff --git a/roles/matrix-jitsi/tasks/setup_jitsi_prosody.yml b/roles/matrix-jitsi/tasks/setup_jitsi_prosody.yml index 6db954b8..17122231 100644 --- a/roles/matrix-jitsi/tasks/setup_jitsi_prosody.yml +++ b/roles/matrix-jitsi/tasks/setup_jitsi_prosody.yml @@ -5,7 +5,7 @@ # - name: Ensure Matrix jitsi-prosody environment exists - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0777 @@ -30,7 +30,7 @@ until: result is not failed - name: Ensure jitsi-prosody environment variables file is created - template: + ansible.builtin.template: src: "{{ role_path }}/templates/prosody/env.j2" dest: "{{ matrix_jitsi_prosody_base_path }}/env" owner: "{{ matrix_user_username }}" @@ -39,7 +39,7 @@ when: matrix_jitsi_enabled|bool - name: Ensure matrix-jitsi-prosody.service file is installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/prosody/matrix-jitsi-prosody.service.j2" dest: "{{ matrix_systemd_path }}/matrix-jitsi-prosody.service" mode: 0644 @@ -47,13 +47,13 @@ when: matrix_jitsi_enabled|bool - name: Ensure systemd service is reloaded after matrix-jitsi-prosody.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_jitsi_enabled and matrix_jitsi_prosody_systemd_service_result.changed" - name: Ensure authentication is properly configured include_tasks: - file: "{{ role_path }}/tasks/util/setup_jitsi_auth.yml" + ansible.builtin.file: "{{ role_path }}/tasks/util/setup_jitsi_auth.yml" when: - matrix_jitsi_enabled|bool - matrix_jitsi_enable_auth|bool @@ -70,7 +70,7 @@ when: "not matrix_jitsi_enabled|bool" - name: Ensure matrix-jitsi-prosody is stopped - service: + ansible.builtin.service: name: matrix-jitsi-prosody state: stopped enabled: false @@ -79,18 +79,18 @@ when: "not matrix_jitsi_enabled|bool and matrix_jitsi_prosody_service_stat.stat.exists" - name: Ensure matrix-jitsi-prosody.service file doesn't exist - file: + 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" - name: Ensure systemd is reloaded after matrix-jitsi-prosody.service removal - service: + ansible.builtin.service: daemon_reload: true when: "not matrix_jitsi_enabled|bool and matrix_jitsi_prosody_service_stat.stat.exists" - name: Ensure Matrix jitsi-prosody paths doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_jitsi_prosody_base_path }}" state: absent when: "not matrix_jitsi_enabled|bool" diff --git a/roles/matrix-jitsi/tasks/setup_jitsi_web.yml b/roles/matrix-jitsi/tasks/setup_jitsi_web.yml index feda4ace..586f703a 100644 --- a/roles/matrix-jitsi/tasks/setup_jitsi_web.yml +++ b/roles/matrix-jitsi/tasks/setup_jitsi_web.yml @@ -5,7 +5,7 @@ # - name: Ensure Matrix jitsi-web path exists - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0777 @@ -31,7 +31,7 @@ until: result is not failed - name: Ensure jitsi-web environment variables file created - template: + ansible.builtin.template: src: "{{ role_path }}/templates/web/env.j2" dest: "{{ matrix_jitsi_web_base_path }}/env" owner: "{{ matrix_user_username }}" @@ -40,7 +40,7 @@ when: matrix_jitsi_enabled|bool - name: Ensure jitsi-web configuration files created - template: + ansible.builtin.template: src: "{{ role_path }}/templates/web/{{ item }}.j2" dest: "{{ matrix_jitsi_web_config_path }}/{{ item }}" owner: "{{ matrix_user_username }}" @@ -52,7 +52,7 @@ when: matrix_jitsi_enabled|bool - name: Ensure matrix-jitsi-web.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/web/matrix-jitsi-web.service.j2" dest: "{{ matrix_systemd_path }}/matrix-jitsi-web.service" mode: 0644 @@ -60,7 +60,7 @@ when: matrix_jitsi_enabled|bool - name: Ensure systemd reloaded after matrix-jitsi-web.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_jitsi_enabled and matrix_jitsi_web_systemd_service_result.changed" @@ -75,7 +75,7 @@ when: "not matrix_jitsi_enabled|bool" - name: Ensure matrix-jitsi-web is stopped - service: + ansible.builtin.service: name: matrix-jitsi-web state: stopped enabled: false @@ -84,18 +84,18 @@ when: "not matrix_jitsi_enabled|bool and matrix_jitsi_web_service_stat.stat.exists" - name: Ensure matrix-jitsi-web.service doesn't exist - file: + 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" - name: Ensure systemd reloaded after matrix-jitsi-web.service removal - service: + ansible.builtin.service: daemon_reload: true when: "not matrix_jitsi_enabled|bool and matrix_jitsi_web_service_stat.stat.exists" - name: Ensure Matrix jitsi-web paths doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_jitsi_web_base_path }}" state: absent when: "not matrix_jitsi_enabled|bool" diff --git a/roles/matrix-jitsi/tasks/util/setup_jitsi_auth.yml b/roles/matrix-jitsi/tasks/util/setup_jitsi_auth.yml index 50973acb..5176a7c0 100644 --- a/roles/matrix-jitsi/tasks/util/setup_jitsi_auth.yml +++ b/roles/matrix-jitsi/tasks/util/setup_jitsi_auth.yml @@ -4,7 +4,7 @@ # - name: Ensure matrix-jitsi-prosody container is running - systemd: + ansible.builtin.systemd: state: started name: matrix-jitsi-prosody register: matrix_jitsi_prosody_start_result @@ -15,7 +15,7 @@ # - name: Ensure Jitsi internal authentication users are configured - shell: "docker exec matrix-jitsi-prosody prosodyctl --config /config/prosody.cfg.lua register {{ item.username | quote }} meet.jitsi {{ item.password | quote }}" + ansible.builtin.shell: "docker exec matrix-jitsi-prosody prosodyctl --config /config/prosody.cfg.lua register {{ item.username | quote }} meet.jitsi {{ item.password | quote }}" with_items: "{{ matrix_jitsi_prosody_auth_internal_accounts }}" when: - matrix_jitsi_auth_type == "internal" @@ -33,7 +33,7 @@ # Stop Necessary Services # - name: Ensure matrix-jitsi-prosody container is stopped if necessary - systemd: + ansible.builtin.systemd: state: stopped name: matrix-jitsi-prosody 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 5131396d..5655ea45 100644 --- a/roles/matrix-jitsi/tasks/validate_config.yml +++ b/roles/matrix-jitsi/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required Jitsi settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`) to properly configure Jitsi. @@ -21,7 +21,7 @@ - name: Fail if a Jitsi internal authentication account is not defined - fail: + ansible.builtin.fail: msg: >- At least one Jitsi user needs to be defined in `matrix_jitsi_prosody_auth_internal_accounts` when using internal authentication. If you're setting up Jitsi for the first time, you may have missed a step. @@ -33,7 +33,7 @@ - name: (Deprecation) Catch and report renamed settings - fail: + ansible.builtin.fail: msg: >- Your configuration contains a variable, which now has a different name. Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`). diff --git a/roles/matrix-ma1sd/tasks/init.yml b/roles/matrix-ma1sd/tasks/init.yml index a7c914db..f3059bb4 100644 --- a/roles/matrix-ma1sd/tasks/init.yml +++ b/roles/matrix-ma1sd/tasks/init.yml @@ -2,10 +2,10 @@ # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 - name: Fail if trying to self-build on Ansible < 2.8 - fail: + 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" -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-ma1sd.service'] }}" when: matrix_ma1sd_enabled|bool diff --git a/roles/matrix-ma1sd/tasks/migrate_mxisd.yml b/roles/matrix-ma1sd/tasks/migrate_mxisd.yml index 720afa76..36ca8959 100644 --- a/roles/matrix-ma1sd/tasks/migrate_mxisd.yml +++ b/roles/matrix-ma1sd/tasks/migrate_mxisd.yml @@ -8,7 +8,7 @@ register: ma1sd_migrate_mxisd_data_dir_stat - name: Warn if mxisd data detected - debug: + ansible.builtin.debug: msg: > You seem to have an existing mxisd folder in `{{ matrix_base_data_path }}/mxisd`. We are going to migrate it to ma1sd and rename the folder to mxisd.migrated. @@ -20,7 +20,7 @@ register: matrix_mxisd_service_stat - name: Ensure matrix-mxisd is stopped - service: + ansible.builtin.service: name: matrix-mxisd state: stopped enabled: false @@ -34,7 +34,7 @@ when: "ma1sd_migrate_mxisd_data_dir_stat.stat.exists" - name: Ensure matrix-ma1sd is stopped - service: + ansible.builtin.service: name: matrix-ma1sd state: stopped daemon_reload: true @@ -44,7 +44,7 @@ # recursively copy remote directories (like `/matrix/mxisd/data/sign.key`) in older versions of Ansible. - block: - name: Copy mxisd data files to ma1sd folder - command: "cp -ar {{ matrix_base_data_path }}/mxisd/data {{ matrix_ma1sd_base_path }}" + ansible.builtin.command: "cp -ar {{ matrix_base_data_path }}/mxisd/data {{ matrix_ma1sd_base_path }}" - name: Check existence of mxisd.db file stat: @@ -52,20 +52,20 @@ register: matrix_ma1sd_mxisd_db_stat - name: Rename database (mxisd.db -> ma1sd.db) - command: "mv {{ matrix_ma1sd_data_path }}/mxisd.db {{ matrix_ma1sd_data_path }}/ma1sd.db" + ansible.builtin.command: "mv {{ matrix_ma1sd_data_path }}/mxisd.db {{ matrix_ma1sd_data_path }}/ma1sd.db" when: "matrix_ma1sd_mxisd_db_stat.stat.exists" - name: Rename mxisd folder - command: "mv {{ matrix_base_data_path }}/mxisd {{ matrix_base_data_path }}/mxisd.migrated" + ansible.builtin.command: "mv {{ matrix_base_data_path }}/mxisd {{ matrix_base_data_path }}/mxisd.migrated" when: "ma1sd_migrate_mxisd_data_dir_stat.stat.exists" - name: Ensure outdated matrix-mxisd.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-mxisd.service" state: absent when: "matrix_mxisd_service_stat.stat.exists" - name: Ensure systemd reloaded after removing outdated matrix-mxisd.service - service: + ansible.builtin.service: daemon_reload: true when: "matrix_mxisd_service_stat.stat.exists" diff --git a/roles/matrix-ma1sd/tasks/self_check_ma1sd.yml b/roles/matrix-ma1sd/tasks/self_check_ma1sd.yml index 4a4c7136..6fde9dd2 100644 --- a/roles/matrix-ma1sd/tasks/self_check_ma1sd.yml +++ b/roles/matrix-ma1sd/tasks/self_check_ma1sd.yml @@ -1,10 +1,10 @@ --- -- set_fact: +- ansible.builtin.set_fact: ma1sd_url_endpoint_public: "https://{{ matrix_server_fqn_matrix }}/_matrix/identity/api/v1" - name: Check ma1sd Identity Service - uri: + ansible.builtin.uri: url: "{{ ma1sd_url_endpoint_public }}" follow_redirects: none validate_certs: "{{ matrix_ma1sd_self_check_validate_certificates }}" @@ -13,10 +13,10 @@ ignore_errors: true - name: Fail if ma1sd Identity Service not working - fail: + ansible.builtin.fail: msg: "Failed checking ma1sd is up at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ ma1sd_url_endpoint_public }}`). Is ma1sd running? Is port 443 open in your firewall? Full error: {{ result_ma1sd }}" when: "result_ma1sd.failed or 'json' not in result_ma1sd" - name: Report working ma1sd Identity Service - debug: + ansible.builtin.debug: msg: "ma1sd at `{{ matrix_server_fqn_matrix }}` is working (checked endpoint: `{{ ma1sd_url_endpoint_public }}`)" diff --git a/roles/matrix-ma1sd/tasks/setup_install.yml b/roles/matrix-ma1sd/tasks/setup_install.yml index e3347a4d..2233067a 100644 --- a/roles/matrix-ma1sd/tasks/setup_install.yml +++ b/roles/matrix-ma1sd/tasks/setup_install.yml @@ -1,7 +1,7 @@ --- - name: Ensure ma1sd paths exist - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -18,7 +18,7 @@ # These (SQLite -> Postgres) migration tasks are usually at the top, # but we'd like to run them after `migrate_mxisd.yml`, which requires the ma1sd paths to exist. -- set_fact: +- ansible.builtin.set_fact: matrix_ma1sd_requires_restart: false - block: @@ -28,7 +28,7 @@ register: matrix_ma1sd_sqlite_database_path_local_stat_result - block: - - set_fact: + - ansible.builtin.set_fact: matrix_postgres_db_migration_request: src: "{{ matrix_ma1sd_sqlite_database_path_local }}" dst: "{{ matrix_ma1sd_database_connection_string }}" @@ -40,7 +40,7 @@ - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" - - set_fact: + - ansible.builtin.set_fact: matrix_ma1sd_requires_restart: true when: "matrix_ma1sd_sqlite_database_path_local_stat_result.stat.exists|bool" when: "matrix_ma1sd_database_engine == 'postgres'" @@ -59,7 +59,7 @@ - block: - name: Ensure gradle is installed for self-building (Debian) - apt: + ansible.builtin.apt: name: - gradle state: present @@ -67,7 +67,7 @@ when: (ansible_os_family == 'Debian') - name: Ensure gradle is installed for self-building (RedHat) - fail: + ansible.builtin.fail: msg: "Installing gradle on RedHat ({{ ansible_distribution }}) is currently not supported, so self-building ma1sd cannot happen at this time" when: ansible_os_family == 'RedHat' @@ -80,7 +80,7 @@ when: ansible_distribution == 'Archlinux' - name: Ensure ma1sd repository is present on self-build - git: + ansible.builtin.git: repo: "{{ matrix_ma1sd_container_image_self_build_repo }}" dest: "{{ matrix_ma1sd_docker_src_files_path }}" version: "{{ matrix_ma1sd_container_image_self_build_branch }}" @@ -90,7 +90,7 @@ register: matrix_ma1sd_git_pull_results - name: Ensure ma1sd Docker image is built - shell: "DOCKER_BUILDKIT=1 ./gradlew dockerBuild" + ansible.builtin.shell: "DOCKER_BUILDKIT=1 ./gradlew dockerBuild" args: chdir: "{{ matrix_ma1sd_docker_src_files_path }}" when: matrix_ma1sd_git_pull_results.changed @@ -110,7 +110,7 @@ when: "matrix_ma1sd_container_image_self_build|bool" - name: Ensure ma1sd config installed - copy: + ansible.builtin.copy: content: "{{ matrix_ma1sd_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_ma1sd_config_path }}/ma1sd.yaml" mode: 0644 @@ -118,7 +118,7 @@ group: "{{ matrix_user_groupname }}" - name: Ensure custom view templates are installed, if any - copy: + ansible.builtin.copy: content: "{{ item.value }}" dest: "{{ matrix_ma1sd_config_path }}/{{ item.location }}" mode: 0644 @@ -130,7 +130,7 @@ when: "matrix_ma1sd_view_session_custom_templates_enabled|bool and item.value" - name: Ensure custom email templates are installed, if any - copy: + ansible.builtin.copy: content: "{{ item.value }}" dest: "{{ matrix_ma1sd_config_path }}/{{ item.location }}" mode: 0644 @@ -145,7 +145,7 @@ # 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/) - file: + ansible.builtin.file: path: "{{ matrix_ma1sd_data_path }}/{{ item.location }}" state: absent with_items: @@ -156,19 +156,19 @@ when: "matrix_ma1sd_threepid_medium_email_custom_templates_enabled|bool and item.value" - name: Ensure matrix-ma1sd.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-ma1sd.service.j2" dest: "{{ matrix_systemd_path }}/matrix-ma1sd.service" mode: 0644 register: matrix_ma1sd_systemd_service_result - name: Ensure systemd reloaded after matrix-ma1sd.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_ma1sd_systemd_service_result.changed|bool" - name: Ensure matrix-ma1sd.service restarted, if necessary - service: + ansible.builtin.service: name: "matrix-ma1sd.service" state: restarted 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 30a1bfda..d50cd613 100644 --- a/roles/matrix-ma1sd/tasks/setup_uninstall.yml +++ b/roles/matrix-ma1sd/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_ma1sd_service_stat - name: Ensure matrix-ma1sd is stopped - service: + ansible.builtin.service: name: matrix-ma1sd state: stopped enabled: false @@ -15,18 +15,18 @@ when: "matrix_ma1sd_service_stat.stat.exists|bool" - name: Ensure matrix-ma1sd.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-ma1sd.service" state: absent when: "matrix_ma1sd_service_stat.stat.exists|bool" - name: Ensure systemd reloaded after matrix-ma1sd.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_ma1sd_service_stat.stat.exists|bool" - name: Ensure Matrix ma1sd paths don't exist - file: + ansible.builtin.file: path: "{{ matrix_ma1sd_base_path }}" state: absent diff --git a/roles/matrix-ma1sd/tasks/validate_config.yml b/roles/matrix-ma1sd/tasks/validate_config.yml index 5f621fca..af12dd3f 100644 --- a/roles/matrix-ma1sd/tasks/validate_config.yml +++ b/roles/matrix-ma1sd/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: (Deprecation) Warn about ma1sd variables that are not used anymore - fail: + ansible.builtin.fail: msg: > The `{{ item }}` variable defined in your configuration is not used by this playbook anymore! You'll need to adapt to the new way of extending ma1sd configuration. @@ -31,7 +31,7 @@ - 'matrix_ma1sd_architecture' - name: Ensure ma1sd configuration does not contain any dot-notation keys - fail: + ansible.builtin.fail: msg: > Since version 1.3.0, ma1sd will not accept property-style configuration keys. You have defined a key (`{{ item.key }}`) which contains a dot. @@ -40,7 +40,7 @@ with_dict: "{{ matrix_ma1sd_configuration }}" - name: Fail if required ma1sd settings not defined - fail: + ansible.builtin.fail: msg: > You need to define a required configuration setting (`{{ item }}`) for using ma1sd. when: "vars[item] == ''" @@ -49,7 +49,7 @@ - "matrix_ma1sd_dns_overwrite_homeserver_client_value" - name: (Deprecation) Catch and report renamed ma1sd variables - fail: + ansible.builtin.fail: msg: >- Your configuration contains a variable, which now has a different name. Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`). @@ -60,7 +60,7 @@ - {'old': 'matrix_ma1sd_default_port', 'new': 'matrix_ma1sd_container_port'} - name: (Deprecation) Catch and report mxisd variables - fail: + ansible.builtin.fail: msg: >- mxisd is deprecated and has been replaced with ma1sd (https://github.com/ma1uta/ma1sd), a compatible fork. The playbook will migrate your existing mxisd configuration and data automatically, but you need to adjust variable names. diff --git a/roles/matrix-mailer/tasks/init.yml b/roles/matrix-mailer/tasks/init.yml index c928d557..c0afe962 100644 --- a/roles/matrix-mailer/tasks/init.yml +++ b/roles/matrix-mailer/tasks/init.yml @@ -2,10 +2,10 @@ # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 - name: Fail if trying to self-build on Ansible < 2.8 - fail: + 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_mailer_container_image_self_build and matrix_mailer_enabled" -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mailer.service'] }}" when: matrix_mailer_enabled|bool diff --git a/roles/matrix-mailer/tasks/setup_mailer.yml b/roles/matrix-mailer/tasks/setup_mailer.yml index d2f8f917..aa1e725a 100644 --- a/roles/matrix-mailer/tasks/setup_mailer.yml +++ b/roles/matrix-mailer/tasks/setup_mailer.yml @@ -5,7 +5,7 @@ # - name: Ensure mailer base path exists - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -17,14 +17,14 @@ when: "matrix_mailer_enabled|bool and item.when" - name: Ensure mailer environment variables file created - template: + ansible.builtin.template: src: "{{ role_path }}/templates/env-mailer.j2" dest: "{{ matrix_mailer_base_path }}/env-mailer" mode: 0640 when: matrix_mailer_enabled|bool - name: Ensure exim-relay repository is present on self-build - git: + ansible.builtin.git: repo: "{{ matrix_mailer_container_image_self_build_repository_url }}" dest: "{{ matrix_mailer_container_image_self_build_src_files_path }}" version: "{{ matrix_mailer_container_image_self_build_version }}" @@ -59,7 +59,7 @@ until: result is not failed - name: Ensure matrix-mailer.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-mailer.service.j2" dest: "{{ matrix_systemd_path }}/matrix-mailer.service" mode: 0644 @@ -67,7 +67,7 @@ when: matrix_mailer_enabled|bool - name: Ensure systemd reloaded after matrix-mailer.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_mailer_enabled|bool and matrix_mailer_systemd_service_result.changed" @@ -82,7 +82,7 @@ when: "not matrix_mailer_enabled|bool" - name: Ensure matrix-mailer is stopped - service: + ansible.builtin.service: name: matrix-mailer state: stopped enabled: false @@ -91,18 +91,18 @@ when: "not matrix_mailer_enabled|bool and matrix_mailer_service_stat.stat.exists" - name: Ensure matrix-mailer.service doesn't exist - file: + 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" - name: Ensure systemd reloaded after matrix-mailer.service removal - service: + ansible.builtin.service: daemon_reload: true when: "not matrix_mailer_enabled|bool and matrix_mailer_service_stat.stat.exists" - name: Ensure Matrix mailer environment variables path doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_mailer_base_path }}" state: absent 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 ddc8cb47..3f31470c 100644 --- a/roles/matrix-nginx-proxy/tasks/init.yml +++ b/roles/matrix-nginx-proxy/tasks/init.yml @@ -1,9 +1,9 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-nginx-proxy.service'] }}" when: matrix_nginx_proxy_enabled|bool -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + [item.name] }}" 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 74f8e8d1..066e62d3 100644 --- a/roles/matrix-nginx-proxy/tasks/main.yml +++ b/roles/matrix-nginx-proxy/tasks/main.yml @@ -33,7 +33,7 @@ - self-check - name: Mark matrix-nginx-proxy role as executed - set_fact: + ansible.builtin.set_fact: matrix_nginx_proxy_role_executed: true tags: - always diff --git a/roles/matrix-nginx-proxy/tasks/nginx-proxy/setup_metrics_auth.yml b/roles/matrix-nginx-proxy/tasks/nginx-proxy/setup_metrics_auth.yml index 046746df..5d100577 100644 --- a/roles/matrix-nginx-proxy/tasks/nginx-proxy/setup_metrics_auth.yml +++ b/roles/matrix-nginx-proxy/tasks/nginx-proxy/setup_metrics_auth.yml @@ -2,7 +2,7 @@ # When we're dealing with raw htpasswd content, we just store it in the file directly. - name: Ensure matrix-metrics-htpasswd is present when generated from raw content (protecting /metrics/* URIs) - copy: + ansible.builtin.copy: content: "{{ matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_raw_content }}" dest: "{{ matrix_nginx_proxy_data_path }}/matrix-metrics-htpasswd" owner: "{{ matrix_user_username }}" @@ -30,7 +30,7 @@ # We store the password in a file and make the `htpasswd` tool read it from there, # as opposed to passing it directly on stdin (which will expose it to other processes on the server). - name: Store metrics password in a temporary file - copy: + ansible.builtin.copy: content: "{{ matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_password }}" dest: "/tmp/matrix-nginx-proxy-metrics-password" mode: 0400 @@ -38,7 +38,7 @@ group: "{{ matrix_user_gid }}" - name: Generate matrix-metrics-htpasswd from username/password (protecting /metrics/* URIs) - command: + ansible.builtin.command: cmd: >- {{ matrix_host_command_docker }} run --rm @@ -53,7 +53,7 @@ 'cat /password | htpasswd -i -c /data/matrix-metrics-htpasswd {{ matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_username }} && chmod 600 /data/matrix-metrics-htpasswd' - name: Delete temporary metrics password file - file: + ansible.builtin.file: path: /tmp/matrix-nginx-proxy-metrics-password state: absent when: matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_username != '' 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 be1b6555..ad53084d 100644 --- a/roles/matrix-nginx-proxy/tasks/self_check_well_known.yml +++ b/roles/matrix-nginx-proxy/tasks/self_check_well_known.yml @@ -1,7 +1,7 @@ --- - name: Determine well-known files to check (Matrix) - set_fact: + ansible.builtin.set_fact: well_known_file_checks: - path: /.well-known/matrix/client purpose: Client Discovery @@ -10,7 +10,7 @@ validate_certs: "{{ matrix_nginx_proxy_self_check_validate_certificates }}" - block: - - set_fact: + - ansible.builtin.set_fact: well_known_file_check_matrix_server: path: /.well-known/matrix/server purpose: Server Discovery @@ -19,7 +19,7 @@ validate_certs: "{{ matrix_nginx_proxy_self_check_validate_certificates }}" - name: Determine domains that we require certificates for (ma1sd) - set_fact: + 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 diff --git a/roles/matrix-nginx-proxy/tasks/self_check_well_known_file.yml b/roles/matrix-nginx-proxy/tasks/self_check_well_known_file.yml index 588cd1e7..0a7b5845 100644 --- a/roles/matrix-nginx-proxy/tasks/self_check_well_known_file.yml +++ b/roles/matrix-nginx-proxy/tasks/self_check_well_known_file.yml @@ -1,13 +1,13 @@ --- -- set_fact: +- ansible.builtin.set_fact: well_known_url_matrix: "https://{{ matrix_server_fqn_matrix }}{{ well_known_file_check.path }}" well_known_url_identity: "https://{{ matrix_domain }}{{ well_known_file_check.path }}" # These well-known files may be served without a `Content-Type: application/json` header, # so we can't rely on the uri module's automatic parsing of JSON. - name: Check .well-known on the matrix hostname - uri: + ansible.builtin.uri: url: "{{ well_known_url_matrix }}" follow_redirects: none return_content: true @@ -19,25 +19,25 @@ ignore_errors: true - name: Fail if .well-known not working on the matrix hostname - fail: + ansible.builtin.fail: msg: "Failed checking that the well-known file for {{ well_known_file_check.purpose }} is configured at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ well_known_url_matrix }}`). Is port 443 open in your firewall? Full error: {{ result_well_known_matrix }}" when: "result_well_known_matrix.failed" - name: Parse JSON for well-known payload at the matrix hostname - set_fact: + ansible.builtin.set_fact: well_known_matrix_payload: "{{ result_well_known_matrix.content|from_json }}" - name: Fail if .well-known not CORS-aware on the matrix hostname - fail: + ansible.builtin.fail: msg: "The well-known file for {{ well_known_file_check.purpose }} on `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ well_known_url_matrix }}`) is not CORS-aware. The file needs to be served with an Access-Control-Allow-Origin header set." when: "well_known_file_check.cors and 'access_control_allow_origin' not in result_well_known_matrix" - name: Report working .well-known on the matrix hostname - debug: + ansible.builtin.debug: msg: "well-known for {{ well_known_file_check.purpose }} is configured correctly for `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ well_known_url_matrix }}`)" - name: Check .well-known on the identity hostname - uri: + ansible.builtin.uri: url: "{{ well_known_url_identity }}" follow_redirects: "{{ well_known_file_check.follow_redirects }}" return_content: true @@ -49,25 +49,25 @@ ignore_errors: true - name: Fail if .well-known not working on the identity hostname - fail: + ansible.builtin.fail: msg: "Failed checking that the well-known file for {{ well_known_file_check.purpose }} is configured at `{{ matrix_domain }}` (checked endpoint: `{{ well_known_url_identity }}`). Is port 443 open in your firewall? Full error: {{ result_well_known_identity }}" when: "result_well_known_identity.failed" - name: Parse JSON for well-known payload at the identity hostname - set_fact: + ansible.builtin.set_fact: well_known_identity_payload: "{{ result_well_known_identity.content|from_json }}" - name: Fail if .well-known not CORS-aware on the identity hostname - fail: + ansible.builtin.fail: msg: "The well-known file for {{ well_known_file_check.purpose }} on `{{ matrix_domain }}` (checked endpoint: `{{ well_known_url_identity }}`) is not CORS-aware. The file needs to be served with an Access-Control-Allow-Origin header set. See docs/configuring-well-known.md" when: "well_known_file_check.cors and 'access_control_allow_origin' not in result_well_known_identity" # For people who manually copy the well-known file, try to detect if it's outdated - name: Fail if well-known is different on matrix hostname and identity hostname - fail: + ansible.builtin.fail: msg: "The well-known files for {{ well_known_file_check.purpose }} at `{{ matrix_server_fqn_matrix }}` and `{{ matrix_domain }}` are different. Perhaps you copied the file ({{ well_known_file_check.path }}) manually before and now it's outdated?" when: "well_known_matrix_payload != well_known_identity_payload" - name: Report working .well-known on the identity hostname - debug: + ansible.builtin.debug: msg: "well-known for {{ well_known_file_check.purpose }} ({{ well_known_file_check.path }}) is configured correctly for `{{ matrix_domain }}` (checked endpoint: `{{ well_known_url_identity }}`)" diff --git a/roles/matrix-nginx-proxy/tasks/setup_nginx_proxy.yml b/roles/matrix-nginx-proxy/tasks/setup_nginx_proxy.yml index 70541fdc..7a71c739 100644 --- a/roles/matrix-nginx-proxy/tasks/setup_nginx_proxy.yml +++ b/roles/matrix-nginx-proxy/tasks/setup_nginx_proxy.yml @@ -11,7 +11,7 @@ # to be unnecessary. # - name: Ensure Matrix nginx-proxy paths exist - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -25,7 +25,7 @@ when: item.when|bool - name: Ensure Matrix nginx-proxy configured (main config override) - template: + ansible.builtin.template: src: "{{ role_path }}/templates/nginx/nginx.conf.j2" dest: "{{ matrix_nginx_proxy_base_path }}/nginx.conf" mode: 0644 @@ -36,123 +36,123 @@ 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) - template: + 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 - name: Ensure Matrix nginx-proxy configuration for matrix-synapse exists - template: + 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 - name: Ensure Matrix nginx-proxy configuration for matrix-synapse deleted - file: + ansible.builtin.file: path: "{{ matrix_nginx_proxy_confd_path }}/matrix-synapse.conf" state: absent when: "not matrix_nginx_proxy_proxy_synapse_enabled|bool" - name: Ensure Matrix nginx-proxy configuration for matrix-dendrite exists - template: + 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 - name: Ensure Matrix nginx-proxy configuration for matrix-dendrite deleted - file: + ansible.builtin.file: path: "{{ matrix_nginx_proxy_confd_path }}/matrix-dendrite.conf" state: absent when: "not matrix_nginx_proxy_proxy_dendrite_enabled|bool" - name: Ensure Matrix nginx-proxy configuration for Element domain exists - template: + 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 - name: Ensure Matrix nginx-proxy configuration for riot domain exists - template: + 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 - name: Ensure Matrix nginx-proxy configuration for Hydrogen domain exists - template: + 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 - name: Ensure Matrix nginx-proxy configuration for Cinny domain exists - template: + 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 - name: Ensure Matrix nginx-proxy configuration for buscarron domain exists - template: + 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 - name: Ensure Matrix nginx-proxy configuration for dimension domain exists - template: + 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 - name: Ensure Matrix nginx-proxy configuration for goneb domain exists - template: + 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 - name: Ensure Matrix nginx-proxy configuration for jitsi domain exists - template: + 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 - name: Ensure Matrix nginx-proxy configuration for grafana domain exists - template: + 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 - name: Ensure Matrix nginx-proxy configuration for sygnal domain exists - template: + 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 - name: Ensure Matrix nginx-proxy configuration for ntfy domain exists - template: + 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 - name: Ensure Matrix nginx-proxy configuration for Matrix domain exists - template: + ansible.builtin.template: src: "{{ role_path }}/templates/nginx/conf.d/matrix-domain.conf.j2" dest: "{{ matrix_nginx_proxy_confd_path }}/matrix-domain.conf" mode: 0644 - name: Ensure Matrix nginx-proxy data directory for base domain exists - file: + ansible.builtin.file: path: "{{ matrix_nginx_proxy_data_path }}/matrix-domain" state: directory mode: 0750 @@ -161,7 +161,7 @@ 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 - copy: + ansible.builtin.copy: content: "{{ matrix_nginx_proxy_base_domain_homepage_template }}" dest: "{{ matrix_nginx_proxy_data_path }}/matrix-domain/index.html" mode: 0644 @@ -170,7 +170,7 @@ 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 - template: + 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 @@ -192,7 +192,7 @@ until: result is not failed - name: Ensure matrix-nginx-proxy.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-nginx-proxy.service.j2" dest: "{{ matrix_systemd_path }}/matrix-nginx-proxy.service" mode: 0644 @@ -200,7 +200,7 @@ when: matrix_nginx_proxy_enabled|bool - name: Ensure systemd reloaded after matrix-nginx-proxy.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_nginx_proxy_enabled and matrix_nginx_proxy_systemd_service_result.changed" @@ -216,7 +216,7 @@ when: "not matrix_nginx_proxy_enabled|bool" - name: Ensure matrix-nginx-proxy is stopped - service: + ansible.builtin.service: name: matrix-nginx-proxy state: stopped enabled: false @@ -225,113 +225,113 @@ when: "not matrix_nginx_proxy_enabled|bool and matrix_nginx_proxy_service_stat.stat.exists" - name: Ensure matrix-nginx-proxy.service doesn't exist - file: + 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" - name: Ensure systemd reloaded after matrix-nginx-proxy.service removal - service: + ansible.builtin.service: daemon_reload: true 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 - file: + ansible.builtin.file: path: "{{ matrix_nginx_proxy_confd_path }}/matrix-domain.conf" state: absent when: "not matrix_nginx_proxy_proxy_matrix_enabled|bool" - name: Ensure Matrix nginx-proxy configuration for riot domain deleted - file: + 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" - name: Ensure Matrix nginx-proxy configuration for Hydrogen domain deleted - file: + ansible.builtin.file: path: "{{ matrix_nginx_proxy_confd_path }}/matrix-client-hydrogen.conf" state: absent when: "not matrix_nginx_proxy_proxy_hydrogen_enabled|bool" - name: Ensure Matrix nginx-proxy configuration for Cinny domain deleted - file: + ansible.builtin.file: path: "{{ matrix_nginx_proxy_confd_path }}/matrix-client-cinny.conf" state: absent when: "not matrix_nginx_proxy_proxy_cinny_enabled|bool" - name: Ensure Matrix nginx-proxy configuration for buscarron domain deleted - file: + ansible.builtin.file: path: "{{ matrix_nginx_proxy_confd_path }}/matrix-bot-buscarron.conf" state: absent when: "not matrix_nginx_proxy_proxy_buscarron_enabled|bool" - name: Ensure Matrix nginx-proxy configuration for dimension domain deleted - file: + ansible.builtin.file: path: "{{ matrix_nginx_proxy_confd_path }}/matrix-dimension.conf" state: absent when: "not matrix_nginx_proxy_proxy_dimension_enabled|bool" - name: Ensure Matrix nginx-proxy configuration for goneb domain deleted - file: + 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" - name: Ensure Matrix nginx-proxy configuration for jitsi domain deleted - file: + ansible.builtin.file: path: "{{ matrix_nginx_proxy_confd_path }}/matrix-jitsi.conf" state: absent when: "not matrix_nginx_proxy_proxy_jitsi_enabled|bool" - name: Ensure Matrix nginx-proxy configuration for grafana domain deleted - file: + ansible.builtin.file: path: "{{ matrix_nginx_proxy_confd_path }}/matrix-grafana.conf" state: absent when: "not matrix_nginx_proxy_proxy_grafana_enabled|bool" - name: Ensure Matrix nginx-proxy configuration for sygnal domain deleted - file: + ansible.builtin.file: path: "{{ matrix_nginx_proxy_confd_path }}/matrix-sygnal.conf" state: absent when: "not matrix_nginx_proxy_proxy_sygnal_enabled|bool" - name: Ensure Matrix nginx-proxy configuration for ntfy domain deleted - file: + ansible.builtin.file: path: "{{ matrix_nginx_proxy_confd_path }}/matrix-ntfy.conf" state: absent when: "not matrix_nginx_proxy_proxy_ntfy_enabled|bool" - name: Ensure Matrix nginx-proxy homepage for base domain deleted - file: + 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" - name: Ensure Matrix nginx-proxy configuration for base domain deleted - file: + 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" - name: Ensure Matrix nginx-proxy configuration for main config override deleted - file: + ansible.builtin.file: path: "{{ matrix_nginx_proxy_base_path }}/nginx.conf" state: absent when: "not matrix_nginx_proxy_enabled|bool" - name: Ensure Matrix nginx-proxy htpasswd is deleted (protecting /_synapse/metrics URI) - file: + ansible.builtin.file: path: "{{ matrix_nginx_proxy_data_path }}/matrix-synapse-metrics-htpasswd" state: absent # This file is now generated by the matrix-synapse role and saved in the Synapse directory - name: (Cleanup) Ensure old sample prometheus.yml for external scraping is deleted - file: + ansible.builtin.file: path: "{{ matrix_base_data_path }}/external_prometheus.yml.example" state: absent - name: Ensure Matrix nginx-proxy htpasswd is deleted (protecting /metrics/* URIs) - file: + 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" diff --git a/roles/matrix-nginx-proxy/tasks/setup_well_known.yml b/roles/matrix-nginx-proxy/tasks/setup_well_known.yml index 1c85552c..11e941bd 100644 --- a/roles/matrix-nginx-proxy/tasks/setup_well_known.yml +++ b/roles/matrix-nginx-proxy/tasks/setup_well_known.yml @@ -1,5 +1,5 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_well_known_file_path: "{{ matrix_static_files_base_path }}/.well-known/matrix/client" # We need others to be able to read these directories too, @@ -7,7 +7,7 @@ # # For running with another webserver, we recommend being part of the `matrix` group. - name: Ensure Matrix static-files path exists - file: + ansible.builtin.file: path: "{{ item }}" state: directory mode: 0755 @@ -17,7 +17,7 @@ - "{{ matrix_static_files_base_path }}/.well-known/matrix" - name: Ensure Matrix /.well-known/matrix/client configured - template: + ansible.builtin.template: src: "{{ role_path }}/templates/well-known/matrix-client.j2" dest: "{{ matrix_static_files_base_path }}/.well-known/matrix" mode: 0644 diff --git a/roles/matrix-nginx-proxy/tasks/ssl/main.yml b/roles/matrix-nginx-proxy/tasks/ssl/main.yml index 6b843c7b..d6a2627b 100644 --- a/roles/matrix-nginx-proxy/tasks/ssl/main.yml +++ b/roles/matrix-nginx-proxy/tasks/ssl/main.yml @@ -1,12 +1,12 @@ --- - name: Fail if using unsupported SSL certificate retrieval method - fail: + ansible.builtin.fail: msg: "The `matrix_ssl_retrieval_method` variable contains an unsupported value" when: "matrix_ssl_retrieval_method not in ['lets-encrypt', 'self-signed', 'manually-managed', 'none']" - name: Fail if using unsupported private key type - fail: + ansible.builtin.fail: msg: "The `matrix_ssl_lets_encrypt_key_type` variable contains an unsupported value" when: "matrix_ssl_lets_encrypt_key_type not in ['rsa', 'ecdsa']" @@ -14,7 +14,7 @@ # Common tasks, required by almost any method below. - name: Ensure SSL certificate paths exists - file: + ansible.builtin.file: path: "{{ item }}" state: directory mode: 0770 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 bfd25894..46be689c 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 @@ -3,7 +3,7 @@ # This is a cleanup/migration task, because of to the new way we manage cronjobs (`cron` module) and the new script name. # This migration task can be removed some time in the future. - name: (Migration) Remove deprecated Let's Encrypt SSL certificate management files - file: + ansible.builtin.file: path: "{{ item }}" state: absent with_items: @@ -31,13 +31,13 @@ loop_var: domain_name - name: Ensure Let's Encrypt SSL renewal script installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/usr-local-bin/matrix-ssl-lets-encrypt-certificates-renew.j2" dest: "{{ matrix_local_bin_path }}/matrix-ssl-lets-encrypt-certificates-renew" mode: 0755 - name: Ensure SSL renewal systemd units installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/{{ item.name }}.j2" dest: "{{ matrix_systemd_path }}/{{ item.name }}" mode: 0644 @@ -51,14 +51,14 @@ - block: - name: Ensure matrix-ssl-lets-encrypt-renew cronjob removed - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/{{ item.name }}" state: absent when: "not item.applicable|bool" with_items: "{{ matrix_ssl_renewal_systemd_units_list }}" - name: Ensure Let's Encrypt SSL renewal script removed - file: + ansible.builtin.file: path: "{{ matrix_local_bin_path }}/matrix-ssl-lets-encrypt-certificates-renew" state: absent when: "matrix_ssl_retrieval_method != 'lets-encrypt'" 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 12a21257..02a137f3 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 @@ -1,8 +1,8 @@ --- -- debug: +- ansible.builtin.debug: msg: "Dealing with SSL certificate retrieval for domain: {{ domain_name }}" -- set_fact: +- ansible.builtin.set_fact: domain_name_certificate_path: "{{ matrix_ssl_config_dir_path }}/live/{{ domain_name }}/fullchain.pem" - name: Check if a certificate for the domain already exists @@ -10,12 +10,12 @@ path: "{{ domain_name_certificate_path }}" register: domain_name_certificate_path_stat -- set_fact: +- ansible.builtin.set_fact: domain_name_needs_cert: "{{ not domain_name_certificate_path_stat.stat.exists }}" - block: - name: Ensure required service for obtaining is started - service: + ansible.builtin.service: name: "{{ matrix_ssl_pre_obtaining_required_service_name }}" state: started register: matrix_ssl_pre_obtaining_required_service_start_result @@ -29,7 +29,7 @@ # 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. - name: Attempt initial SSL certificate retrieval with standalone authenticator (directly) - shell: >- + ansible.builtin.shell: >- {{ matrix_host_command_docker }} run --rm --name=matrix-certbot @@ -58,7 +58,7 @@ # If matrix-nginx-proxy is configured from a previous run of this playbook, # and it's running now, it may be able to proxy requests to `matrix_ssl_lets_encrypt_certbot_standalone_http_port`. - name: Attempt initial SSL certificate retrieval with standalone authenticator (via proxy) - shell: >- + ansible.builtin.shell: >- {{ matrix_host_command_docker }} run --rm --name=matrix-certbot @@ -86,7 +86,7 @@ ignore_errors: true - name: Fail if all SSL certificate retrieval attempts failed - fail: + ansible.builtin.fail: msg: | Failed to obtain a certificate directly (by listening on port 80) and also failed to obtain by relying on the server at port 80 to proxy the request. 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 2b5bb1f3..8bab1128 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 @@ -1,6 +1,6 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_ssl_certificate_verification_cert_path: "{{ matrix_ssl_config_dir_path }}/live/{{ domain_name }}/fullchain.pem" matrix_ssl_certificate_verification_cert_key_path: "{{ matrix_ssl_config_dir_path }}/live/{{ domain_name }}/privkey.pem" @@ -9,7 +9,7 @@ path: "{{ matrix_ssl_certificate_verification_cert_path }}" register: matrix_ssl_certificate_verification_cert_path_stat_result -- fail: +- ansible.builtin.fail: msg: "Failed finding a certificate file (for domain `{{ domain_name }}`) at `{{ matrix_ssl_certificate_verification_cert_path }}`" when: "not matrix_ssl_certificate_verification_cert_path_stat_result.stat.exists" @@ -18,6 +18,6 @@ path: "{{ matrix_ssl_certificate_verification_cert_key_path }}" register: matrix_ssl_certificate_verification_cert_key_path_stat_result -- fail: +- ansible.builtin.fail: msg: "Failed finding a certificate key file (for domain `{{ domain_name }}`) at `{{ matrix_ssl_certificate_verification_cert_key_path }}`" when: "not matrix_ssl_certificate_verification_cert_key_path_stat_result.stat.exists" 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 ff7fa2d8..873420c3 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 @@ -1,6 +1,6 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_ssl_certificate_csr_path: "{{ matrix_ssl_config_dir_path }}/live/{{ domain_name }}/csr.csr" matrix_ssl_certificate_cert_path: "{{ matrix_ssl_config_dir_path }}/live/{{ domain_name }}/fullchain.pem" matrix_ssl_certificate_cert_key_path: "{{ matrix_ssl_config_dir_path }}/live/{{ domain_name }}/privkey.pem" @@ -12,7 +12,7 @@ # In order to do any sort of generation (below), we need to ensure the directory exists first - name: Ensure SSL certificate directory exists - file: + ansible.builtin.file: path: "{{ matrix_ssl_certificate_csr_path|dirname }}" state: directory mode: 0750 @@ -28,7 +28,7 @@ # # We'll do it in a more manual way. - name: Generate SSL certificate - command: | + ansible.builtin.command: | openssl req -x509 \ -sha256 \ -newkey rsa:4096 \ @@ -40,7 +40,7 @@ when: "not matrix_ssl_certificate_cert_path_stat_result.stat.exists" - name: Adjust SSL certificate file ownership - file: + ansible.builtin.file: path: "{{ item }}" owner: "{{ matrix_user_username }}" group: "{{ matrix_user_groupname }}" diff --git a/roles/matrix-nginx-proxy/tasks/validate_config.yml b/roles/matrix-nginx-proxy/tasks/validate_config.yml index c6697e93..7e3b1ecc 100644 --- a/roles/matrix-nginx-proxy/tasks/validate_config.yml +++ b/roles/matrix-nginx-proxy/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: (Deprecation) Catch and report renamed settings - fail: + ansible.builtin.fail: msg: >- Your configuration contains a variable, which now has a different name. Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`). @@ -16,19 +16,19 @@ - {'old': 'matrix_nginx_proxy_reload_cron_time_definition', 'new': ''} - name: Fail on unknown matrix_ssl_retrieval_method - fail: + ansible.builtin.fail: msg: >- `matrix_ssl_retrieval_method` needs to be set to a known value. when: "matrix_ssl_retrieval_method not in ['lets-encrypt', 'self-signed', 'manually-managed', 'none']" - name: Fail on unknown matrix_nginx_proxy_ssl_config - fail: + ansible.builtin.fail: msg: >- `matrix_nginx_proxy_ssl_preset` needs to be set to a known value. when: "matrix_nginx_proxy_ssl_preset not in ['modern', 'intermediate', 'old']" - name: Fail if Basic Auth enabled for metrics, but no credentials supplied - fail: + ansible.builtin.fail: msg: | 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`) @@ -37,7 +37,7 @@ - block: - name: (Deprecation) Catch and report renamed settings - fail: + ansible.builtin.fail: msg: >- Your configuration contains a variable, which now has a different name. Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`). @@ -48,7 +48,7 @@ when: "item.old in vars" - name: Fail if required variables are undefined - fail: + ansible.builtin.fail: msg: "The `{{ item }}` variable must be defined and have a non-null value" with_items: - "matrix_ssl_lets_encrypt_support_email" @@ -60,7 +60,7 @@ when: "matrix_ssl_retrieval_method == 'lets-encrypt'" - name: (Deprecation) Catch and report old metrics usage - fail: + ansible.builtin.fail: msg: >- Your configuration contains a variable (`{{ item }}`), which refers to the old metrics collection system for Synapse, which exposed metrics on `https://matrix.DOMAIN/_synapse/metrics` and `https://matrix.DOMAIN/_synapse-worker-TYPE-ID/metrics`. diff --git a/roles/matrix-ntfy/tasks/init.yml b/roles/matrix-ntfy/tasks/init.yml index e2622655..997be03f 100644 --- a/roles/matrix-ntfy/tasks/init.yml +++ b/roles/matrix-ntfy/tasks/init.yml @@ -1,5 +1,5 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-ntfy.service'] }}" when: matrix_ntfy_enabled|bool diff --git a/roles/matrix-ntfy/tasks/self_check.yml b/roles/matrix-ntfy/tasks/self_check.yml index e9104734..02529f35 100644 --- a/roles/matrix-ntfy/tasks/self_check.yml +++ b/roles/matrix-ntfy/tasks/self_check.yml @@ -3,11 +3,11 @@ # Query an arbitrary ntfy topic using ntfy's UnifiedPush topic name syntax. # Expect an empty response (because we query 'since=1s'). -- set_fact: +- ansible.builtin.set_fact: matrix_ntfy_url_endpoint_public: "{{ matrix_ntfy_base_url }}/upSELFCHECK123/json?poll=1&since=1s" - name: Check ntfy - uri: + ansible.builtin.uri: url: "{{ matrix_ntfy_url_endpoint_public }}" follow_redirects: none validate_certs: "{{ matrix_ntfy_self_check_validate_certificates }}" @@ -16,10 +16,10 @@ ignore_errors: true - name: Fail if ntfy not working - fail: + ansible.builtin.fail: msg: "Failed checking ntfy is up at `{{ matrix_server_fqn_ntfy }}` (checked endpoint: `{{ matrix_ntfy_url_endpoint_public }}`). Is ntfy running? Is port 443 open in your firewall? Full error: {{ matrix_ntfy_self_check_result }}" when: "matrix_ntfy_self_check_result.failed" - name: Report working ntfy - debug: + ansible.builtin.debug: msg: "ntfy at `{{ matrix_server_fqn_ntfy }}` is working (checked endpoint: `{{ matrix_ntfy_url_endpoint_public }}`)" diff --git a/roles/matrix-ntfy/tasks/setup_install.yml b/roles/matrix-ntfy/tasks/setup_install.yml index 461d3176..510110c1 100644 --- a/roles/matrix-ntfy/tasks/setup_install.yml +++ b/roles/matrix-ntfy/tasks/setup_install.yml @@ -12,7 +12,7 @@ until: result is not failed - name: Ensure matrix-ntfy paths exists - file: + ansible.builtin.file: path: "{{ item }}" state: directory mode: 0750 @@ -24,7 +24,7 @@ - "{{ matrix_ntfy_data_path }}" - name: Ensure matrix-ntfy config installed - copy: + ansible.builtin.copy: content: "{{ matrix_ntfy_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_ntfy_config_dir_path }}/server.yml" mode: 0644 @@ -32,13 +32,13 @@ group: "{{ matrix_user_groupname }}" - name: Ensure matrix-ntfy.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-ntfy.service.j2" dest: "{{ matrix_systemd_path }}/matrix-ntfy.service" mode: 0644 register: matrix_ntfy_systemd_service_result - name: Ensure systemd reloaded after matrix-ntfy.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_ntfy_systemd_service_result.changed" diff --git a/roles/matrix-ntfy/tasks/setup_uninstall.yml b/roles/matrix-ntfy/tasks/setup_uninstall.yml index e63caa9a..93ecad3d 100644 --- a/roles/matrix-ntfy/tasks/setup_uninstall.yml +++ b/roles/matrix-ntfy/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_ntfy_service_stat - name: Ensure matrix-ntfy is stopped - service: + ansible.builtin.service: name: matrix-ntfy state: stopped enabled: false @@ -15,18 +15,18 @@ when: "matrix_ntfy_service_stat.stat.exists" - name: Ensure matrix-ntfy.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-ntfy.service" state: absent when: "matrix_ntfy_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-ntfy.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_ntfy_service_stat.stat.exists" - name: Ensure matrix-ntfy path doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_ntfy_base_path }}" state: absent diff --git a/roles/matrix-postgres-backup/tasks/init.yml b/roles/matrix-postgres-backup/tasks/init.yml index f74cea06..aea1c337 100644 --- a/roles/matrix-postgres-backup/tasks/init.yml +++ b/roles/matrix-postgres-backup/tasks/init.yml @@ -1,5 +1,5 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-postgres-backup.service'] }}" when: matrix_postgres_backup_enabled|bool diff --git a/roles/matrix-postgres-backup/tasks/setup_postgres_backup.yml b/roles/matrix-postgres-backup/tasks/setup_postgres_backup.yml index 73341033..deb80d8e 100644 --- a/roles/matrix-postgres-backup/tasks/setup_postgres_backup.yml +++ b/roles/matrix-postgres-backup/tasks/setup_postgres_backup.yml @@ -10,7 +10,7 @@ # If not, we install using the latest Postgres. # # Upgrading is supposed to be performed separately and explicitly (see `upgrade_postgres.yml`). -- set_fact: +- 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 @@ -27,7 +27,7 @@ until: result is not failed - name: Ensure Postgres backup paths exist - file: + ansible.builtin.file: path: "{{ item }}" state: directory mode: 0700 @@ -38,7 +38,7 @@ when: matrix_postgres_backup_enabled|bool - name: Ensure Postgres environment variables file created - template: + ansible.builtin.template: src: "{{ role_path }}/templates/{{ item }}.j2" dest: "{{ matrix_postgres_backup_path }}/{{ item }}" owner: "{{ matrix_user_username }}" @@ -49,7 +49,7 @@ when: matrix_postgres_backup_enabled|bool - name: Ensure matrix-postgres-backup.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-postgres-backup.service.j2" dest: "{{ matrix_systemd_path }}/matrix-postgres-backup.service" mode: 0644 @@ -57,7 +57,7 @@ when: matrix_postgres_backup_enabled|bool - name: Ensure systemd reloaded after matrix-postgres-backup.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_postgres_backup_enabled|bool and matrix_postgres_backup_systemd_service_result.changed" @@ -72,7 +72,7 @@ when: "not matrix_postgres_backup_enabled|bool" - name: Ensure matrix-postgres-backup is stopped - service: + ansible.builtin.service: name: matrix-postgres-backup state: stopped enabled: false @@ -80,13 +80,13 @@ when: "not matrix_postgres_backup_enabled|bool and matrix_postgres_backup_service_stat.stat.exists" - name: Ensure matrix-postgres-backup.service doesn't exist - file: + 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" - name: Ensure systemd reloaded after matrix-postgres-backup.service removal - service: + ansible.builtin.service: daemon_reload: true when: "not matrix_postgres_backup_enabled|bool and matrix_postgres_backup_service_stat.stat.exists" @@ -98,7 +98,7 @@ # We just want to notify the user. Deleting data is too destructive. - name: Inject warning if matrix-postgres backup data remains - set_fact: + ansible.builtin.set_fact: matrix_playbook_runtime_results: | {{ matrix_playbook_runtime_results|default([]) 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 10828cc7..33120453 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 @@ -4,7 +4,7 @@ # If there is, it also tries to detect the Docker image that corresponds to that version. - name: Initialize Postgres version determination variables (default to empty) - set_fact: + ansible.builtin.set_fact: matrix_postgres_backup_detection_pg_version_path: "{{ matrix_postgres_data_path }}/PG_VERSION" matrix_postgres_backup_detected_existing: false matrix_postgres_backup_detected_version: "" @@ -15,47 +15,47 @@ path: "{{ matrix_postgres_backup_detection_pg_version_path }}" register: result_pg_version_stat -- set_fact: +- ansible.builtin.set_fact: matrix_postgres_backup_detected_existing: true when: "result_pg_version_stat.stat.exists" - name: Determine existing Postgres version (read PG_VERSION file) - slurp: + ansible.builtin.slurp: src: "{{ matrix_postgres_backup_detection_pg_version_path }}" register: result_pg_version when: matrix_postgres_backup_detected_existing|bool - name: Determine existing Postgres version (make sense of PG_VERSION file) - set_fact: + ansible.builtin.set_fact: matrix_postgres_backup_detected_version: "{{ result_pg_version['content']|b64decode|replace('\n', '') }}" when: matrix_postgres_backup_detected_existing|bool - name: Determine corresponding Docker image to detected version (assume default of latest) - set_fact: + ansible.builtin.set_fact: matrix_postgres_backup_detected_version_corresponding_docker_image: "{{ matrix_postgres_backup_docker_image_latest }}" when: "matrix_postgres_backup_detected_version != ''" - name: Determine corresponding Docker image to detected version (use 9.x, if detected) - set_fact: + ansible.builtin.set_fact: matrix_postgres_backup_detected_version_corresponding_docker_image: "{{ matrix_postgres_backup_docker_image_v9 }}" when: "matrix_postgres_backup_detected_version.startswith('9.')" - name: Determine corresponding Docker image to detected version (use 10.x, if detected) - set_fact: + ansible.builtin.set_fact: matrix_postgres_backup_detected_version_corresponding_docker_image: "{{ matrix_postgres_backup_docker_image_v10 }}" when: "matrix_postgres_backup_detected_version == '10' or matrix_postgres_backup_detected_version.startswith('10.')" - name: Determine corresponding Docker image to detected version (use 11.x, if detected) - set_fact: + ansible.builtin.set_fact: matrix_postgres_backup_detected_version_corresponding_docker_image: "{{ matrix_postgres_backup_docker_image_v11 }}" when: "matrix_postgres_backup_detected_version == '11' or matrix_postgres_backup_detected_version.startswith('11.')" - name: Determine corresponding Docker image to detected version (use 12.x, if detected) - set_fact: + ansible.builtin.set_fact: matrix_postgres_backup_detected_version_corresponding_docker_image: "{{ matrix_postgres_backup_docker_image_v12 }}" when: "matrix_postgres_backup_detected_version == '12' or matrix_postgres_backup_detected_version.startswith('12.')" - name: Determine corresponding Docker image to detected version (use 13.x, if detected) - set_fact: + ansible.builtin.set_fact: matrix_postgres_backup_detected_version_corresponding_docker_image: "{{ matrix_postgres_backup_docker_image_v13 }}" when: "matrix_postgres_backup_detected_version == '13' or matrix_postgres_backup_detected_version.startswith('13.')" diff --git a/roles/matrix-postgres-backup/tasks/validate_config.yml b/roles/matrix-postgres-backup/tasks/validate_config.yml index fda9b919..8a2ddb5a 100644 --- a/roles/matrix-postgres-backup/tasks/validate_config.yml +++ b/roles/matrix-postgres-backup/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required Postgres settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). when: "vars[item] == ''" diff --git a/roles/matrix-postgres/tasks/import_generic_sqlite_db.yml b/roles/matrix-postgres/tasks/import_generic_sqlite_db.yml index 2a673ee3..81f37050 100644 --- a/roles/matrix-postgres/tasks/import_generic_sqlite_db.yml +++ b/roles/matrix-postgres/tasks/import_generic_sqlite_db.yml @@ -3,12 +3,12 @@ # Pre-checks - name: Fail if Postgres not enabled - fail: + ansible.builtin.fail: msg: "Postgres via the matrix-postgres role is not enabled (`matrix_postgres_enabled`). Cannot import." when: "not matrix_postgres_enabled|bool" - name: Fail if playbook called incorrectly - fail: + ansible.builtin.fail: msg: "The `sqlite_database_path` variable needs to be provided to this playbook, via --extra-vars" when: "sqlite_database_path is not defined or sqlite_database_path.startswith('<')" @@ -18,7 +18,7 @@ register: sqlite_database_path_stat_result - name: Fail if provided SQLite database file doesn't exist - fail: + ansible.builtin.fail: msg: "File cannot be found on the server at {{ sqlite_database_path }}" when: "not sqlite_database_path_stat_result.stat.exists" @@ -27,16 +27,16 @@ - block: - name: Fail if postgres_connection_string_variable_name points to an undefined variable - fail: msg="postgres_connection_string_variable_name is defined, but there is no variable with the name `{{ postgres_connection_string_variable_name }}`" + ansible.builtin.fail: msg="postgres_connection_string_variable_name is defined, but there is no variable with the name `{{ postgres_connection_string_variable_name }}`" when: "postgres_connection_string_variable_name not in vars" - name: Get Postgres connection string from variable - set_fact: + ansible.builtin.set_fact: postgres_db_connection_string: "{{ lookup('vars', postgres_connection_string_variable_name) }}" when: 'postgres_connection_string_variable_name is defined' - name: Fail if playbook called incorrectly - fail: + ansible.builtin.fail: msg: >- Either a `postgres_db_connection_string` variable or a `postgres_connection_string_variable_name` needs to be provided to this playbook, via `--extra-vars`. Example: `--extra-vars="postgres_db_connection_string=postgresql://username:password@localhost:/database_name"` or `--extra-vars="postgres_connection_string_variable_name=matrix_appservice_discord_database_connString"` @@ -46,7 +46,7 @@ # Defaults - name: Set postgres_start_wait_time, if not provided - set_fact: + ansible.builtin.set_fact: postgres_start_wait_time: 15 when: "postgres_start_wait_time|default('') == ''" @@ -54,7 +54,7 @@ # Actual import work - name: Ensure matrix-postgres is started - service: + ansible.builtin.service: name: matrix-postgres state: started daemon_reload: true @@ -68,7 +68,7 @@ when: "matrix_postgres_service_start_result.changed|bool" - name: Import SQLite database from {{ sqlite_database_path }} into Postgres - command: + ansible.builtin.command: cmd: >- {{ matrix_host_command_docker }} run --rm @@ -82,11 +82,11 @@ 'pgloader /in.db {{ postgres_db_connection_string }}' - name: Archive SQLite database ({{ sqlite_database_path }} -> {{ sqlite_database_path }}.backup) - command: + ansible.builtin.command: cmd: "mv {{ sqlite_database_path }} {{ sqlite_database_path }}.backup" - name: Inject result - set_fact: + ansible.builtin.set_fact: matrix_playbook_runtime_results: | {{ matrix_playbook_runtime_results|default([]) diff --git a/roles/matrix-postgres/tasks/import_postgres.yml b/roles/matrix-postgres/tasks/import_postgres.yml index 948c4b3a..899dc78c 100644 --- a/roles/matrix-postgres/tasks/import_postgres.yml +++ b/roles/matrix-postgres/tasks/import_postgres.yml @@ -3,12 +3,12 @@ # Pre-checks - name: Fail if Postgres not enabled - fail: + ansible.builtin.fail: msg: "Postgres via the matrix-postgres role is not enabled (`matrix_postgres_enabled`). Cannot import." when: "not matrix_postgres_enabled|bool" - name: Fail if playbook called incorrectly - fail: + ansible.builtin.fail: msg: "The `server_path_postgres_dump` variable needs to be provided to this playbook, via --extra-vars" when: "server_path_postgres_dump is not defined or server_path_postgres_dump.startswith('<')" @@ -18,7 +18,7 @@ register: result_server_path_postgres_dump_stat - name: Fail if provided Postgres dump file doesn't exists - fail: + ansible.builtin.fail: msg: "File cannot be found on the server at {{ server_path_postgres_dump }}" when: "not result_server_path_postgres_dump_stat.stat.exists" @@ -26,26 +26,26 @@ # Defaults - name: Set postgres_start_wait_time, if not provided - set_fact: + ansible.builtin.set_fact: postgres_start_wait_time: 15 when: "postgres_start_wait_time|default('') == ''" - name: Set postgres_import_wait_time, if not provided - set_fact: + ansible.builtin.set_fact: postgres_import_wait_time: "{{ 7 * 86400 }}" 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 - set_fact: + ansible.builtin.set_fact: postgres_default_import_database: "{{ matrix_postgres_db_name }}" when: "postgres_default_import_database|default('') == ''" # Actual import work - name: Ensure matrix-postgres is started - service: + ansible.builtin.service: name: matrix-postgres state: started daemon_reload: true @@ -59,7 +59,7 @@ - import_tasks: tasks/util/detect_existing_postgres_version.yml - name: Abort, if no existing Postgres version detected - fail: + ansible.builtin.fail: msg: "Could not find existing Postgres installation" when: "not matrix_postgres_detected_existing|bool" @@ -68,7 +68,7 @@ # The dump most likely contains those same entries and would try to re-create them, leading to errors. # We need to skip over those lines. - name: Generate Postgres database import command - set_fact: + ansible.builtin.set_fact: matrix_postgres_import_command: >- {{ matrix_host_command_docker }} run --rm --name matrix-postgres-import --log-driver=none @@ -91,7 +91,7 @@ # We want to run `debug: msg=".."`, but that dumps it as JSON and escapes double quotes within it, # which ruins the command (`matrix_postgres_import_command`) - name: Note about Postgres importing alternative - set_fact: + ansible.builtin.set_fact: dummy: true with_items: - >- @@ -101,6 +101,6 @@ and manually run the above import command directly on the server. - name: Perform Postgres database import - command: "{{ matrix_postgres_import_command }}" + ansible.builtin.command: "{{ matrix_postgres_import_command }}" async: "{{ postgres_import_wait_time }}" poll: 10 diff --git a/roles/matrix-postgres/tasks/import_synapse_sqlite_db.yml b/roles/matrix-postgres/tasks/import_synapse_sqlite_db.yml index 2dafba59..d10831dd 100644 --- a/roles/matrix-postgres/tasks/import_synapse_sqlite_db.yml +++ b/roles/matrix-postgres/tasks/import_synapse_sqlite_db.yml @@ -3,12 +3,12 @@ # Pre-checks - name: Fail if Postgres not enabled - fail: + ansible.builtin.fail: msg: "Postgres via the matrix-postgres role is not enabled (`matrix_postgres_enabled`). Cannot import." when: "not matrix_postgres_enabled|bool" - name: Fail if playbook called incorrectly - fail: + ansible.builtin.fail: msg: "The `server_path_homeserver_db` variable needs to be provided to this playbook, via --extra-vars" when: "server_path_homeserver_db is not defined or server_path_homeserver_db.startswith('<')" @@ -18,7 +18,7 @@ register: result_server_path_homeserver_db_stat - name: Fail if provided SQLite homeserver.db file doesn't exist - fail: + ansible.builtin.fail: msg: "File cannot be found on the server at {{ server_path_homeserver_db }}" when: "not result_server_path_homeserver_db_stat.stat.exists" @@ -26,7 +26,7 @@ # Defaults - name: Set postgres_start_wait_time, if not provided - set_fact: + ansible.builtin.set_fact: postgres_start_wait_time: 15 when: "postgres_start_wait_time|default('') == ''" @@ -34,18 +34,18 @@ # Actual import work - name: Ensure matrix-postgres is stopped - service: + ansible.builtin.service: name: matrix-postgres state: stopped daemon_reload: true - name: Ensure postgres data is wiped out - file: + ansible.builtin.file: path: "{{ matrix_postgres_data_path }}" state: absent - name: Ensure postgres data path exists - file: + ansible.builtin.file: path: "{{ matrix_postgres_data_path }}" state: directory mode: 0700 @@ -53,7 +53,7 @@ group: "{{ matrix_user_groupname }}" - name: Ensure matrix-postgres is started - service: + ansible.builtin.service: name: matrix-postgres state: restarted daemon_reload: true @@ -70,7 +70,7 @@ # Also, some old `docker_container` versions were buggy and would leave containers behind # on failure, which we had to work around to allow retries (by re-running the playbook). - name: Import SQLite database into Postgres - command: | + ansible.builtin.command: | docker run --rm --name=matrix-synapse-migrate diff --git a/roles/matrix-postgres/tasks/init.yml b/roles/matrix-postgres/tasks/init.yml index e5ebd9c5..0a46fa86 100644 --- a/roles/matrix-postgres/tasks/init.yml +++ b/roles/matrix-postgres/tasks/init.yml @@ -1,5 +1,5 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-postgres.service'] }}" when: matrix_postgres_enabled|bool diff --git a/roles/matrix-postgres/tasks/migrate_postgres_data_directory.yml b/roles/matrix-postgres/tasks/migrate_postgres_data_directory.yml index f927783f..4713fcd6 100644 --- a/roles/matrix-postgres/tasks/migrate_postgres_data_directory.yml +++ b/roles/matrix-postgres/tasks/migrate_postgres_data_directory.yml @@ -16,7 +16,7 @@ register: result_pg_old_data_dir_stat - name: Warn if old Postgres data directory detected - debug: + ansible.builtin.debug: msg: > Found that you have Postgres data in `{{ matrix_postgres_base_path }}`. From now on, Postgres data is supposed to be stored in `{{ matrix_postgres_data_path }}` instead. @@ -26,7 +26,7 @@ # We should stop Postgres first, before building a list of files, # as to ignore any `postmaster.pid` files, etc. - name: Ensure matrix-postgres is stopped - service: + ansible.builtin.service: name: matrix-postgres state: stopped daemon_reload: true @@ -41,7 +41,7 @@ when: "result_pg_old_data_dir_stat.stat.exists" - name: Ensure new Postgres data path exists - file: + ansible.builtin.file: path: "{{ matrix_postgres_data_path }}" state: directory mode: 0700 @@ -51,7 +51,7 @@ - block: - name: Relocate Postgres data files from old directory to new - 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" @@ -61,12 +61,12 @@ # and have it initialize a new database. - name: Ensure outdated matrix-postgres.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-postgres.service" state: absent when: "result_pg_old_data_dir_stat.stat.exists" - name: Ensure systemd reloaded after getting rid of outdated matrix-postgres.service - service: + ansible.builtin.service: daemon_reload: true 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 0b7a60f8..f3c59775 100644 --- a/roles/matrix-postgres/tasks/run_vacuum.yml +++ b/roles/matrix-postgres/tasks/run_vacuum.yml @@ -3,7 +3,7 @@ # Pre-checks - name: Fail if Postgres not enabled - fail: + 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" @@ -11,12 +11,12 @@ # Defaults - name: Set postgres_start_wait_time, if not provided - set_fact: + ansible.builtin.set_fact: postgres_start_wait_time: 15 when: "postgres_start_wait_time|default('') == ''" - name: Set postgres_vacuum_wait_time, if not provided - set_fact: + ansible.builtin.set_fact: postgres_vacuum_wait_time: "{{ 7 * 86400 }}" when: "postgres_vacuum_wait_time|default('') == ''" @@ -24,7 +24,7 @@ # Actual vacuuming work - name: Ensure matrix-postgres is started - service: + ansible.builtin.service: name: matrix-postgres state: started daemon_reload: true @@ -38,12 +38,12 @@ - import_tasks: tasks/util/detect_existing_postgres_version.yml - name: Abort, if no existing Postgres version detected - fail: + ansible.builtin.fail: msg: "Could not find existing Postgres installation" when: "not matrix_postgres_detected_existing|bool" - name: Generate Postgres database vacuum command - set_fact: + ansible.builtin.set_fact: matrix_postgres_vacuum_command: >- {{ matrix_host_command_docker }} run --rm --name matrix-postgres-synapse-vacuum --user={{ matrix_user_uid }}:{{ matrix_user_gid }} @@ -54,9 +54,9 @@ psql -v ON_ERROR_STOP=1 -h matrix-postgres {{ matrix_synapse_database_database }} -c 'VACUUM FULL VERBOSE' - name: Note about Postgres vacuum alternative - debug: + ansible.builtin.debug: msg: >- - Running vacuum with the following Postgres command: `{{ matrix_postgres_vacuum_command }}`. + Running vacuum with the following Postgres ansible.builtin.command: `{{ matrix_postgres_vacuum_command }}`. If this crashes, you can stop all processes (`systemctl stop matrix-*`), start Postgres only (`systemctl start matrix-postgres`) and manually run the above command directly on the server. @@ -64,26 +64,26 @@ - name: Populate service facts service_facts: -- set_fact: +- 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' }}" - name: Ensure matrix-synapse is stopped - service: + ansible.builtin.service: name: matrix-synapse state: stopped daemon_reload: true - name: Run Postgres vacuum command - command: "{{ matrix_postgres_vacuum_command }}" + ansible.builtin.command: "{{ matrix_postgres_vacuum_command }}" async: "{{ postgres_vacuum_wait_time }}" poll: 10 register: matrix_postgres_synapse_vacuum_result # Intentionally show the results -- debug: var="matrix_postgres_synapse_vacuum_result" +- ansible.builtin.debug: var="matrix_postgres_synapse_vacuum_result" - name: Ensure matrix-synapse is started, if it previously was - service: + ansible.builtin.service: name: matrix-synapse state: started daemon_reload: true diff --git a/roles/matrix-postgres/tasks/setup_postgres.yml b/roles/matrix-postgres/tasks/setup_postgres.yml index 04763a32..3cdde807 100644 --- a/roles/matrix-postgres/tasks/setup_postgres.yml +++ b/roles/matrix-postgres/tasks/setup_postgres.yml @@ -14,17 +14,17 @@ # If not, we install using the latest Postgres. # # Upgrading is supposed to be performed separately and explicitly (see `upgrade_postgres.yml`). -- set_fact: +- 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 - name: Abort if on an unsupported Postgres version - fail: + 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.')" - name: Inject warning if on an old version of Postgres - set_fact: + ansible.builtin.set_fact: matrix_playbook_runtime_results: | {{ matrix_playbook_runtime_results|default([]) @@ -49,7 +49,7 @@ until: result is not failed - name: Ensure Postgres paths exist - file: + ansible.builtin.file: path: "{{ item }}" state: directory mode: 0700 @@ -64,7 +64,7 @@ # - 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) # - we need to do it without `mode`, or we risk making certain `.conf` and other files's executable bit to flip to true - name: Ensure Postgres data path ownership is correct - file: + ansible.builtin.file: path: "{{ matrix_postgres_data_path }}" state: directory owner: "{{ matrix_user_username }}" @@ -73,7 +73,7 @@ when: matrix_postgres_enabled|bool - name: Ensure Postgres environment variables file created - template: + ansible.builtin.template: src: "{{ role_path }}/templates/{{ item }}.j2" dest: "{{ matrix_postgres_base_path }}/{{ item }}" owner: "{{ matrix_user_username }}" @@ -85,41 +85,41 @@ when: matrix_postgres_enabled|bool - name: Ensure matrix-postgres-cli script created - template: + 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 - name: Ensure matrix-postgres-cli-non-interactive script created - template: + 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 - name: Ensure matrix-change-user-admin-status script created - template: + 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 - name: (Migration) Ensure old matrix-make-user-admin script deleted - file: + ansible.builtin.file: path: "{{ matrix_local_bin_path }}/matrix-make-user-admin" state: absent when: matrix_postgres_enabled|bool - name: Ensure matrix-postgres-update-user-password-hash script created - template: + 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 - name: Ensure matrix-postgres.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-postgres.service.j2" dest: "{{ matrix_systemd_path }}/matrix-postgres.service" mode: 0644 @@ -127,12 +127,12 @@ when: matrix_postgres_enabled|bool - name: Ensure systemd reloaded after matrix-postgres.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_postgres_enabled|bool and matrix_postgres_systemd_service_result.changed" - include_tasks: - file: "{{ role_path }}/tasks/util/create_additional_databases.yml" + ansible.builtin.file: "{{ role_path }}/tasks/util/create_additional_databases.yml" apply: tags: - always @@ -145,7 +145,7 @@ when: "matrix_postgres_enabled|bool" - name: Inject warning if backup data remains - set_fact: + ansible.builtin.set_fact: matrix_playbook_runtime_results: | {{ matrix_playbook_runtime_results|default([]) @@ -168,20 +168,20 @@ when: "not matrix_postgres_enabled|bool" - name: Ensure matrix-postgres is stopped - service: + ansible.builtin.service: name: matrix-postgres state: stopped daemon_reload: true when: "not matrix_postgres_enabled|bool and matrix_postgres_service_stat.stat.exists" - name: Ensure matrix-postgres.service doesn't exist - file: + 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" - name: Ensure systemd reloaded after matrix-postgres.service removal - service: + ansible.builtin.service: daemon_reload: true when: "not matrix_postgres_enabled|bool and matrix_postgres_service_stat.stat.exists" @@ -193,7 +193,7 @@ # We just want to notify the user. Deleting data is too destructive. - name: Inject warning if matrix-postgres local data remains - set_fact: + ansible.builtin.set_fact: matrix_playbook_runtime_results: | {{ matrix_playbook_runtime_results|default([]) @@ -205,7 +205,7 @@ when: "not matrix_postgres_enabled|bool and matrix_postgres_data_path_stat.stat.exists" - name: Remove Postgres scripts - file: + ansible.builtin.file: path: "{{ matrix_local_bin_path }}/{{ item }}" state: absent with_items: diff --git a/roles/matrix-postgres/tasks/upgrade_postgres.yml b/roles/matrix-postgres/tasks/upgrade_postgres.yml index bf98d938..012f292d 100644 --- a/roles/matrix-postgres/tasks/upgrade_postgres.yml +++ b/roles/matrix-postgres/tasks/upgrade_postgres.yml @@ -1,32 +1,32 @@ --- - name: Set default postgres_dump_dir, if not provided - set_fact: + ansible.builtin.set_fact: postgres_dump_dir: "/tmp" when: "postgres_dump_dir|default('') == ''" - name: Set postgres_dump_name, if not provided - set_fact: + ansible.builtin.set_fact: postgres_dump_name: "matrix-postgres-dump.sql.gz" when: "postgres_dump_name|default('') == ''" - name: Set postgres_auto_upgrade_backup_data_path, if not provided - set_fact: + 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('') == ''" - name: Set postgres_start_wait_time, if not provided - set_fact: + ansible.builtin.set_fact: postgres_start_wait_time: 15 when: "postgres_start_wait_time|default('') == ''" - name: Set postgres_force_upgrade, if not provided - set_fact: + ansible.builtin.set_fact: postgres_force_upgrade: false when: "postgres_force_upgrade|default('') == ''" - name: Fail, if trying to upgrade external Postgres database - fail: + 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" @@ -36,32 +36,32 @@ register: result_auto_upgrade_path - name: Abort, if existing Postgres auto-upgrade data path detected - fail: + ansible.builtin.fail: 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 - name: Abort, if no existing Postgres version detected - fail: + ansible.builtin.fail: msg: "Could not find existing Postgres installation" when: "not matrix_postgres_detected_existing|bool" - name: Abort, if already at latest Postgres version - fail: + ansible.builtin.fail: msg: "You are already running the latest Postgres version supported ({{ matrix_postgres_docker_image_latest }}). Nothing to do" when: "matrix_postgres_detected_version_corresponding_docker_image == matrix_postgres_docker_image_latest and not postgres_force_upgrade" -- debug: +- ansible.builtin.debug: msg: "Upgrading database from {{ matrix_postgres_detected_version_corresponding_docker_image }} to {{ matrix_postgres_docker_image_latest }}" - name: Ensure matrix-synapse is stopped - service: + ansible.builtin.service: name: matrix-synapse state: stopped - name: Ensure matrix-postgres is started - service: + ansible.builtin.service: name: matrix-postgres state: started daemon_reload: true @@ -78,7 +78,7 @@ # role (`matrix_postgres_connection_username`) and database (`matrix_postgres_db_name`) by itself on startup, # we need to remove these from the dump, or we'll get errors saying these already exist. - name: Perform Postgres database dump - command: >- + ansible.builtin.command: >- {{ matrix_host_command_docker }} run --rm --name matrix-postgres-dump --log-driver=none --user={{ matrix_user_uid }}:{{ matrix_user_gid }} @@ -92,20 +92,20 @@ > /out/{{ postgres_dump_name }}" - name: Ensure matrix-postgres is stopped - service: + ansible.builtin.service: name: matrix-postgres state: stopped - name: Rename existing Postgres data directory - command: "mv {{ matrix_postgres_data_path }} {{ postgres_auto_upgrade_backup_data_path }}" + ansible.builtin.command: "mv {{ matrix_postgres_data_path }} {{ postgres_auto_upgrade_backup_data_path }}" -- debug: +- 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 - name: Ensure matrix-postgres autoruns and is restarted - service: + ansible.builtin.service: name: matrix-postgres enabled: true state: restarted @@ -122,7 +122,7 @@ # The dump most likely contains those same entries and would try to re-create them, leading to errors. # We need to skip over those lines. - name: Generate Postgres database import command - set_fact: + ansible.builtin.set_fact: matrix_postgres_import_command: >- {{ matrix_host_command_docker }} run --rm --name matrix-postgres-import --log-driver=none @@ -145,7 +145,7 @@ # We want to run `debug: msg=".."`, but that dumps it as JSON and escapes double quotes within it, # which ruins the command (`matrix_postgres_import_command`) - name: Note about Postgres importing - set_fact: + ansible.builtin.set_fact: dummy: true with_items: - >- @@ -155,18 +155,18 @@ and restore the automatically-made backup (`mv {{ postgres_auto_upgrade_backup_data_path }} {{ matrix_postgres_data_path }}`). - name: Perform Postgres database import - command: "{{ matrix_postgres_import_command }}" + ansible.builtin.command: "{{ matrix_postgres_import_command }}" - name: Delete Postgres database dump file - file: + ansible.builtin.file: path: "{{ postgres_dump_dir }}/{{ postgres_dump_name }}" state: absent - name: Ensure matrix-synapse is started - service: + ansible.builtin.service: name: matrix-synapse state: started daemon_reload: true -- debug: +- ansible.builtin.debug: msg: "NOTE: Your old Postgres data directory is preserved at `{{ postgres_auto_upgrade_backup_data_path }}`. You might want to get rid of it once you've confirmed that all is well." diff --git a/roles/matrix-postgres/tasks/util/create_additional_database.yml b/roles/matrix-postgres/tasks/util/create_additional_database.yml index 22b3c9a2..b4fee2c8 100644 --- a/roles/matrix-postgres/tasks/util/create_additional_database.yml +++ b/roles/matrix-postgres/tasks/util/create_additional_database.yml @@ -3,7 +3,7 @@ # It'd be better if this is belonged to `validate_config.yml`, but it would have to be some loop-within-a-loop there, # and that's ugly. We also don't expect this to catch errors often. It's more of a defensive last-minute check. - name: Fail if additional database data appears invalid - fail: + ansible.builtin.fail: msg: "Additional database definition ({{ additional_db }} lacks a required key: {{ item }}" when: "item not in additional_db" with_items: "{{ ['name', 'username', 'password'] }}" @@ -12,7 +12,7 @@ # This file will be mounted into the container and fed to Postgres. # This way, we avoid passing sensitive data around in CLI commands that other users on the system can see. - name: Create additional database initialization SQL file for {{ additional_db.name }} - template: + ansible.builtin.template: src: "{{ role_path }}/templates/sql/init-additional-db-user-and-role.sql.j2" dest: "/tmp/matrix-postgres-init-additional-db-user-and-role.sql" mode: 0600 @@ -20,7 +20,7 @@ group: "{{ matrix_user_gid }}" - name: Execute Postgres additional database initialization SQL file for {{ additional_db.name }} - command: + ansible.builtin.command: cmd: >- {{ matrix_host_command_docker }} run --rm @@ -35,6 +35,6 @@ 'psql -h {{ matrix_postgres_connection_hostname }} --file=/matrix-postgres-init-additional-db-user-and-role.sql' - name: Delete additional database initialization SQL file for {{ additional_db.name }} - file: + ansible.builtin.file: path: /tmp/matrix-postgres-init-additional-db-user-and-role.sql state: absent diff --git a/roles/matrix-postgres/tasks/util/create_additional_databases.yml b/roles/matrix-postgres/tasks/util/create_additional_databases.yml index de87f98c..c1b5cd51 100644 --- a/roles/matrix-postgres/tasks/util/create_additional_databases.yml +++ b/roles/matrix-postgres/tasks/util/create_additional_databases.yml @@ -1,7 +1,7 @@ --- - name: Ensure matrix-postgres is started - service: + ansible.builtin.service: name: matrix-postgres state: started daemon_reload: true 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 a7e94a0c..932ca336 100644 --- a/roles/matrix-postgres/tasks/util/detect_existing_postgres_version.yml +++ b/roles/matrix-postgres/tasks/util/detect_existing_postgres_version.yml @@ -4,7 +4,7 @@ # If there is, it also tries to detect the Docker image that corresponds to that version. - name: Initialize Postgres version determination variables (default to empty) - set_fact: + ansible.builtin.set_fact: matrix_postgres_detection_pg_version_path: "{{ matrix_postgres_data_path }}/PG_VERSION" matrix_postgres_detected_existing: false matrix_postgres_detected_version: "" @@ -15,47 +15,47 @@ path: "{{ matrix_postgres_detection_pg_version_path }}" register: result_pg_version_stat -- set_fact: +- ansible.builtin.set_fact: matrix_postgres_detected_existing: true when: "result_pg_version_stat.stat.exists" - name: Determine existing Postgres version (read PG_VERSION file) - slurp: + ansible.builtin.slurp: src: "{{ matrix_postgres_detection_pg_version_path }}" register: result_pg_version when: matrix_postgres_detected_existing|bool - name: Determine existing Postgres version (make sense of PG_VERSION file) - set_fact: + ansible.builtin.set_fact: matrix_postgres_detected_version: "{{ result_pg_version['content']|b64decode|replace('\n', '') }}" when: matrix_postgres_detected_existing|bool - name: Determine corresponding Docker image to detected version (assume default of latest) - set_fact: + ansible.builtin.set_fact: matrix_postgres_detected_version_corresponding_docker_image: "{{ matrix_postgres_docker_image_latest }}" when: "matrix_postgres_detected_version != ''" - name: Determine corresponding Docker image to detected version (use 9.x, if detected) - set_fact: + ansible.builtin.set_fact: matrix_postgres_detected_version_corresponding_docker_image: "{{ matrix_postgres_docker_image_v9 }}" when: "matrix_postgres_detected_version.startswith('9.')" - name: Determine corresponding Docker image to detected version (use 10.x, if detected) - set_fact: + ansible.builtin.set_fact: matrix_postgres_detected_version_corresponding_docker_image: "{{ matrix_postgres_docker_image_v10 }}" when: "matrix_postgres_detected_version == '10' or matrix_postgres_detected_version.startswith('10.')" - name: Determine corresponding Docker image to detected version (use 11.x, if detected) - set_fact: + ansible.builtin.set_fact: matrix_postgres_detected_version_corresponding_docker_image: "{{ matrix_postgres_docker_image_v11 }}" when: "matrix_postgres_detected_version == '11' or matrix_postgres_detected_version.startswith('11.')" - name: Determine corresponding Docker image to detected version (use 12.x, if detected) - set_fact: + ansible.builtin.set_fact: matrix_postgres_detected_version_corresponding_docker_image: "{{ matrix_postgres_docker_image_v12 }}" when: "matrix_postgres_detected_version == '12' or matrix_postgres_detected_version.startswith('12.')" - name: Determine corresponding Docker image to detected version (use 13.x, if detected) - set_fact: + ansible.builtin.set_fact: matrix_postgres_detected_version_corresponding_docker_image: "{{ matrix_postgres_docker_image_v13 }}" when: "matrix_postgres_detected_version == '13' or matrix_postgres_detected_version.startswith('13.')" 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 90f73dba..7b1fb6aa 100644 --- a/roles/matrix-postgres/tasks/util/migrate_db_to_postgres.yml +++ b/roles/matrix-postgres/tasks/util/migrate_db_to_postgres.yml @@ -1,17 +1,17 @@ --- - name: Fail if Postgres not enabled - fail: + ansible.builtin.fail: msg: "Postgres via the matrix-postgres role is not enabled (`matrix_postgres_enabled`). Cannot migrate." when: "not matrix_postgres_enabled|bool" - name: Fail if util called incorrectly (missing matrix_postgres_db_migration_request) - fail: + ansible.builtin.fail: msg: "The `matrix_postgres_db_migration_request` variable needs to be provided to this util." when: "matrix_postgres_db_migration_request is not defined" - name: Fail if util called incorrectly (invalid matrix_postgres_db_migration_request) - fail: + ansible.builtin.fail: msg: "The `matrix_postgres_db_migration_request` variable needs to contain `{{ item }}`." with_items: - src @@ -27,13 +27,13 @@ register: matrix_postgres_db_migration_request_src_stat_result - name: Fail if provided source database file doesn't exist - fail: + ansible.builtin.fail: msg: "File cannot be found on the server at {{ matrix_postgres_db_migration_request.src }}" when: "not matrix_postgres_db_migration_request_src_stat_result.stat.exists" - block: - name: Ensure pgloader repository is present on self-build - git: + ansible.builtin.git: repo: "{{ matrix_postgres_pgloader_container_image_self_build_repo }}" dest: "{{ matrix_postgres_pgloader_container_image_self_build_src_path }}" version: "{{ matrix_postgres_pgloader_container_image_self_build_repo_branch }}" @@ -49,7 +49,7 @@ # # Although we're not using the dimitri/pgloader image, the one we're using suffers from the same problem. - name: Switch pgloader base image from Debian stable (likely 10.x/Buster) to Bullseye - lineinfile: + ansible.builtin.lineinfile: path: "{{ matrix_postgres_pgloader_container_image_self_build_src_path }}/Dockerfile" regexp: "{{ item.match }}" line: "{{ item.replace }}" @@ -82,7 +82,7 @@ # Defaults - name: Set postgres_start_wait_time, if not provided - set_fact: + ansible.builtin.set_fact: postgres_start_wait_time: 15 when: "postgres_start_wait_time|default('') == ''" @@ -90,7 +90,7 @@ # matrix-postgres is most likely started already - name: Ensure matrix-postgres is started - service: + ansible.builtin.service: name: matrix-postgres state: started daemon_reload: true @@ -112,14 +112,14 @@ # However, we don't do it, because it's simpler having it here, and it also gets to happen only if we'll be doing an import. # If we bailed out (somewhere above), nothing would have gotten stopped. It's nice to leave this running in such cases. - name: Ensure systemd services blocking the database import are stopped - service: + ansible.builtin.service: name: "{{ item }}" state: stopped failed_when: false with_items: "{{ matrix_postgres_db_migration_request.systemd_services_to_stop }}" - name: Import {{ matrix_postgres_db_migration_request.engine_old }} database from {{ matrix_postgres_db_migration_request.src }} into Postgres - command: + ansible.builtin.command: cmd: >- {{ matrix_host_command_docker }} run --rm @@ -137,11 +137,11 @@ # 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" - - set_fact: + - 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 }}" - name: Execute additional Postgres SQL migration statements - command: + ansible.builtin.command: cmd: >- {{ matrix_host_command_docker }} run --rm @@ -156,11 +156,11 @@ 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) - command: + ansible.builtin.command: cmd: "mv {{ matrix_postgres_db_migration_request.src }} {{ matrix_postgres_db_migration_request.src }}.backup" - name: Inject result - set_fact: + ansible.builtin.set_fact: matrix_playbook_runtime_results: | {{ matrix_playbook_runtime_results|default([]) diff --git a/roles/matrix-postgres/tasks/validate_config.yml b/roles/matrix-postgres/tasks/validate_config.yml index eac4dd5b..f239b116 100644 --- a/roles/matrix-postgres/tasks/validate_config.yml +++ b/roles/matrix-postgres/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: (Deprecation) Warn about matrix_postgres_use_external usage - fail: + ansible.builtin.fail: msg: > The `matrix_postgres_use_external` variable defined in your configuration is not used by this playbook anymore! You'll need to adapt to the new way of using an external Postgres server. @@ -13,7 +13,7 @@ # This is separate (from the other required variables below), # because we'd like to have a friendlier message for our existing users. - name: Fail if matrix_postgres_connection_password not defined - fail: + ansible.builtin.fail: msg: >- The playbook no longer has a default Postgres password defined in the `matrix_postgres_connection_password` variable, among lots of other Postgres changes. You need to perform multiple manual steps to resolve this. @@ -22,7 +22,7 @@ when: "matrix_postgres_connection_password == ''" - name: Fail if required Postgres settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). when: "vars[item] == ''" @@ -34,6 +34,6 @@ - "matrix_postgres_db_name" - name: Fail if Postgres password length exceeded - fail: + ansible.builtin.fail: msg: "The maximum `matrix_postgres_connection_password` length is 99 characters" when: "matrix_postgres_connection_password|length > 99" diff --git a/roles/matrix-prometheus-node-exporter/tasks/init.yml b/roles/matrix-prometheus-node-exporter/tasks/init.yml index d08340a8..4e53b0c3 100644 --- a/roles/matrix-prometheus-node-exporter/tasks/init.yml +++ b/roles/matrix-prometheus-node-exporter/tasks/init.yml @@ -1,12 +1,12 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-prometheus-node-exporter.service'] }}" when: matrix_prometheus_node_exporter_enabled|bool - block: - name: Fail if matrix-nginx-proxy role already executed - fail: + ansible.builtin.fail: msg: >- Trying to append node-exporter's reverse-proxying configuration to matrix-nginx-proxy, but it's pointless since the matrix-nginx-proxy role had already executed. @@ -15,7 +15,7 @@ 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) - set_fact: + ansible.builtin.set_fact: matrix_prometheus_node_exporter_nginx_metrics_configuration_block: | location /metrics/node-exporter { {% if matrix_nginx_proxy_enabled|default(False) %} @@ -31,7 +31,7 @@ } - name: Register node-exporter metrics proxying configuration with matrix-nginx-proxy (matrix.DOMAIN/metrics/node-exporter) - set_fact: + 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([]) diff --git a/roles/matrix-prometheus-node-exporter/tasks/setup.yml b/roles/matrix-prometheus-node-exporter/tasks/setup.yml index 21d0b55d..ee2c1835 100644 --- a/roles/matrix-prometheus-node-exporter/tasks/setup.yml +++ b/roles/matrix-prometheus-node-exporter/tasks/setup.yml @@ -17,7 +17,7 @@ until: result is not failed - name: Ensure matrix-prometheus-node-exporter.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-prometheus-node-exporter.service.j2" dest: "{{ matrix_systemd_path }}/matrix-prometheus-node-exporter.service" mode: 0644 @@ -25,7 +25,7 @@ when: matrix_prometheus_node_exporter_enabled|bool - name: Ensure systemd reloaded after matrix-prometheus.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_prometheus_node_exporter_enabled|bool and matrix_prometheus_node_exporter_systemd_service_result.changed" @@ -39,7 +39,7 @@ register: matrix_prometheus_node_exporter_service_stat - name: Ensure matrix-prometheus-node-exporter is stopped - service: + ansible.builtin.service: name: matrix-prometheus-node-exporter state: stopped enabled: false @@ -48,12 +48,12 @@ 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 - file: + 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" - name: Ensure systemd reloaded after matrix-prometheus-node-exporter.service removal - service: + ansible.builtin.service: daemon_reload: true 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 996cc975..3c7b5b01 100644 --- a/roles/matrix-prometheus-postgres-exporter/tasks/init.yml +++ b/roles/matrix-prometheus-postgres-exporter/tasks/init.yml @@ -1,12 +1,12 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-prometheus-postgres-exporter.service'] }}" when: matrix_prometheus_postgres_exporter_enabled|bool - block: - name: Fail if matrix-nginx-proxy role already executed - fail: + ansible.builtin.fail: msg: >- Trying to append postgres-exporter's reverse-proxying configuration to matrix-nginx-proxy, but it's pointless since the matrix-nginx-proxy role had already executed. @@ -15,7 +15,7 @@ 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) - set_fact: + ansible.builtin.set_fact: matrix_prometheus_postgres_exporter_nginx_metrics_configuration_block: | location /metrics/postgres-exporter { {% if matrix_nginx_proxy_enabled|default(False) %} @@ -31,7 +31,7 @@ } - name: Register postgres-exporter metrics proxying configuration with matrix-nginx-proxy (matrix.DOMAIN/metrics/postgres-exporter) - set_fact: + 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([]) diff --git a/roles/matrix-prometheus-postgres-exporter/tasks/setup.yml b/roles/matrix-prometheus-postgres-exporter/tasks/setup.yml index 08ffe708..2c263eb2 100644 --- a/roles/matrix-prometheus-postgres-exporter/tasks/setup.yml +++ b/roles/matrix-prometheus-postgres-exporter/tasks/setup.yml @@ -17,7 +17,7 @@ until: result is not failed - name: Ensure matrix-prometheus-postgres-exporter.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-prometheus-postgres-exporter.service.j2" dest: "{{ matrix_systemd_path }}/matrix-prometheus-postgres-exporter.service" mode: 0644 @@ -25,7 +25,7 @@ when: matrix_prometheus_postgres_exporter_enabled|bool - name: Ensure systemd reloaded after matrix-prometheus.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_prometheus_postgres_exporter_enabled|bool and matrix_prometheus_postgres_exporter_systemd_service_result.changed" @@ -39,7 +39,7 @@ register: matrix_prometheus_postgres_exporter_service_stat - name: Ensure matrix-prometheus-postgres-exporter is stopped - service: + ansible.builtin.service: name: matrix-prometheus-postgres-exporter state: stopped enabled: false @@ -48,12 +48,12 @@ 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 - file: + 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" - name: Ensure systemd reloaded after matrix-prometheus-postgres-exporter.service removal - service: + ansible.builtin.service: daemon_reload: true when: "not matrix_prometheus_postgres_exporter_enabled|bool and matrix_prometheus_postgres_exporter_service_stat.stat.exists" diff --git a/roles/matrix-prometheus/tasks/init.yml b/roles/matrix-prometheus/tasks/init.yml index 6587ddd9..946410e3 100644 --- a/roles/matrix-prometheus/tasks/init.yml +++ b/roles/matrix-prometheus/tasks/init.yml @@ -1,5 +1,5 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-prometheus.service'] }}" when: matrix_prometheus_enabled|bool diff --git a/roles/matrix-prometheus/tasks/setup_install.yml b/roles/matrix-prometheus/tasks/setup_install.yml index 06989e7e..ad2b94aa 100644 --- a/roles/matrix-prometheus/tasks/setup_install.yml +++ b/roles/matrix-prometheus/tasks/setup_install.yml @@ -12,7 +12,7 @@ until: result is not failed - name: Ensure Prometheus paths exists - file: + ansible.builtin.file: path: "{{ item }}" state: directory mode: 0750 @@ -24,7 +24,7 @@ - "{{ matrix_prometheus_data_path }}" - name: Download synapse-v2.rules - get_url: + ansible.builtin.get_url: url: "{{ matrix_prometheus_scraper_synapse_rules_download_url }}" dest: "{{ matrix_prometheus_config_path }}/synapse-v2.rules" force: true @@ -38,7 +38,7 @@ until: result is not failed - name: Ensure prometheus.yml installed - copy: + ansible.builtin.copy: content: "{{ matrix_prometheus_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_prometheus_config_path }}/prometheus.yml" mode: 0644 @@ -46,13 +46,13 @@ group: "{{ matrix_user_groupname }}" - name: Ensure matrix-prometheus.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-prometheus.service.j2" dest: "{{ matrix_systemd_path }}/matrix-prometheus.service" mode: 0644 register: matrix_prometheus_systemd_service_result - name: Ensure systemd reloaded after matrix-prometheus.service installation - service: + ansible.builtin.service: daemon_reload: true 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 c9f07f52..f1a62481 100644 --- a/roles/matrix-prometheus/tasks/setup_uninstall.yml +++ b/roles/matrix-prometheus/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_prometheus_service_stat - name: Ensure matrix-prometheus is stopped - service: + ansible.builtin.service: name: matrix-prometheus state: stopped enabled: false @@ -15,12 +15,12 @@ when: "matrix_prometheus_service_stat.stat.exists|bool" - name: Ensure matrix-prometheus.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-prometheus.service" state: absent when: "matrix_prometheus_service_stat.stat.exists|bool" - name: Ensure systemd reloaded after matrix-prometheus.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_prometheus_service_stat.stat.exists|bool" diff --git a/roles/matrix-prometheus/tasks/validate_config.yml b/roles/matrix-prometheus/tasks/validate_config.yml index 9fcfe12b..3e386304 100644 --- a/roles/matrix-prometheus/tasks/validate_config.yml +++ b/roles/matrix-prometheus/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if Synapse metrics or Prometheus Node Exporter not enabled - fail: + ansible.builtin.fail: msg: > You need to enable `matrix_prometheus_scraper_synapse_enabled` and/or `matrix_prometheus_scraper_node_enabled` for Prometheus grab metrics. when: "not matrix_prometheus_scraper_synapse_enabled and not matrix_prometheus_scraper_node_enabled" diff --git a/roles/matrix-redis/tasks/init.yml b/roles/matrix-redis/tasks/init.yml index 99c52026..08d7ec5a 100644 --- a/roles/matrix-redis/tasks/init.yml +++ b/roles/matrix-redis/tasks/init.yml @@ -1,5 +1,5 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-redis'] }}" when: matrix_redis_enabled|bool diff --git a/roles/matrix-redis/tasks/setup_redis.yml b/roles/matrix-redis/tasks/setup_redis.yml index df1d1736..7ff55552 100644 --- a/roles/matrix-redis/tasks/setup_redis.yml +++ b/roles/matrix-redis/tasks/setup_redis.yml @@ -17,7 +17,7 @@ until: result is not failed - name: Ensure redis paths exist - file: + ansible.builtin.file: path: "{{ item }}" state: directory mode: 0700 @@ -32,7 +32,7 @@ # - 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) # - we need to do it without `mode`, or we risk making certain `.conf` and other files's executable bit to flip to true - name: Ensure redis data path ownership is correct - file: + ansible.builtin.file: path: "{{ matrix_redis_data_path }}" state: directory owner: "{{ matrix_user_username }}" @@ -41,7 +41,7 @@ when: matrix_redis_enabled|bool - name: Ensure redis environment variables file created - template: + ansible.builtin.template: src: "{{ role_path }}/templates/{{ item }}.j2" dest: "{{ matrix_redis_base_path }}/{{ item }}" mode: 0644 @@ -50,7 +50,7 @@ when: matrix_redis_enabled|bool - name: Ensure matrix-redis.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-redis.service.j2" dest: "{{ matrix_systemd_path }}/matrix-redis.service" mode: 0644 @@ -58,7 +58,7 @@ when: matrix_redis_enabled|bool - name: Ensure systemd reloaded after matrix-redis.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_redis_enabled|bool and matrix_redis_systemd_service_result.changed" @@ -73,7 +73,7 @@ when: "not matrix_redis_enabled|bool" - name: Ensure matrix-redis is stopped - service: + ansible.builtin.service: name: matrix-redis state: stopped enabled: false @@ -81,13 +81,13 @@ when: "not matrix_redis_enabled|bool and matrix_redis_service_stat.stat.exists" - name: Ensure matrix-redis.service doesn't exist - file: + 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" - name: Ensure systemd reloaded after matrix-redis.service removal - service: + ansible.builtin.service: daemon_reload: true when: "not matrix_redis_enabled|bool and matrix_redis_service_stat.stat.exists" @@ -99,6 +99,6 @@ # We just want to notify the user. Deleting data is too destructive. - name: Notify if matrix-redis local data remains - debug: + 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" diff --git a/roles/matrix-registration/tasks/generate_token.yml b/roles/matrix-registration/tasks/generate_token.yml index 4e337b01..4b01957c 100644 --- a/roles/matrix-registration/tasks/generate_token.yml +++ b/roles/matrix-registration/tasks/generate_token.yml @@ -1,17 +1,17 @@ --- - name: Fail if playbook called incorrectly - fail: + ansible.builtin.fail: msg: "The `one_time` variable needs to be provided to this playbook, via --extra-vars" when: "one_time is not defined or one_time not in ['yes', 'no']" - name: Fail if playbook called incorrectly - fail: + ansible.builtin.fail: msg: "The `ex_date` variable (expiration date) needs to be provided to this playbook, via --extra-vars" when: "ex_date is not defined or ex_date == ''" - name: Call matrix-registration token creation API - uri: + ansible.builtin.uri: url: "{{ matrix_registration_api_token_endpoint }}" follow_redirects: none validate_certs: "{{ matrix_registration_api_validate_certs }}" @@ -28,7 +28,7 @@ check_mode: false register: matrix_registration_api_result -- set_fact: +- ansible.builtin.set_fact: matrix_registration_api_result_message: >- matrix-registration result: @@ -42,7 +42,7 @@ check_mode: false - name: Inject result message into matrix_playbook_runtime_results - set_fact: + ansible.builtin.set_fact: matrix_playbook_runtime_results: | {{ matrix_playbook_runtime_results|default([]) diff --git a/roles/matrix-registration/tasks/init.yml b/roles/matrix-registration/tasks/init.yml index 44a887d1..5267f2b2 100644 --- a/roles/matrix-registration/tasks/init.yml +++ b/roles/matrix-registration/tasks/init.yml @@ -2,17 +2,17 @@ # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 - name: Fail if trying to self-build on Ansible < 2.8 - fail: + 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_registration_container_image_self_build and matrix_registration_enabled" -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-registration.service'] }}" when: matrix_registration_enabled|bool - block: - name: Fail if matrix-nginx-proxy role already executed - fail: + ansible.builtin.fail: msg: >- Trying to append matrix-registration's reverse-proxying configuration to matrix-nginx-proxy, but it's pointless since the matrix-nginx-proxy role had already executed. @@ -21,7 +21,7 @@ when: matrix_nginx_proxy_role_executed|default(False)|bool - name: Generate matrix-registration proxying configuration for matrix-nginx-proxy - set_fact: + ansible.builtin.set_fact: matrix_registration_matrix_nginx_proxy_configuration: | rewrite ^{{ matrix_registration_public_endpoint }}$ {{ matrix_nginx_proxy_x_forwarded_proto_value }}://$server_name{{ matrix_registration_public_endpoint }}/ permanent; rewrite ^{{ matrix_registration_public_endpoint }}/$ {{ matrix_nginx_proxy_x_forwarded_proto_value }}://$server_name{{ matrix_registration_public_endpoint }}/register redirect; @@ -47,7 +47,7 @@ } - name: Register matrix-registration proxying configuration with matrix-nginx-proxy - set_fact: + ansible.builtin.set_fact: matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: | {{ matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([]) @@ -59,7 +59,7 @@ when: matrix_registration_enabled|bool - name: Warn about reverse-proxying if matrix-nginx-proxy not used - debug: + ansible.builtin.debug: msg: >- NOTE: You've enabled the matrix-registration tool but are not using the matrix-nginx-proxy reverse proxy. diff --git a/roles/matrix-registration/tasks/list_tokens.yml b/roles/matrix-registration/tasks/list_tokens.yml index 9ef40d27..d83d2976 100644 --- a/roles/matrix-registration/tasks/list_tokens.yml +++ b/roles/matrix-registration/tasks/list_tokens.yml @@ -1,7 +1,7 @@ --- - name: Call matrix-registration list all tokens API - uri: + ansible.builtin.uri: url: "{{ matrix_registration_api_token_endpoint }}" follow_redirects: none validate_certs: "{{ matrix_registration_api_validate_certs }}" @@ -13,7 +13,7 @@ check_mode: false register: matrix_registration_api_result -- set_fact: +- ansible.builtin.set_fact: matrix_registration_api_result_message: >- matrix-registration result: @@ -21,7 +21,7 @@ check_mode: false - name: Inject result message into matrix_playbook_runtime_results - set_fact: + ansible.builtin.set_fact: matrix_playbook_runtime_results: | {{ matrix_playbook_runtime_results|default([]) diff --git a/roles/matrix-registration/tasks/setup_install.yml b/roles/matrix-registration/tasks/setup_install.yml index 36cd0fd4..3a8e71e7 100644 --- a/roles/matrix-registration/tasks/setup_install.yml +++ b/roles/matrix-registration/tasks/setup_install.yml @@ -1,6 +1,6 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_registration_requires_restart: false - block: @@ -10,7 +10,7 @@ register: matrix_registration_sqlite_database_path_local_stat_result - block: - - set_fact: + - ansible.builtin.set_fact: matrix_postgres_db_migration_request: src: "{{ matrix_registration_sqlite_database_path_local }}" dst: "{{ matrix_registration_database_connection_string }}" @@ -26,13 +26,13 @@ - import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" - - set_fact: + - ansible.builtin.set_fact: matrix_registration_requires_restart: true when: "matrix_registration_sqlite_database_path_local_stat_result.stat.exists|bool" when: "matrix_registration_database_engine == 'postgres'" - name: Ensure matrix-registration paths exist - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 @@ -58,7 +58,7 @@ until: result is not failed - name: Ensure matrix-registration repository is present when self-building - git: + ansible.builtin.git: repo: "{{ matrix_registration_container_image_self_build_repo }}" dest: "{{ matrix_registration_docker_src_files_path }}" version: "{{ matrix_registration_container_image_self_build_branch }}" @@ -70,7 +70,7 @@ # See: https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1864 - name: Patch setup.py to allow self-built version to work - lineinfile: + ansible.builtin.lineinfile: path: "{{ matrix_registration_docker_src_files_path }}/setup.py" regexp: 'flask-limiter' line: '"flask-limiter~=1.1.0", "Markupsafe<2.1",' @@ -89,7 +89,7 @@ when: "matrix_registration_container_image_self_build|bool" - name: Ensure matrix-registration config installed - copy: + ansible.builtin.copy: content: "{{ matrix_registration_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_registration_config_path }}/config.yaml" mode: 0644 @@ -97,19 +97,19 @@ group: "{{ matrix_user_groupname }}" - name: Ensure matrix-registration.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-registration.service.j2" dest: "{{ matrix_systemd_path }}/matrix-registration.service" mode: 0644 register: matrix_registration_systemd_service_result - name: Ensure systemd reloaded after matrix-registration.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_registration_systemd_service_result.changed|bool" - name: Ensure matrix-registration.service restarted, if necessary - service: + ansible.builtin.service: name: "matrix-registration.service" state: restarted 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 4b7c195f..54f5483b 100644 --- a/roles/matrix-registration/tasks/setup_uninstall.yml +++ b/roles/matrix-registration/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_registration_service_stat - name: Ensure matrix-registration is stopped - service: + ansible.builtin.service: name: matrix-registration state: stopped enabled: false @@ -15,13 +15,13 @@ when: "matrix_registration_service_stat.stat.exists|bool" - name: Ensure matrix-registration.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-registration.service" state: absent when: "matrix_registration_service_stat.stat.exists|bool" - name: Ensure systemd reloaded after matrix-registration.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_registration_service_stat.stat.exists|bool" diff --git a/roles/matrix-registration/tasks/validate_config.yml b/roles/matrix-registration/tasks/validate_config.yml index 90466b46..eb140d31 100644 --- a/roles/matrix-registration/tasks/validate_config.yml +++ b/roles/matrix-registration/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required matrix-registration settings not defined - fail: + ansible.builtin.fail: msg: > You need to define a required configuration setting (`{{ item }}`) for using matrix-registration. when: "vars[item] == ''" @@ -11,7 +11,7 @@ - "matrix_registration_server_location" - name: (Deprecation) Catch and report renamed settings - fail: + ansible.builtin.fail: msg: >- Your configuration contains a variable, which now has a different name. Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`). diff --git a/roles/matrix-sygnal/tasks/init.yml b/roles/matrix-sygnal/tasks/init.yml index efa17a4d..1543435c 100644 --- a/roles/matrix-sygnal/tasks/init.yml +++ b/roles/matrix-sygnal/tasks/init.yml @@ -1,5 +1,5 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-sygnal.service'] }}" when: matrix_sygnal_enabled|bool diff --git a/roles/matrix-sygnal/tasks/setup_install.yml b/roles/matrix-sygnal/tasks/setup_install.yml index 1a6ce186..26b59d99 100644 --- a/roles/matrix-sygnal/tasks/setup_install.yml +++ b/roles/matrix-sygnal/tasks/setup_install.yml @@ -12,7 +12,7 @@ until: result is not failed - name: Ensure Sygnal paths exists - file: + ansible.builtin.file: path: "{{ item }}" state: directory mode: 0750 @@ -24,7 +24,7 @@ - "{{ matrix_sygnal_data_path }}" - name: Ensure Sygnal config installed - copy: + ansible.builtin.copy: content: "{{ matrix_sygnal_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_sygnal_config_path }}/sygnal.yaml" mode: 0640 @@ -32,13 +32,13 @@ group: "{{ matrix_user_groupname }}" - name: Ensure matrix-sygnal.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-sygnal.service.j2" dest: "{{ matrix_systemd_path }}/matrix-sygnal.service" mode: 0644 register: matrix_sygnal_systemd_service_result - name: Ensure systemd reloaded after matrix-sygnal.service installation - service: + ansible.builtin.service: daemon_reload: true 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 5a81a1b2..37b7db22 100644 --- a/roles/matrix-sygnal/tasks/setup_uninstall.yml +++ b/roles/matrix-sygnal/tasks/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_sygnal_service_stat - name: Ensure matrix-sygnal is stopped - service: + ansible.builtin.service: name: matrix-sygnal state: stopped enabled: false @@ -15,18 +15,18 @@ when: "matrix_sygnal_service_stat.stat.exists|bool" - name: Ensure matrix-sygnal.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-sygnal.service" state: absent when: "matrix_sygnal_service_stat.stat.exists|bool" - name: Ensure systemd reloaded after matrix-sygnal.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_sygnal_service_stat.stat.exists|bool" - name: Ensure Sygnal base directory doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_sygnal_base_path }}" state: absent diff --git a/roles/matrix-sygnal/tasks/validate_config.yml b/roles/matrix-sygnal/tasks/validate_config.yml index 2121edf4..b2c38010 100644 --- a/roles/matrix-sygnal/tasks/validate_config.yml +++ b/roles/matrix-sygnal/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if no Sygnal apps defined - fail: + ansible.builtin.fail: msg: >- Enabling Sygnal requires that you specify at least one app in `matrix_sygnal_apps` when: "matrix_sygnal_enabled and matrix_sygnal_apps|length == 0" diff --git a/roles/matrix-synapse-admin/tasks/init.yml b/roles/matrix-synapse-admin/tasks/init.yml index de8c0046..e274e186 100644 --- a/roles/matrix-synapse-admin/tasks/init.yml +++ b/roles/matrix-synapse-admin/tasks/init.yml @@ -2,17 +2,17 @@ # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 - name: Fail if trying to self-build on Ansible < 2.8 - fail: + 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_synapse_admin_container_image_self_build and matrix_synapse_admin_enabled" -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-synapse-admin.service'] }}" when: matrix_synapse_admin_enabled|bool - block: - name: Fail if matrix-nginx-proxy role already executed - fail: + ansible.builtin.fail: msg: >- Trying to append Synapse Admin's reverse-proxying configuration to matrix-nginx-proxy, but it's pointless since the matrix-nginx-proxy role had already executed. @@ -21,7 +21,7 @@ when: matrix_nginx_proxy_role_executed|default(False)|bool - name: Generate Synapse Admin proxying configuration for matrix-nginx-proxy - set_fact: + ansible.builtin.set_fact: matrix_synapse_admin_matrix_nginx_proxy_configuration: | rewrite ^{{ matrix_synapse_admin_public_endpoint }}$ {{ matrix_nginx_proxy_x_forwarded_proto_value }}://$server_name{{ matrix_synapse_admin_public_endpoint }}/ permanent; @@ -38,7 +38,7 @@ } - name: Register Synapse Admin proxying configuration with matrix-nginx-proxy - set_fact: + ansible.builtin.set_fact: matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks: | {{ matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks|default([]) @@ -50,7 +50,7 @@ when: matrix_synapse_admin_enabled|bool - name: Warn about reverse-proxying if matrix-nginx-proxy not used - debug: + ansible.builtin.debug: msg: >- NOTE: You've enabled the Synapse Admin tool but are not using the matrix-nginx-proxy reverse proxy. diff --git a/roles/matrix-synapse-admin/tasks/setup.yml b/roles/matrix-synapse-admin/tasks/setup.yml index f83ccdc3..5f117a12 100644 --- a/roles/matrix-synapse-admin/tasks/setup.yml +++ b/roles/matrix-synapse-admin/tasks/setup.yml @@ -17,7 +17,7 @@ until: result is not failed - name: Ensure matrix-synapse-admin repository is present when self-building - git: + ansible.builtin.git: repo: "{{ matrix_synapse_admin_container_image_self_build_repo }}" dest: "{{ matrix_synapse_admin_docker_src_files_path }}" version: "{{ matrix_synapse_admin_docker_image.split(':')[1] }}" @@ -40,7 +40,7 @@ when: "matrix_synapse_admin_enabled|bool and matrix_synapse_admin_container_image_self_build|bool" - name: Ensure matrix-synapse-admin.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-synapse-admin.service.j2" dest: "{{ matrix_systemd_path }}/matrix-synapse-admin.service" mode: 0644 @@ -48,7 +48,7 @@ when: matrix_synapse_admin_enabled|bool - name: Ensure systemd reloaded after matrix-synapse-admin.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_synapse_admin_enabled|bool and matrix_synapse_admin_systemd_service_result.changed" @@ -62,7 +62,7 @@ register: matrix_synapse_admin_service_stat - name: Ensure matrix-synapse-admin is stopped - service: + ansible.builtin.service: name: matrix-synapse-admin state: stopped enabled: false @@ -71,13 +71,13 @@ when: "not matrix_synapse_admin_enabled|bool and matrix_synapse_admin_service_stat.stat.exists" - name: Ensure matrix-synapse-admin.service doesn't exist - file: + 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" - name: Ensure systemd reloaded after matrix-synapse-admin.service removal - service: + ansible.builtin.service: daemon_reload: true when: "not matrix_synapse_admin_enabled|bool and matrix_synapse_admin_service_stat.stat.exists" diff --git a/roles/matrix-synapse-admin/tasks/validate_config.yml b/roles/matrix-synapse-admin/tasks/validate_config.yml index 20a5c170..bf5fe69e 100644 --- a/roles/matrix-synapse-admin/tasks/validate_config.yml +++ b/roles/matrix-synapse-admin/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: (Deprecation) Catch and report renamed settings - fail: + ansible.builtin.fail: msg: >- Your configuration contains a variable, which now has a different name. Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`). 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 cdcdd082..41970cde 100644 --- a/roles/matrix-synapse/tasks/ext/encryption-disabler/setup_install.yml +++ b/roles/matrix-synapse/tasks/ext/encryption-disabler/setup_install.yml @@ -1,7 +1,7 @@ --- - name: Download matrix_encryption_disabler - get_url: + ansible.builtin.get_url: url: "{{ matrix_synapse_ext_encryption_disabler_download_url }}" dest: "{{ matrix_synapse_ext_path }}/matrix_e2ee_filter.py" force: true @@ -13,7 +13,7 @@ delay: "{{ matrix_geturl_retries_delay }}" until: result is not failed -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_modules: | {{ matrix_synapse_modules|default([]) diff --git a/roles/matrix-synapse/tasks/ext/encryption-disabler/setup_uninstall.yml b/roles/matrix-synapse/tasks/ext/encryption-disabler/setup_uninstall.yml index a532464d..c223f6e8 100644 --- a/roles/matrix-synapse/tasks/ext/encryption-disabler/setup_uninstall.yml +++ b/roles/matrix-synapse/tasks/ext/encryption-disabler/setup_uninstall.yml @@ -1,6 +1,6 @@ --- - name: Ensure matrix_encryption_disabler doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_synapse_ext_path }}/matrix_e2ee_filter.py" state: absent diff --git a/roles/matrix-synapse/tasks/ext/ldap-auth/setup.yml b/roles/matrix-synapse/tasks/ext/ldap-auth/setup.yml index b483f688..d5f54db3 100644 --- a/roles/matrix-synapse/tasks/ext/ldap-auth/setup.yml +++ b/roles/matrix-synapse/tasks/ext/ldap-auth/setup.yml @@ -1,6 +1,6 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_password_providers_enabled: true matrix_synapse_additional_loggers: > 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 1d224bc9..4dd122ff 100644 --- a/roles/matrix-synapse/tasks/ext/mjolnir-antispam/setup_install.yml +++ b/roles/matrix-synapse/tasks/ext/mjolnir-antispam/setup_install.yml @@ -1,7 +1,7 @@ --- - name: Ensure git installed (RedHat) - yum: + ansible.builtin.yum: name: - git state: present @@ -9,7 +9,7 @@ when: "ansible_os_family == 'RedHat'" - name: Ensure git installed (Debian) - apt: + ansible.builtin.apt: name: - git state: present @@ -25,14 +25,14 @@ when: "ansible_distribution == 'Archlinux'" - name: Clone mjolnir-antispam git repository - git: + ansible.builtin.git: repo: "{{ matrix_synapse_ext_spam_checker_mjolnir_antispam_git_repository_url }}" version: "{{ matrix_synapse_ext_spam_checker_mjolnir_antispam_git_version }}" dest: "{{ matrix_synapse_ext_path }}/mjolnir" become: true become_user: "{{ matrix_user_username }}" -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_spam_checker: > {{ matrix_synapse_spam_checker diff --git a/roles/matrix-synapse/tasks/ext/mjolnir-antispam/setup_uninstall.yml b/roles/matrix-synapse/tasks/ext/mjolnir-antispam/setup_uninstall.yml index f8439a87..8211d51a 100644 --- a/roles/matrix-synapse/tasks/ext/mjolnir-antispam/setup_uninstall.yml +++ b/roles/matrix-synapse/tasks/ext/mjolnir-antispam/setup_uninstall.yml @@ -1,6 +1,6 @@ --- - name: Ensure mjolnir-antispam doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_synapse_ext_path }}/mjolnir" state: absent 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 22ad318d..685b2922 100644 --- a/roles/matrix-synapse/tasks/ext/rest-auth/setup_install.yml +++ b/roles/matrix-synapse/tasks/ext/rest-auth/setup_install.yml @@ -1,12 +1,12 @@ --- - name: Fail if REST Auth endpoint not configured - fail: + ansible.builtin.fail: msg: "You have enabled the REST Auth password provider, but have not configured its endpoint in the `matrix_synapse_ext_password_provider_rest_auth_endpoint` variable. Consult the documentation." when: "matrix_synapse_ext_password_provider_rest_auth_endpoint == ''" - name: Download matrix-synapse-rest-auth - get_url: + ansible.builtin.get_url: url: "{{ matrix_synapse_ext_password_provider_rest_auth_download_url }}" dest: "{{ matrix_synapse_ext_path }}/rest_auth_provider.py" force: true @@ -18,7 +18,7 @@ delay: "{{ matrix_geturl_retries_delay }}" until: result is not failed -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_password_providers_enabled: true matrix_synapse_container_extra_arguments: > diff --git a/roles/matrix-synapse/tasks/ext/rest-auth/setup_uninstall.yml b/roles/matrix-synapse/tasks/ext/rest-auth/setup_uninstall.yml index be8ad600..d95dd1c7 100644 --- a/roles/matrix-synapse/tasks/ext/rest-auth/setup_uninstall.yml +++ b/roles/matrix-synapse/tasks/ext/rest-auth/setup_uninstall.yml @@ -1,6 +1,6 @@ --- - name: Ensure matrix-synapse-rest-auth doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_synapse_ext_path }}/rest_auth_provider.py" state: absent 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 091b0eb2..f4229538 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 @@ -1,17 +1,17 @@ --- - name: Fail if Shared Secret Auth secret not set - fail: + ansible.builtin.fail: msg: "Shared Secret Auth is enabled, but no secret has been set in matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret" when: "matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret == ''" - name: Fail if no Shared Secret Auth login types enabled - fail: + ansible.builtin.fail: msg: "Shared Secret Auth is enabled, but none of the login types are" when: "not (matrix_synapse_ext_password_provider_shared_secret_auth_m_login_password_support_enabled or matrix_synapse_ext_password_provider_shared_secret_auth_com_devture_shared_secret_auth_support_enabled)" - name: Download matrix-synapse-shared-secret-auth - get_url: + ansible.builtin.get_url: url: "{{ matrix_synapse_ext_password_provider_shared_secret_auth_download_url }}" dest: "{{ matrix_synapse_ext_path }}/shared_secret_authenticator.py" force: true @@ -23,7 +23,7 @@ delay: "{{ matrix_geturl_retries_delay }}" until: result is not failed -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_modules: | {{ matrix_synapse_modules|default([]) diff --git a/roles/matrix-synapse/tasks/ext/shared-secret-auth/setup_uninstall.yml b/roles/matrix-synapse/tasks/ext/shared-secret-auth/setup_uninstall.yml index e564909e..b2f90944 100644 --- a/roles/matrix-synapse/tasks/ext/shared-secret-auth/setup_uninstall.yml +++ b/roles/matrix-synapse/tasks/ext/shared-secret-auth/setup_uninstall.yml @@ -1,6 +1,6 @@ --- - name: Ensure matrix-synapse-shared-secret-auth doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_synapse_ext_path }}/shared_secret_authenticator.py" state: absent 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 579a707c..7eb67deb 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 @@ -1,12 +1,12 @@ --- - name: Fail if Synapse Simple Antispam blocked homeservers is not set - fail: + ansible.builtin.fail: msg: "Synapse Simple Antispam is enabled, but no blocked homeservers have been set in matrix_synapse_ext_spam_checker_synapse_simple_antispam_config_blocked_homeservers" when: "matrix_synapse_ext_spam_checker_synapse_simple_antispam_config_blocked_homeservers|length == 0" - name: Ensure git installed (RedHat) - yum: + ansible.builtin.yum: name: - git state: present @@ -14,7 +14,7 @@ when: "ansible_os_family == 'RedHat'" - name: Ensure git installed (Debian) - apt: + ansible.builtin.apt: name: - git state: present @@ -30,14 +30,14 @@ when: "ansible_distribution == 'Archlinux'" - name: Clone synapse-simple-antispam git repository - git: + ansible.builtin.git: repo: "{{ matrix_synapse_ext_spam_checker_synapse_simple_antispam_git_repository_url }}" version: "{{ matrix_synapse_ext_spam_checker_synapse_simple_antispam_git_version }}" dest: "{{ matrix_synapse_ext_path }}/synapse-simple-antispam" become: true become_user: "{{ matrix_user_username }}" -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_modules: > {{ matrix_synapse_modules diff --git a/roles/matrix-synapse/tasks/ext/synapse-simple-antispam/setup_uninstall.yml b/roles/matrix-synapse/tasks/ext/synapse-simple-antispam/setup_uninstall.yml index 14cefc72..b1d558aa 100644 --- a/roles/matrix-synapse/tasks/ext/synapse-simple-antispam/setup_uninstall.yml +++ b/roles/matrix-synapse/tasks/ext/synapse-simple-antispam/setup_uninstall.yml @@ -1,6 +1,6 @@ --- - name: Ensure synapse-simple-antispam doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_synapse_ext_path }}/synapse-simple-antispam" state: absent diff --git a/roles/matrix-synapse/tasks/goofys/setup_install.yml b/roles/matrix-synapse/tasks/goofys/setup_install.yml index d3781520..b9e99747 100644 --- a/roles/matrix-synapse/tasks/goofys/setup_install.yml +++ b/roles/matrix-synapse/tasks/goofys/setup_install.yml @@ -21,7 +21,7 @@ ignore_errors: true - name: Ensure Matrix Goofys external storage mountpoint exists - file: + ansible.builtin.file: path: "{{ matrix_s3_media_store_path }}" state: directory mode: 0750 @@ -30,20 +30,20 @@ when: "not local_path_matrix_s3_media_store_path_stat.failed and not local_path_matrix_s3_media_store_path_stat.stat.exists" - name: Ensure goofys environment variables file created - template: + ansible.builtin.template: src: "{{ role_path }}/templates/goofys/env-goofys.j2" dest: "{{ matrix_synapse_config_dir_path }}/env-goofys" owner: root mode: 0600 - name: Ensure matrix-goofys.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/goofys/systemd/matrix-goofys.service.j2" dest: "{{ matrix_systemd_path }}/matrix-goofys.service" mode: 0644 register: matrix_goofys_systemd_service_result - name: Ensure systemd reloaded after matrix-goofys.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_goofys_systemd_service_result.changed" diff --git a/roles/matrix-synapse/tasks/goofys/setup_uninstall.yml b/roles/matrix-synapse/tasks/goofys/setup_uninstall.yml index c00206ef..8f7e3237 100644 --- a/roles/matrix-synapse/tasks/goofys/setup_uninstall.yml +++ b/roles/matrix-synapse/tasks/goofys/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_goofys_service_stat - name: Ensure matrix-goofys is stopped - service: + ansible.builtin.service: name: matrix-goofys state: stopped enabled: false @@ -15,18 +15,18 @@ when: "matrix_goofys_service_stat.stat.exists" - name: Ensure matrix-goofys.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-goofys.service" state: absent when: "matrix_goofys_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-goofys.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_goofys_service_stat.stat.exists" - name: Ensure goofys environment variables file doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_synapse_config_dir_path }}/env-goofys" state: absent diff --git a/roles/matrix-synapse/tasks/import_media_store.yml b/roles/matrix-synapse/tasks/import_media_store.yml index 8e962680..edfad27e 100644 --- a/roles/matrix-synapse/tasks/import_media_store.yml +++ b/roles/matrix-synapse/tasks/import_media_store.yml @@ -3,12 +3,12 @@ # Pre-checks - name: Fail if playbook called incorrectly - fail: + ansible.builtin.fail: msg: "The `server_path_media_store` variable needs to be provided to this playbook, via --extra-vars" when: "server_path_media_store is not defined or server_path_media_store.startswith('<')" - name: Fail if media store is on Amazon S3 - fail: + 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 @@ -18,7 +18,7 @@ register: server_path_media_store_stat - name: Fail if provided media store directory doesn't exist on the server - fail: + ansible.builtin.fail: msg: "{{ server_path_media_store }} cannot be found on the server" when: "not server_path_media_store_stat.stat.exists or not server_path_media_store_stat.stat.isdir" @@ -33,7 +33,7 @@ register: server_path_media_store_remote_content_stat - name: Fail if media store directory doesn't look okay (lacking remote and local content) - fail: + ansible.builtin.fail: msg: "{{ server_path_media_store }} contains neither local_content nor remote_content directories. It's most likely a mistake and is not a media store directory." when: "not server_path_media_store_local_content_stat.stat.exists and not server_path_media_store_remote_content_stat.stat.exists" @@ -41,7 +41,7 @@ # Actual import work - name: Ensure matrix-synapse is stopped - service: + ansible.builtin.service: name: matrix-synapse state: stopped enabled: false @@ -57,14 +57,14 @@ delete: true # It's wasteful to preserve owner/group now. We chown below anyway. owner: false - group: false + ansible.builtin.group: false times: true delegate_to: "{{ inventory_hostname }}" # This is for the generic case and fails in other cases (remote file systems), # because in such cases the base path (matrix_synapse_media_store_path) is a mount point. - name: Ensure media store permissions are correct (generic case) - file: + ansible.builtin.file: path: "{{ matrix_synapse_media_store_path }}" owner: "{{ matrix_user_username }}" group: "{{ matrix_user_groupname }}" @@ -75,7 +75,7 @@ # all files become owned by whoever needs to own them. - name: Ensure Synapse is started (if it previously was) - service: + ansible.builtin.service: name: "{{ item }}" state: started daemon_reload: true diff --git a/roles/matrix-synapse/tasks/init.yml b/roles/matrix-synapse/tasks/init.yml index ffaec05f..c76b4f6c 100644 --- a/roles/matrix-synapse/tasks/init.yml +++ b/roles/matrix-synapse/tasks/init.yml @@ -2,7 +2,7 @@ # See https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/1070 # and https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/1ab507349c752042d26def3e95884f6df8886b74#commitcomment-51108407 - name: Fail if trying to self-build on Ansible < 2.8 - fail: + ansible.builtin.fail: msg: "To self-build the Synapse 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_synapse_container_image_self_build and matrix_synapse_enabled" @@ -11,7 +11,7 @@ - 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" -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-synapse.service'] }}" when: matrix_synapse_enabled|bool @@ -22,13 +22,13 @@ loop_var: matrix_synapse_worker_details when: matrix_synapse_enabled|bool and matrix_synapse_workers_enabled|bool -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-goofys.service'] }}" when: matrix_s3_media_store_enabled|bool - block: - name: Fail if matrix-nginx-proxy role already executed - fail: + ansible.builtin.fail: msg: >- Trying to append Synapse's reverse-proxying configuration to matrix-nginx-proxy, but it's pointless since the matrix-nginx-proxy role had already executed. @@ -37,7 +37,7 @@ 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) - set_fact: + ansible.builtin.set_fact: matrix_synapse_nginx_metrics_configuration_block: | location /metrics/synapse/main-process { {% if matrix_nginx_proxy_enabled|default(False) %} @@ -52,7 +52,7 @@ } - name: Register synapse metrics proxying configuration with matrix-nginx-proxy (matrix.DOMAIN/metrics/synapse/main-process) - set_fact: + 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([]) @@ -61,7 +61,7 @@ }} - name: Generate synapse worker metrics proxying configuration for matrix-nginx-proxy (matrix.DOMAIN/metrics/synapse/worker) - set_fact: + ansible.builtin.set_fact: matrix_synapse_worker_nginx_metrics_configuration_block: | {% for worker in matrix_synapse_workers_enabled_list %} {% if worker.metrics_port != 0 %} @@ -76,7 +76,7 @@ when: matrix_synapse_workers_enabled_list|length > 0 - name: Register synapse worker metrics proxying configuration with matrix-nginx-proxy (matrix.DOMAIN/metrics/synapse/worker) - set_fact: + 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([]) diff --git a/roles/matrix-synapse/tasks/main.yml b/roles/matrix-synapse/tasks/main.yml index 55235843..31a8c368 100644 --- a/roles/matrix-synapse/tasks/main.yml +++ b/roles/matrix-synapse/tasks/main.yml @@ -51,7 +51,7 @@ - rust-synapse-compress-state - name: Mark matrix-synapse role as executed - set_fact: + ansible.builtin.set_fact: matrix_synapse_role_executed: true tags: - always diff --git a/roles/matrix-synapse/tasks/register_user.yml b/roles/matrix-synapse/tasks/register_user.yml index 2a1c5708..48ce33bb 100644 --- a/roles/matrix-synapse/tasks/register_user.yml +++ b/roles/matrix-synapse/tasks/register_user.yml @@ -1,22 +1,22 @@ --- - name: Fail if playbook called incorrectly - fail: + ansible.builtin.fail: msg: "The `username` variable needs to be provided to this playbook, via --extra-vars" when: "username is not defined or username == ''" - name: Fail if playbook called incorrectly - fail: + ansible.builtin.fail: msg: "The `password` variable needs to be provided to this playbook, via --extra-vars" when: "password is not defined or password == ''" - name: Fail if playbook called incorrectly - fail: + ansible.builtin.fail: msg: "The `admin` variable needs to be provided to this playbook, via --extra-vars" when: "admin is not defined or admin not in ['yes', 'no']" - name: Ensure matrix-synapse is started - service: + ansible.builtin.service: name: matrix-synapse state: started daemon_reload: true @@ -28,4 +28,4 @@ when: "start_result.changed" - name: Register user - command: "{{ matrix_local_bin_path }}/matrix-synapse-register-user {{ username|quote }} {{ password|quote }} {{ '1' if admin == 'yes' else '0' }}" + ansible.builtin.command: "{{ matrix_local_bin_path }}/matrix-synapse-register-user {{ username|quote }} {{ password|quote }} {{ '1' if admin == 'yes' else '0' }}" diff --git a/roles/matrix-synapse/tasks/rust-synapse-compress-state/compress_room.yml b/roles/matrix-synapse/tasks/rust-synapse-compress-state/compress_room.yml index e1386c75..30849ded 100644 --- a/roles/matrix-synapse/tasks/rust-synapse-compress-state/compress_room.yml +++ b/roles/matrix-synapse/tasks/rust-synapse-compress-state/compress_room.yml @@ -1,10 +1,10 @@ --- -- debug: +- ansible.builtin.debug: msg: "Compressing room `{{ room_details.room_id }}` having {{ room_details.count }} state group rows" - name: Generate rust-synapse-compress-state room compression command - set_fact: + ansible.builtin.set_fact: matrix_synapse_rust_synapse_compress_state_compress_room_command: >- {{ matrix_host_command_docker }} run --rm --name matrix-rust-synapse-compress-state-compress-room --user={{ matrix_user_uid }}:{{ matrix_user_gid }} @@ -17,15 +17,15 @@ -r '{{ room_details.room_id }}' - name: Run rust-synapse-compress-state room compression command (SQL generation) - command: "{{ matrix_synapse_rust_synapse_compress_state_compress_room_command }}" + ansible.builtin.command: "{{ matrix_synapse_rust_synapse_compress_state_compress_room_command }}" async: "{{ matrix_synapse_rust_synapse_compress_state_compress_room_time }}" poll: 10 register: matrix_synapse_rust_synapse_compress_state_compress_room_command_result -- debug: var="matrix_synapse_rust_synapse_compress_state_compress_room_command_result" +- ansible.builtin.debug: var="matrix_synapse_rust_synapse_compress_state_compress_room_command_result" - name: Generate Postgres compression SQL import command - set_fact: + ansible.builtin.set_fact: matrix_synapse_rust_synapse_compress_state_psql_import_command: >- {{ matrix_host_command_docker }} run --rm --name matrix-rust-synapse-compress-state-psql-import --user={{ matrix_user_uid }}:{{ matrix_user_gid }} @@ -39,12 +39,12 @@ psql -v ON_ERROR_STOP=1 -h matrix-postgres -d {{ matrix_synapse_database_database }}" - name: Import compression SQL into Postgres - command: "{{ matrix_synapse_rust_synapse_compress_state_psql_import_command }}" + ansible.builtin.command: "{{ matrix_synapse_rust_synapse_compress_state_psql_import_command }}" async: "{{ matrix_synapse_rust_synapse_compress_state_psql_import_time }}" poll: 10 register: matrix_synapse_rust_synapse_compress_state_psql_import_command_result - name: Clean up - file: + ansible.builtin.file: path: "{{ matrix_synapse_rust_synapse_compress_state_base_path }}/state-compressor.sql" state: absent 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 219f1c98..33a18ac6 100644 --- a/roles/matrix-synapse/tasks/rust-synapse-compress-state/main.yml +++ b/roles/matrix-synapse/tasks/rust-synapse-compress-state/main.yml @@ -2,7 +2,7 @@ # Pre-checks - name: Fail if Postgres not enabled - fail: + 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" @@ -10,22 +10,22 @@ # Defaults - name: Set matrix_synapse_rust_synapse_compress_state_find_rooms_command_wait_time, if not provided - set_fact: + 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('') == ''" - name: Set matrix_synapse_rust_synapse_compress_state_compress_room_time, if not provided - set_fact: + 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('') == ''" - name: Set matrix_synapse_rust_synapse_compress_state_psql_import_time, if not provided - set_fact: + 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('') == ''" - name: Set matrix_synapse_rust_synapse_compress_state_min_state_groups_required, if not provided - set_fact: + 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 @@ -35,7 +35,7 @@ # Actual compression work - name: Ensure rust-synapse-compress-state paths exist - file: + ansible.builtin.file: path: "{{ matrix_synapse_rust_synapse_compress_state_base_path }}" state: directory mode: 0750 @@ -54,7 +54,7 @@ until: result is not failed - name: Generate rust-synapse-compress-state room find command - set_fact: + ansible.builtin.set_fact: matrix_synapse_rust_synapse_compress_state_find_rooms_command: >- {{ matrix_host_command_docker }} run --rm --name matrix-rust-synapse-compress-state-find-rooms --user={{ matrix_user_uid }}:{{ matrix_user_gid }} @@ -66,7 +66,7 @@ 'SELECT array_to_json(array_agg(row_to_json (r))) FROM (SELECT room_id, count(*) AS count FROM state_groups_state GROUP BY room_id HAVING count(*) > {{ matrix_synapse_rust_synapse_compress_state_min_state_groups_required }} ORDER BY count DESC) r;' - name: Find rooms eligible for compression with rust-synapse-compress-state - command: "{{ matrix_synapse_rust_synapse_compress_state_find_rooms_command }}" + ansible.builtin.command: "{{ matrix_synapse_rust_synapse_compress_state_find_rooms_command }}" async: "{{ matrix_synapse_rust_synapse_compress_state_find_rooms_command_wait_time }}" poll: 10 register: matrix_synapse_rust_synapse_compress_state_find_rooms_command_result @@ -85,10 +85,10 @@ # Row 3 contains a space when there's no result. - block: - - debug: var="matrix_synapse_rust_synapse_compress_state_find_rooms_command_result" + - ansible.builtin.debug: var="matrix_synapse_rust_synapse_compress_state_find_rooms_command_result" - name: Fail if room find result is not what we expect - fail: + ansible.builtin.fail: msg: >- Expecting 4 lines in the "find rooms" result. when: "matrix_synapse_rust_synapse_compress_state_find_rooms_command_result.failed or matrix_synapse_rust_synapse_compress_state_find_rooms_command_result.stdout_lines|length != 4" @@ -96,11 +96,11 @@ - block: # matrix_synapse_rust_synapse_compress_state_eligible_rooms is a list # of dictionaries like this: {'room_id': '!some-id', 'count': 2461329} - - set_fact: + - ansible.builtin.set_fact: matrix_synapse_rust_synapse_compress_state_eligible_rooms: "{{ matrix_synapse_rust_synapse_compress_state_find_rooms_command_result.stdout_lines[2] | from_json }}" - name: Display rooms that will be compressed - debug: + ansible.builtin.debug: msg: >- The following rooms contain more than {{ matrix_synapse_rust_synapse_compress_state_min_state_groups_required }} state group rows (configurable via `matrix_synapse_rust_synapse_compress_state_min_state_groups_required`) @@ -115,7 +115,7 @@ when: "matrix_synapse_rust_synapse_compress_state_find_rooms_command_result.stdout_lines[2] != ' '" - name: Show notice about lack of rooms to compress - debug: + ansible.builtin.debug: msg: >- No rooms were found to contain more than {{ matrix_synapse_rust_synapse_compress_state_min_state_groups_required }} state group rows (configurable via `matrix_synapse_rust_synapse_compress_state_min_state_groups_required`), diff --git a/roles/matrix-synapse/tasks/self_check_client_api.yml b/roles/matrix-synapse/tasks/self_check_client_api.yml index 407a79ff..c0906304 100644 --- a/roles/matrix-synapse/tasks/self_check_client_api.yml +++ b/roles/matrix-synapse/tasks/self_check_client_api.yml @@ -1,7 +1,7 @@ --- - name: Check Matrix Client API - uri: + ansible.builtin.uri: url: "{{ matrix_synapse_client_api_url_endpoint_public }}" follow_redirects: none validate_certs: "{{ matrix_synapse_self_check_validate_certificates }}" @@ -11,11 +11,11 @@ when: matrix_synapse_enabled|bool - name: Fail if Matrix Client API not working - fail: + 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)" - name: Report working Matrix Client API - debug: + 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 diff --git a/roles/matrix-synapse/tasks/self_check_federation_api.yml b/roles/matrix-synapse/tasks/self_check_federation_api.yml index 32249372..447e3e26 100644 --- a/roles/matrix-synapse/tasks/self_check_federation_api.yml +++ b/roles/matrix-synapse/tasks/self_check_federation_api.yml @@ -1,7 +1,7 @@ --- - name: Check Matrix Federation API - uri: + ansible.builtin.uri: url: "{{ matrix_synapse_federation_api_url_endpoint_public }}" follow_redirects: none validate_certs: "{{ matrix_synapse_self_check_validate_certificates }}" @@ -11,16 +11,16 @@ when: matrix_synapse_enabled|bool - name: Fail if Matrix Federation API not working - fail: + 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)" - name: Fail if Matrix Federation API unexpectedly enabled - fail: + 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" - name: Report working Matrix Federation API - debug: + 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" diff --git a/roles/matrix-synapse/tasks/setup_synapse.yml b/roles/matrix-synapse/tasks/setup_synapse.yml index 47e404f4..c2b33f0b 100644 --- a/roles/matrix-synapse/tasks/setup_synapse.yml +++ b/roles/matrix-synapse/tasks/setup_synapse.yml @@ -1,7 +1,7 @@ --- - name: Ensure Synapse paths exist - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory mode: 0750 diff --git a/roles/matrix-synapse/tasks/synapse/setup_install.yml b/roles/matrix-synapse/tasks/synapse/setup_install.yml index 1aaaf7b3..e0d47072 100644 --- a/roles/matrix-synapse/tasks/synapse/setup_install.yml +++ b/roles/matrix-synapse/tasks/synapse/setup_install.yml @@ -10,7 +10,7 @@ # This is separate and conditional, to ensure we don't execute it # if the path already exists or we failed to check, because it's mounted using fuse. - name: Ensure Synapse media store path exists - file: + ansible.builtin.file: path: "{{ matrix_synapse_media_store_path }}" state: directory mode: 0750 @@ -20,7 +20,7 @@ - block: - name: Ensure Synapse repository is present on self-build - git: + ansible.builtin.git: repo: "{{ matrix_synapse_container_image_self_build_repo }}" dest: "{{ matrix_synapse_docker_src_files_path }}" version: "{{ matrix_synapse_docker_image.split(':')[1] }}" @@ -30,14 +30,14 @@ register: matrix_synapse_git_pull_results - name: Check if Synapse Docker image exists - command: "{{ matrix_host_command_docker }} images --quiet --filter 'reference={{ matrix_synapse_docker_image }}'" + ansible.builtin.command: "{{ matrix_host_command_docker }} images --quiet --filter 'reference={{ matrix_synapse_docker_image }}'" register: matrix_synapse_docker_image_check_result # Invoking the `docker build` command here, instead of calling the `docker_image` Ansible module, # because the latter does not support BuildKit. # See: https://github.com/ansible-collections/community.general/issues/514 - name: Ensure Synapse Docker image is built - shell: + ansible.builtin.shell: chdir: "{{ matrix_synapse_docker_src_files_path }}" cmd: | {{ matrix_host_command_docker }} build \ @@ -74,7 +74,7 @@ # We don't use the `docker_container` module, because using it with `cap_drop` requires # a very recent docker-py version, which is not available for a lot of people yet. - name: Generate initial Synapse config and signing key - command: | + ansible.builtin.command: | docker run --rm --name=matrix-config @@ -89,7 +89,7 @@ when: "not matrix_synapse_signing_key_stat.stat.exists" - name: Ensure Synapse homeserver config installed - copy: + ansible.builtin.copy: content: "{{ matrix_synapse_configuration|to_nice_yaml(indent=2, width=999999) }}" dest: "{{ matrix_synapse_config_dir_path }}/homeserver.yaml" mode: 0644 @@ -97,31 +97,31 @@ group: "{{ matrix_user_groupname }}" - name: Ensure Synapse log config installed - template: + ansible.builtin.template: src: "{{ matrix_synapse_template_synapse_log }}" dest: "{{ matrix_synapse_config_dir_path }}/{{ matrix_server_fqn_matrix }}.log.config" mode: 0644 - name: Ensure matrix-synapse.service installed - template: + ansible.builtin.template: src: "{{ role_path }}/templates/synapse/systemd/matrix-synapse.service.j2" dest: "{{ matrix_systemd_path }}/matrix-synapse.service" mode: 0644 register: matrix_synapse_systemd_service_result - name: Ensure systemd reloaded after matrix-synapse.service installation - service: + ansible.builtin.service: daemon_reload: true when: "matrix_synapse_systemd_service_result.changed" - name: Ensure matrix-synapse-register-user script created - template: + ansible.builtin.template: src: "{{ role_path }}/templates/synapse/usr-local-bin/matrix-synapse-register-user.j2" dest: "{{ matrix_local_bin_path }}/matrix-synapse-register-user" mode: 0755 - name: Generate sample prometheus.yml for external scraping - template: + ansible.builtin.template: src: "{{ role_path }}/templates/synapse/prometheus/external_prometheus.yml.example.j2" dest: "{{ matrix_synapse_base_path }}/external_prometheus.yml.example" owner: "{{ matrix_user_username }}" diff --git a/roles/matrix-synapse/tasks/synapse/setup_uninstall.yml b/roles/matrix-synapse/tasks/synapse/setup_uninstall.yml index 1d4fe7ad..1f2d3fe5 100644 --- a/roles/matrix-synapse/tasks/synapse/setup_uninstall.yml +++ b/roles/matrix-synapse/tasks/synapse/setup_uninstall.yml @@ -6,7 +6,7 @@ register: matrix_synapse_service_stat - name: Ensure matrix-synapse is stopped - service: + ansible.builtin.service: name: matrix-synapse state: stopped enabled: false @@ -15,13 +15,13 @@ when: "matrix_synapse_service_stat.stat.exists" - name: Ensure matrix-synapse.service doesn't exist - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-synapse.service" state: absent when: "matrix_synapse_service_stat.stat.exists" - name: Ensure systemd reloaded after matrix-synapse.service removal - service: + ansible.builtin.service: daemon_reload: true when: "matrix_synapse_service_stat.stat.exists" @@ -31,7 +31,7 @@ state: absent - name: Ensure sample prometheus.yml for external scraping is deleted - file: + ansible.builtin.file: path: "{{ matrix_synapse_base_path }}/external_prometheus.yml.example" state: absent 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 f59313bd..6d75d9f6 100644 --- a/roles/matrix-synapse/tasks/synapse/workers/init.yml +++ b/roles/matrix-synapse/tasks/synapse/workers/init.yml @@ -5,7 +5,7 @@ # so we're forced to do something much uglier. - name: Build generic workers - set_fact: + ansible.builtin.set_fact: worker: type: 'generic_worker' instanceId: "{{ matrix_synapse_workers_generic_workers_port_range_start + item }}" @@ -15,7 +15,7 @@ loop: "{{ range(0, matrix_synapse_workers_generic_workers_count|int)|list }}" - name: Build federation sender workers - set_fact: + ansible.builtin.set_fact: worker: type: 'federation_sender' instanceId: "{{ item }}" @@ -26,7 +26,7 @@ # This type of worker can only have a count of 1, at most - name: Build pusher workers - set_fact: + ansible.builtin.set_fact: worker: type: 'pusher' instanceId: "{{ item }}" @@ -37,7 +37,7 @@ # This type of worker can only have a count of 1, at most - name: Build appservice workers - set_fact: + ansible.builtin.set_fact: worker: type: 'appservice' instanceId: "{{ item }}" @@ -47,7 +47,7 @@ loop: "{{ range(0, matrix_synapse_workers_appservice_workers_count|int)|list }}" - name: Build media_repository workers - set_fact: + ansible.builtin.set_fact: worker: type: 'media_repository' instanceId: "{{ matrix_synapse_workers_media_repository_workers_port_range_start + item }}" @@ -57,7 +57,7 @@ loop: "{{ range(0, matrix_synapse_workers_media_repository_workers_count|int)|list }}" - name: Build frontend_proxy workers - set_fact: + ansible.builtin.set_fact: worker: type: 'frontend_proxy' instanceId: "{{ matrix_synapse_workers_frontend_proxy_workers_port_range_start + item }}" @@ -66,7 +66,7 @@ register: "matrix_synapse_workers_list_results_frontend_proxy_workers" loop: "{{ range(0, matrix_synapse_workers_frontend_proxy_workers_count|int)|list }}" -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_dynamic_workers_list: "{{ matrix_synapse_dynamic_workers_list|default([]) + [item.ansible_facts.worker] }}" with_items: | {{ @@ -83,5 +83,5 @@ matrix_synapse_workers_list_results_frontend_proxy_workers.results }} -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_workers_enabled_list: "{{ matrix_synapse_dynamic_workers_list }}" diff --git a/roles/matrix-synapse/tasks/synapse/workers/setup.yml b/roles/matrix-synapse/tasks/synapse/workers/setup.yml index ce66a2e4..7fcce2b4 100644 --- a/roles/matrix-synapse/tasks/synapse/workers/setup.yml +++ b/roles/matrix-synapse/tasks/synapse/workers/setup.yml @@ -3,14 +3,14 @@ # A previous version of the worker setup used this. # This is a temporary cleanup for people who ran that version. - name: Ensure old matrix-synapse.service.wants directory is gone - file: + ansible.builtin.file: path: "{{ matrix_systemd_path }}/matrix-synapse.service.wants" state: absent # Same. This was part of a previous version of the worker setup. # No longer necessary. - name: Ensure matrix-synapse-worker-write-pid script is removed - file: + ansible.builtin.file: path: "{{ matrix_local_bin_path }}/matrix-synapse-worker-write-pid" state: absent diff --git a/roles/matrix-synapse/tasks/synapse/workers/setup_install.yml b/roles/matrix-synapse/tasks/synapse/workers/setup_install.yml index 983f1876..ce86e35f 100644 --- a/roles/matrix-synapse/tasks/synapse/workers/setup_install.yml +++ b/roles/matrix-synapse/tasks/synapse/workers/setup_install.yml @@ -9,7 +9,7 @@ # This also deletes some things which we need. They will be recreated below. - name: Ensure previous worker configs are cleaned - file: + ansible.builtin.file: path: "{{ item.path }}" state: absent with_items: "{{ matrix_synapse_workers_current_config_files.files }}" @@ -22,7 +22,7 @@ register: matrix_synapse_workers_current_systemd_services - name: Ensure unnecessary worker systemd services are stopped and disabled - service: + ansible.builtin.service: name: "{{ item.path|basename }}" state: stopped enabled: false @@ -30,7 +30,7 @@ when: "not ansible_check_mode and item.path|basename not in matrix_systemd_services_list" - name: Ensure unnecessary worker systemd services are cleaned - file: + ansible.builtin.file: path: "{{ item.path }}" state: absent with_items: "{{ matrix_synapse_workers_current_systemd_services.files }}" diff --git a/roles/matrix-synapse/tasks/synapse/workers/setup_uninstall.yml b/roles/matrix-synapse/tasks/synapse/workers/setup_uninstall.yml index f0357611..8b70dec5 100644 --- a/roles/matrix-synapse/tasks/synapse/workers/setup_uninstall.yml +++ b/roles/matrix-synapse/tasks/synapse/workers/setup_uninstall.yml @@ -4,7 +4,7 @@ service_facts: - name: Ensure any worker services are stopped - service: + ansible.builtin.service: name: "{{ item.key }}" state: stopped with_dict: "{{ ansible_facts.services|default({})|dict2items|selectattr('key', 'match', 'matrix-synapse-worker-.+\\.service')|list|items2dict }}" @@ -18,7 +18,7 @@ register: matrix_synapse_workers_current_config_files - name: Ensure previous worker configs are cleaned - file: + ansible.builtin.file: path: "{{ item.path }}" state: absent with_items: "{{ matrix_synapse_workers_current_config_files.files }}" @@ -31,7 +31,7 @@ register: matrix_synapse_workers_current_systemd_services - name: Ensure previous worker systemd services are cleaned - file: + ansible.builtin.file: path: "{{ item.path }}" state: absent with_items: "{{ matrix_synapse_workers_current_systemd_services.files }}" 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 2669e149..dfbb8316 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 @@ -8,12 +8,12 @@ # In the future, it should be possible to remove this check. # Our own code which dynamically builds `matrix_synapse_workers_enabled_list` does things right. - name: Fail if instanceId not defined for worker - fail: + ansible.builtin.fail: 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" -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_worker_systemd_service_name: "matrix-synapse-worker-{{ matrix_synapse_worker_details.type }}-{{ matrix_synapse_worker_details.instanceId }}.service" -- set_fact: +- ansible.builtin.set_fact: matrix_systemd_services_list: "{{ matrix_systemd_services_list + [matrix_synapse_worker_systemd_service_name] }}" diff --git a/roles/matrix-synapse/tasks/synapse/workers/util/setup_files_for_worker.yml b/roles/matrix-synapse/tasks/synapse/workers/util/setup_files_for_worker.yml index 2247cd89..883558a7 100644 --- a/roles/matrix-synapse/tasks/synapse/workers/util/setup_files_for_worker.yml +++ b/roles/matrix-synapse/tasks/synapse/workers/util/setup_files_for_worker.yml @@ -1,21 +1,21 @@ --- -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_worker_systemd_service_name: "matrix-synapse-worker-{{ matrix_synapse_worker_details.type }}-{{ matrix_synapse_worker_details.instanceId }}" -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_worker_container_name: "{{ matrix_synapse_worker_systemd_service_name }}" -- set_fact: +- ansible.builtin.set_fact: matrix_synapse_worker_config_file_name: "worker.{{ matrix_synapse_worker_details.type }}_{{ matrix_synapse_worker_details.instanceId }}.yaml" - name: Ensure configuration exists for {{ matrix_synapse_worker_systemd_service_name }} - template: + ansible.builtin.template: src: "{{ role_path }}/templates/synapse/worker.yaml.j2" dest: "{{ matrix_synapse_config_dir_path }}/{{ matrix_synapse_worker_config_file_name }}" - name: Ensure systemd service exists for {{ matrix_synapse_worker_systemd_service_name }} - template: + ansible.builtin.template: src: "{{ role_path }}/templates/synapse/systemd/matrix-synapse-worker.service.j2" dest: "{{ matrix_systemd_path }}/{{ matrix_synapse_worker_systemd_service_name }}.service" mode: 0644 diff --git a/roles/matrix-synapse/tasks/update_user_password.yml b/roles/matrix-synapse/tasks/update_user_password.yml index fd348d9d..171159ff 100644 --- a/roles/matrix-synapse/tasks/update_user_password.yml +++ b/roles/matrix-synapse/tasks/update_user_password.yml @@ -1,29 +1,29 @@ --- - name: Fail if playbook called incorrectly - fail: + ansible.builtin.fail: msg: "The `username` variable needs to be provided to this playbook, via --extra-vars" when: "username is not defined or username == ''" - name: Fail if playbook called incorrectly - fail: + ansible.builtin.fail: msg: "The `password` variable needs to be provided to this playbook, via --extra-vars" when: "password is not defined or password == ''" - name: Fail if not using matrix-postgres container - fail: + ansible.builtin.fail: msg: "This command is working only when matrix-postgres container is being used" when: "not matrix_postgres_enabled|bool" - name: Ensure matrix-synapse is started - service: + ansible.builtin.service: name: matrix-synapse state: started daemon_reload: true register: start_result - name: Ensure matrix-postgres is started - service: + ansible.builtin.service: name: matrix-postgres state: started daemon_reload: true @@ -36,8 +36,8 @@ when: "start_result.changed or postgres_start_result.changed" - name: Generate password hash - shell: "{{ matrix_host_command_docker }} exec matrix-synapse /usr/local/bin/hash_password -c /data/homeserver.yaml -p {{ password|quote }}" + ansible.builtin.shell: "{{ matrix_host_command_docker }} exec matrix-synapse /usr/local/bin/hash_password -c /data/homeserver.yaml -p {{ password|quote }}" register: password_hash - name: Update user password hash - command: "{{ matrix_local_bin_path }}/matrix-postgres-update-user-password-hash {{ username|quote }} {{ password_hash.stdout|quote }}" + ansible.builtin.command: "{{ matrix_local_bin_path }}/matrix-postgres-update-user-password-hash {{ username|quote }} {{ password_hash.stdout|quote }}" diff --git a/roles/matrix-synapse/tasks/validate_config.yml b/roles/matrix-synapse/tasks/validate_config.yml index ab0ca3a7..ba60abf8 100644 --- a/roles/matrix-synapse/tasks/validate_config.yml +++ b/roles/matrix-synapse/tasks/validate_config.yml @@ -1,7 +1,7 @@ --- - name: Fail if required Synapse settings not defined - fail: + ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`) for using Synapse. when: "vars[item] == ''" @@ -13,7 +13,7 @@ - "matrix_synapse_database_database" - name: Fail if asking to configure deprecaed workers (appservice, userdir) - fail: + ansible.builtin.fail: msg: >- `{{ item }}` cannot be more than 0. This type of worker has been deprecated since Synapse v1.59. @@ -25,7 +25,7 @@ - "matrix_synapse_workers_user_dir_workers_count" - name: Fail if asking for more than 1 instance of single-instance workers - fail: + ansible.builtin.fail: msg: >- `{{ item }}` cannot be more than 1. This is a single-instance worker. when: "vars[item]|int > 1" @@ -34,7 +34,7 @@ - "matrix_synapse_workers_federation_sender_workers_count" - name: (Deprecation) Catch and report renamed settings - fail: + ansible.builtin.fail: msg: >- Your configuration contains a variable, which now has a different name. Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`). @@ -63,7 +63,7 @@ - {'old': 'matrix_synapse_enable_group_creation', 'new': ''} - name: (Deprecation) Catch and report renamed settings in matrix_synapse_configuration_extension_yaml - fail: + ansible.builtin.fail: msg: >- Your matrix_synapse_configuration_extension_yaml configuration contains a variable, which now has a different name. Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`). From ddf18eadc7e60dcdc11080612714230358421cc5 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Mon, 18 Jul 2022 11:22:05 +0300 Subject: [PATCH 02/16] 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]) }}" From 983bf819ef83f0312f1a5ed6ea36bfb9ef8a22c0 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Mon, 18 Jul 2022 11:23:09 +0300 Subject: [PATCH 03/16] Explictly set Synapse's worker configuration's owner/permissions --- .../tasks/synapse/workers/util/setup_files_for_worker.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/roles/matrix-synapse/tasks/synapse/workers/util/setup_files_for_worker.yml b/roles/matrix-synapse/tasks/synapse/workers/util/setup_files_for_worker.yml index 883558a7..d6d4924f 100644 --- a/roles/matrix-synapse/tasks/synapse/workers/util/setup_files_for_worker.yml +++ b/roles/matrix-synapse/tasks/synapse/workers/util/setup_files_for_worker.yml @@ -13,6 +13,9 @@ ansible.builtin.template: src: "{{ role_path }}/templates/synapse/worker.yaml.j2" dest: "{{ matrix_synapse_config_dir_path }}/{{ matrix_synapse_worker_config_file_name }}" + mode: 0644 + owner: "{{ matrix_user_username }}" + group: "{{ matrix_user_groupname }}" - name: Ensure systemd service exists for {{ matrix_synapse_worker_systemd_service_name }} ansible.builtin.template: From d073c7ecb36aab9ef664c813c91a6993802d7a24 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Mon, 18 Jul 2022 12:28:39 +0300 Subject: [PATCH 04/16] More ansible-lint fixes --- group_vars/matrix_servers | 46 ++++++++-------- roles/matrix-backup-borg/defaults/main.yml | 2 +- roles/matrix-base/defaults/main.yml | 12 ++--- roles/matrix-base/tasks/sanity_check.yml | 2 +- roles/matrix-base/tasks/server_base/setup.yml | 8 +-- .../tasks/server_base/setup_debian.yml | 10 ++-- .../tasks/server_base/setup_fedora.yml | 4 +- .../tasks/server_base/setup_raspbian.yml | 4 +- .../tasks/server_base/setup_redhat.yml | 2 +- .../tasks/server_base/setup_redhat8.yml | 4 +- roles/matrix-bot-go-neb/defaults/main.yml | 2 +- .../defaults/main.yml | 2 +- roles/matrix-bot-mjolnir/defaults/main.yml | 2 +- .../defaults/main.yml | 6 +-- .../templates/config.yaml.j2 | 2 +- .../defaults/main.yml | 2 +- .../tasks/setup_install.yml | 2 +- .../defaults/main.yml | 2 +- .../defaults/main.yml | 2 +- .../defaults/main.yml | 6 +-- .../defaults/main.yml | 6 +-- .../matrix-bridge-hookshot/defaults/main.yml | 4 +- .../defaults/main.yml | 6 +-- .../defaults/main.yml | 6 +-- .../defaults/main.yml | 6 +-- .../defaults/main.yml | 6 +-- .../defaults/main.yml | 2 +- .../templates/registration.yaml.j2 | 6 +-- .../defaults/main.yml | 8 +-- .../defaults/main.yml | 6 +-- .../defaults/main.yml | 6 +-- .../defaults/main.yml | 8 +-- .../defaults/main.yml | 8 +-- .../defaults/main.yml | 8 +-- .../defaults/main.yml | 8 +-- .../defaults/main.yml | 8 +-- .../defaults/main.yml | 8 +-- .../tasks/setup_install.yml | 1 + roles/matrix-bridge-sms/defaults/main.yml | 6 +-- roles/matrix-client-cinny/defaults/main.yml | 4 +- .../tasks/setup_install.yml | 2 +- .../templates/config.json.j2 | 2 +- roles/matrix-client-element/defaults/main.yml | 4 +- .../tasks/setup_install.yml | 2 +- .../templates/config.json.j2 | 18 +++---- .../matrix-client-hydrogen/defaults/main.yml | 4 +- .../tasks/setup_install.yml | 2 +- .../templates/config.json.j2 | 2 +- roles/matrix-corporal/defaults/main.yml | 4 +- .../matrix-corporal/tasks/setup_corporal.yml | 2 +- roles/matrix-dendrite/defaults/main.yml | 6 +-- .../templates/dendrite/dendrite.yaml.j2 | 2 +- roles/matrix-dendrite/vars/main.yml | 2 +- roles/matrix-dimension/defaults/main.yml | 2 +- roles/matrix-dynamic-dns/defaults/main.yml | 1 + roles/matrix-dynamic-dns/tasks/install.yml | 1 + .../templates/config.json.j2 | 2 +- roles/matrix-etherpad/defaults/main.yml | 4 +- roles/matrix-etherpad/tasks/setup_install.yml | 2 +- .../tasks/util/setup_jitsi_auth.yml | 4 +- roles/matrix-ma1sd/defaults/main.yml | 2 +- roles/matrix-ma1sd/tasks/setup_install.yml | 6 ++- .../tasks/nginx-proxy/setup_metrics_auth.yml | 1 + .../tasks/self_check_well_known_file.yml | 4 +- ...etup_ssl_self_signed_obtain_for_domain.yml | 2 +- .../nginx/conf.d/matrix-synapse.conf.j2 | 8 +-- roles/matrix-ntfy/defaults/main.yml | 2 +- .../util/detect_existing_postgres_version.yml | 2 +- .../tasks/util/create_additional_database.yml | 1 + .../util/detect_existing_postgres_version.yml | 2 +- .../tasks/util/migrate_db_to_postgres.yml | 6 +++ .../defaults/main.yml | 4 +- roles/matrix-prometheus/defaults/main.yml | 2 +- roles/matrix-registration/defaults/main.yml | 2 +- roles/matrix-sygnal/defaults/main.yml | 2 +- roles/matrix-synapse/defaults/main.yml | 4 +- roles/matrix-synapse/tasks/register_user.yml | 2 + .../compress_room.yml | 2 + .../rust-synapse-compress-state/main.yml | 1 + .../tasks/synapse/setup_install.yml | 1 + .../tasks/synapse/workers/init.yml | 12 ++--- .../tasks/synapse/workers/setup_uninstall.yml | 2 +- .../tasks/update_user_password.yml | 3 ++ .../templates/synapse/homeserver.yaml.j2 | 52 +++++++++---------- 84 files changed, 230 insertions(+), 206 deletions(-) diff --git a/group_vars/matrix_servers b/group_vars/matrix_servers index 221662c5..a7290f9d 100755 --- a/group_vars/matrix_servers +++ b/group_vars/matrix_servers @@ -22,16 +22,16 @@ matrix_identity_server_url: "{{ ('https://' + matrix_server_fqn_matrix) if matri matrix_homeserver_container_url: |- {{ 'http://matrix-nginx-proxy:12080' if matrix_nginx_proxy_enabled else { - 'synapse': ('http://matrix-synapse:'+ matrix_synapse_container_client_api_port|string), - 'dendrite': ('http://matrix-dendrite:' + matrix_dendrite_http_bind_port|string), + 'synapse': ('http://matrix-synapse:'+ matrix_synapse_container_client_api_port | string), + 'dendrite': ('http://matrix-dendrite:' + matrix_dendrite_http_bind_port | string), }[matrix_homeserver_implementation] }} matrix_homeserver_container_federation_url: |- {{ 'http://matrix-nginx-proxy:12088' if matrix_nginx_proxy_enabled else { - 'synapse': ('http://matrix-synapse:'+ matrix_synapse_container_federation_api_plain_port|string), - 'dendrite': ('http://matrix-dendrite:' + matrix_dendrite_http_bind_port|string), + 'synapse': ('http://matrix-synapse:'+ matrix_synapse_container_federation_api_plain_port | string), + 'dendrite': ('http://matrix-dendrite:' + matrix_dendrite_http_bind_port | string), }[matrix_homeserver_implementation] }} @@ -1158,7 +1158,7 @@ matrix_backup_borg_postgresql_databases: | 'name': matrix_synapse_database_database }] if (matrix_synapse_enabled and matrix_synapse_database_database == matrix_postgres_db_name and matrix_synapse_database_host == 'matrix-postgres') else []) + - matrix_postgres_additional_databases)|map(attribute='name')|list + matrix_postgres_additional_databases)|map(attribute='name') | list }} matrix_backup_borg_location_source_directories: - "{{ matrix_base_data_path }}" @@ -1431,7 +1431,7 @@ matrix_ma1sd_container_image_self_build: "{{ matrix_architecture != 'amd64' }}" # Normally, matrix-nginx-proxy is enabled and nginx can reach ma1sd over the container network. # If matrix-nginx-proxy is not enabled, or you otherwise have a need for it, you can expose # ma1sd's web-server port. -matrix_ma1sd_container_http_host_bind_port: "{{ '' if matrix_nginx_proxy_enabled else '127.0.0.1:' + matrix_ma1sd_container_port|string }}" +matrix_ma1sd_container_http_host_bind_port: "{{ '' if matrix_nginx_proxy_enabled else '127.0.0.1:' + matrix_ma1sd_container_port | string }}" # We enable Synapse integration via its Postgres database by default. @@ -1540,14 +1540,14 @@ matrix_nginx_proxy_proxy_matrix_federation_api_addr_sans_container: "127.0.0.1:1 matrix_nginx_proxy_proxy_synapse_enabled: "{{ matrix_synapse_enabled }}" matrix_nginx_proxy_proxy_synapse_client_api_addr_with_container: "matrix-synapse:{{ matrix_synapse_container_client_api_port }}" matrix_nginx_proxy_proxy_synapse_client_api_addr_sans_container: "127.0.0.1:{{ matrix_synapse_container_client_api_port }}" -matrix_nginx_proxy_proxy_synapse_federation_api_addr_with_container: "matrix-synapse:{{matrix_synapse_container_federation_api_plain_port|string}}" -matrix_nginx_proxy_proxy_synapse_federation_api_addr_sans_container: "127.0.0.1:{{matrix_synapse_container_federation_api_plain_port|string}}" +matrix_nginx_proxy_proxy_synapse_federation_api_addr_with_container: "matrix-synapse:{{matrix_synapse_container_federation_api_plain_port | string}}" +matrix_nginx_proxy_proxy_synapse_federation_api_addr_sans_container: "127.0.0.1:{{matrix_synapse_container_federation_api_plain_port | string}}" matrix_nginx_proxy_proxy_dendrite_enabled: "{{ matrix_dendrite_enabled }}" -matrix_nginx_proxy_proxy_dendrite_client_api_addr_with_container: "matrix-dendrite:{{ matrix_dendrite_http_bind_port|string }}" -matrix_nginx_proxy_proxy_dendrite_client_api_addr_sans_container: "127.0.0.1:{{ matrix_dendrite_http_bind_port|string }}" -matrix_nginx_proxy_proxy_dendrite_federation_api_addr_with_container: "matrix-dendrite:{{ matrix_dendrite_http_bind_port|string }}" -matrix_nginx_proxy_proxy_dendrite_federation_api_addr_sans_container: "127.0.0.1:{{ matrix_dendrite_http_bind_port|string }}" +matrix_nginx_proxy_proxy_dendrite_client_api_addr_with_container: "matrix-dendrite:{{ matrix_dendrite_http_bind_port | string }}" +matrix_nginx_proxy_proxy_dendrite_client_api_addr_sans_container: "127.0.0.1:{{ matrix_dendrite_http_bind_port | string }}" +matrix_nginx_proxy_proxy_dendrite_federation_api_addr_with_container: "matrix-dendrite:{{ matrix_dendrite_http_bind_port | string }}" +matrix_nginx_proxy_proxy_dendrite_federation_api_addr_sans_container: "127.0.0.1:{{ matrix_dendrite_http_bind_port | string }}" # When matrix-nginx-proxy is disabled, the actual port number that the vhost uses may begin to matter. matrix_nginx_proxy_proxy_matrix_federation_port: "{{ matrix_federation_public_port }}" @@ -1885,14 +1885,14 @@ matrix_postgres_import_roles_to_ignore: | {{ [matrix_postgres_connection_username] + - matrix_postgres_additional_databases|map(attribute='username')|list + matrix_postgres_additional_databases|map(attribute='username') | list }} matrix_postgres_import_databases_to_ignore: | {{ [matrix_postgres_db_name] + - matrix_postgres_additional_databases|map(attribute='name')|list + matrix_postgres_additional_databases|map(attribute='name') | list }} ###################################################################### @@ -2058,18 +2058,18 @@ matrix_synapse_container_image_self_build: "{{ matrix_architecture not in ['arm6 # When ma1sd is enabled, we can use it to validate email addresses and phone numbers. # Synapse can validate email addresses by itself as well, but it's probably not what we want by default when we have an identity server. -matrix_synapse_account_threepid_delegates_email: "{{ 'http://matrix-ma1sd:' + matrix_ma1sd_container_port|string if matrix_ma1sd_enabled else '' }}" -matrix_synapse_account_threepid_delegates_msisdn: "{{ 'http://matrix-ma1sd:' + matrix_ma1sd_container_port|string if matrix_ma1sd_enabled else '' }}" +matrix_synapse_account_threepid_delegates_email: "{{ 'http://matrix-ma1sd:' + matrix_ma1sd_container_port | string if matrix_ma1sd_enabled else '' }}" +matrix_synapse_account_threepid_delegates_msisdn: "{{ 'http://matrix-ma1sd:' + matrix_ma1sd_container_port | string if matrix_ma1sd_enabled else '' }}" # Normally, matrix-nginx-proxy is enabled and nginx can reach Synapse over the container network. # If matrix-nginx-proxy is not enabled, or you otherwise have a need for it, # you can expose Synapse's ports to the host. # # For exposing the Matrix Client API's port (plain HTTP) to the local host. -matrix_synapse_container_client_api_host_bind_port: "{{ '' if matrix_nginx_proxy_enabled else '127.0.0.1:' + matrix_synapse_container_client_api_port|string }}" +matrix_synapse_container_client_api_host_bind_port: "{{ '' if matrix_nginx_proxy_enabled else '127.0.0.1:' + matrix_synapse_container_client_api_port | string }}" # # For exposing the Matrix Federation API's plain port (plain HTTP) to the local host. -matrix_synapse_container_federation_api_plain_host_bind_port: "{{ '' if matrix_nginx_proxy_enabled else '127.0.0.1:' + matrix_synapse_container_federation_api_plain_port|string }}" +matrix_synapse_container_federation_api_plain_host_bind_port: "{{ '' if matrix_nginx_proxy_enabled else '127.0.0.1:' + matrix_synapse_container_federation_api_plain_port | string }}" # # For exposing the Matrix Federation API's TLS port (HTTPS) to the internet on all network interfaces. matrix_synapse_container_federation_api_tls_host_bind_port: "{{ matrix_federation_public_port if (matrix_synapse_federation_enabled and matrix_synapse_tls_federation_listener_enabled) else '' }}" @@ -2213,10 +2213,10 @@ matrix_prometheus_scraper_node_enabled: "{{ matrix_prometheus_node_exporter_enab matrix_prometheus_scraper_node_targets: "{{ ['matrix-prometheus-node-exporter:9100'] if matrix_prometheus_node_exporter_enabled else [] }}" matrix_prometheus_scraper_postgres_enabled: "{{ matrix_prometheus_postgres_exporter_enabled }}" -matrix_prometheus_scraper_postgres_targets: "{{ ['matrix-prometheus-postgres-exporter:'+ matrix_prometheus_postgres_exporter_port|string] if matrix_prometheus_scraper_postgres_enabled else [] }}" +matrix_prometheus_scraper_postgres_targets: "{{ ['matrix-prometheus-postgres-exporter:'+ matrix_prometheus_postgres_exporter_port | string] if matrix_prometheus_scraper_postgres_enabled else [] }}" matrix_prometheus_scraper_hookshot_enabled: "{{ matrix_hookshot_metrics_enabled|default(false) }}" -matrix_prometheus_scraper_hookshot_targets: "{{ [matrix_hookshot_container_url|string +':'+ matrix_hookshot_metrics_port|string] if matrix_hookshot_metrics_enabled else [] }}" +matrix_prometheus_scraper_hookshot_targets: "{{ [matrix_hookshot_container_url | string +':'+ matrix_hookshot_metrics_port | string] if matrix_hookshot_metrics_enabled else [] }}" ###################################################################### # @@ -2345,7 +2345,7 @@ matrix_postgres_backup_databases: | 'name': matrix_synapse_database_database }] if (matrix_synapse_enabled and matrix_synapse_database_database == matrix_postgres_db_name and matrix_synapse_database_host == 'matrix-postgres') else []) + - matrix_postgres_additional_databases)|map(attribute='name')|list + matrix_postgres_additional_databases)|map(attribute='name') | list }} ###################################################################### @@ -2367,10 +2367,10 @@ matrix_dendrite_enabled: "{{ matrix_homeserver_implementation == 'dendrite' }}" # you can expose Dendrite's ports to the host. # # For exposing Dendrite's plain HTTP server to the local host. -matrix_dendrite_container_http_host_bind_address: "{{ '' if matrix_nginx_proxy_enabled else ('127.0.0.1:' + matrix_dendrite_http_bind_port|string) }}" +matrix_dendrite_container_http_host_bind_address: "{{ '' if matrix_nginx_proxy_enabled else ('127.0.0.1:' + matrix_dendrite_http_bind_port | string) }}" # # For exposing Dendrite's HTTPS server to the local host. -matrix_dendrite_container_https_host_bind_address: "{{ '' if matrix_nginx_proxy_enabled or not matrix_dendrite_https_bind_port else ('127.0.0.1:' + matrix_dendrite_https_bind_port|string) }}" +matrix_dendrite_container_https_host_bind_address: "{{ '' if matrix_nginx_proxy_enabled or not matrix_dendrite_https_bind_port else ('127.0.0.1:' + matrix_dendrite_https_bind_port | string) }}" matrix_dendrite_sync_api_real_ip_header: "{{ 'X-Forwarded-For' if matrix_nginx_proxy_enabled else '' }}" diff --git a/roles/matrix-backup-borg/defaults/main.yml b/roles/matrix-backup-borg/defaults/main.yml index ed2ffb72..83a5ca44 100644 --- a/roles/matrix-backup-borg/defaults/main.yml +++ b/roles/matrix-backup-borg/defaults/main.yml @@ -97,4 +97,4 @@ matrix_backup_borg_configuration_extension: "{{ matrix_backup_borg_configuration # 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-base/defaults/main.yml b/roles/matrix-base/defaults/main.yml index a0c0da9b..b3aa3a75 100644 --- a/roles/matrix-base/defaults/main.yml +++ b/roles/matrix-base/defaults/main.yml @@ -134,8 +134,8 @@ matrix_host_command_openssl: "/usr/bin/env openssl" matrix_host_command_systemctl: "/usr/bin/env systemctl" matrix_host_command_sh: "/usr/bin/env sh" -matrix_ntpd_package: "{{ 'systemd-timesyncd' if (ansible_os_family == 'RedHat' and ansible_distribution_major_version|int > 7) or (ansible_distribution == 'Ubuntu' and ansible_distribution_major_version|int > 18) else ( 'systemd' if ansible_os_family == 'Suse' else 'ntp' ) }}" -matrix_ntpd_service: "{{ 'systemd-timesyncd' if (ansible_os_family == 'RedHat' and ansible_distribution_major_version|int > 7) or (ansible_distribution == 'Ubuntu' and ansible_distribution_major_version|int > 18) or ansible_distribution == 'Archlinux' or ansible_os_family == 'Suse' else ('ntpd' if ansible_os_family == 'RedHat' else 'ntp') }}" +matrix_ntpd_package: "{{ 'systemd-timesyncd' if (ansible_os_family == 'RedHat' and ansible_distribution_major_version | int > 7) or (ansible_distribution == 'Ubuntu' and ansible_distribution_major_version | int > 18) else ( 'systemd' if ansible_os_family == 'Suse' else 'ntp' ) }}" +matrix_ntpd_service: "{{ 'systemd-timesyncd' if (ansible_os_family == 'RedHat' and ansible_distribution_major_version | int > 7) or (ansible_distribution == 'Ubuntu' and ansible_distribution_major_version | int > 18) or ansible_distribution == 'Archlinux' or ansible_os_family == 'Suse' else ('ntpd' if ansible_os_family == 'RedHat' else 'ntp') }}" matrix_homeserver_url: "https://{{ matrix_server_fqn_matrix }}" @@ -202,11 +202,11 @@ matrix_well_known_matrix_client_configuration_default: "{{ lookup('template', 't # } matrix_well_known_matrix_client_configuration_extension_json: '{}' -matrix_well_known_matrix_client_configuration_extension: "{{ matrix_well_known_matrix_client_configuration_extension_json|from_json if matrix_well_known_matrix_client_configuration_extension_json|from_json is mapping else {} }}" +matrix_well_known_matrix_client_configuration_extension: "{{ matrix_well_known_matrix_client_configuration_extension_json | from_json if matrix_well_known_matrix_client_configuration_extension_json | from_json is mapping else {} }}" # Holds the final `/.well-known/matrix/client` configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_well_known_matrix_client_configuration_default` and `matrix_well_known_matrix_client_configuration_extension_json`. -matrix_well_known_matrix_client_configuration: "{{ matrix_well_known_matrix_client_configuration_default|combine(matrix_well_known_matrix_client_configuration_extension, recursive=True) }}" +matrix_well_known_matrix_client_configuration: "{{ matrix_well_known_matrix_client_configuration_default | combine(matrix_well_known_matrix_client_configuration_extension, recursive=True) }}" # Default `/.well-known/matrix/server` configuration - it covers the generic use case. # You can customize it by controlling the various variables inside the template file that it references. @@ -234,11 +234,11 @@ matrix_well_known_matrix_server_configuration_default: "{{ lookup('template', 't # } matrix_well_known_matrix_server_configuration_extension_json: '{}' -matrix_well_known_matrix_server_configuration_extension: "{{ matrix_well_known_matrix_server_configuration_extension_json|from_json if matrix_well_known_matrix_server_configuration_extension_json|from_json is mapping else {} }}" +matrix_well_known_matrix_server_configuration_extension: "{{ matrix_well_known_matrix_server_configuration_extension_json | from_json if matrix_well_known_matrix_server_configuration_extension_json | from_json is mapping else {} }}" # Holds the final `/.well-known/matrix/server` configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_well_known_matrix_server_configuration_default` and `matrix_well_known_matrix_server_configuration_extension_json`. -matrix_well_known_matrix_server_configuration: "{{ matrix_well_known_matrix_server_configuration_default|combine(matrix_well_known_matrix_server_configuration_extension, recursive=True) }}" +matrix_well_known_matrix_server_configuration: "{{ matrix_well_known_matrix_server_configuration_default | combine(matrix_well_known_matrix_server_configuration_extension, recursive=True) }}" # The side-effect of this lookup is that Ansible would even parse the JSON for us, returning a dict. # This is unlike what it does when looking up YAML template files (no automatic parsing there). diff --git a/roles/matrix-base/tasks/sanity_check.yml b/roles/matrix-base/tasks/sanity_check.yml index 03ff0afb..76100687 100644 --- a/roles/matrix-base/tasks/sanity_check.yml +++ b/roles/matrix-base/tasks/sanity_check.yml @@ -64,7 +64,7 @@ - "{{ matrix_domain }}" - "{{ matrix_server_fqn_matrix }}" - "{{ matrix_server_fqn_element }}" - when: "item != item|lower" + when: "item != item | lower" - name: Fail if using python2 on Archlinux ansible.builtin.fail: diff --git a/roles/matrix-base/tasks/server_base/setup.yml b/roles/matrix-base/tasks/server_base/setup.yml index cec74590..40d5a4d0 100644 --- a/roles/matrix-base/tasks/server_base/setup.yml +++ b/roles/matrix-base/tasks/server_base/setup.yml @@ -1,13 +1,13 @@ --- - ansible.builtin.include_tasks: "{{ role_path }}/tasks/server_base/setup_redhat.yml" - when: ansible_os_family == 'RedHat' and ansible_distribution_major_version|int < 8 + when: ansible_os_family == 'RedHat' and ansible_distribution_major_version | int < 8 - 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 + when: ansible_os_family == 'RedHat' and ansible_distribution_major_version | int > 7 and ansible_distribution_major_version | int < 30 - ansible.builtin.include_tasks: "{{ role_path }}/tasks/server_base/setup_fedora.yml" - when: ansible_os_family == 'RedHat' and ansible_distribution_major_version|int > 30 + when: ansible_os_family == 'RedHat' and ansible_distribution_major_version | int > 30 - block: # ansible_lsb is only available if lsb-release is installed. @@ -20,7 +20,7 @@ register: lsb_release_installation_result - name: Reread ansible_lsb facts if lsb-release got installed - setup: filter=ansible_lsb* + ansible.builtin.setup: filter=ansible_lsb* when: lsb_release_installation_result.changed - ansible.builtin.include_tasks: "{{ role_path }}/tasks/server_base/setup_debian.yml" diff --git a/roles/matrix-base/tasks/server_base/setup_debian.yml b/roles/matrix-base/tasks/server_base/setup_debian.yml index c463738b..d6ef5cd9 100644 --- a/roles/matrix-base/tasks/server_base/setup_debian.yml +++ b/roles/matrix-base/tasks/server_base/setup_debian.yml @@ -10,8 +10,8 @@ update_cache: true - name: Ensure Docker's APT key is trusted - apt_key: - url: "https://download.docker.com/linux/{{ ansible_distribution|lower }}/gpg" + ansible.builtin.apt_key: + url: "https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg" id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88 state: present register: add_repository_key @@ -19,8 +19,8 @@ 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" + ansible.builtin.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' @@ -36,6 +36,6 @@ ansible.builtin.apt: name: - "{{ matrix_docker_package_name }}" - - "python{{'3' if ansible_python.version.major == 3 else ''}}-docker" + - "python{{ '3' if ansible_python.version.major == 3 else '' }}-docker" state: latest 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 e9ddf54b..b5646c8f 100644 --- a/roles/matrix-base/tasks/server_base/setup_fedora.yml +++ b/roles/matrix-base/tasks/server_base/setup_fedora.yml @@ -12,7 +12,7 @@ when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce' - name: Ensure Docker's RPM key is trusted - rpm_key: + ansible.builtin.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' @@ -33,7 +33,7 @@ when: matrix_docker_installation_enabled | bool - name: Ensure Docker-Py is installed - pip: + ansible.builtin.pip: name: docker-py state: latest 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 6f0b1467..b5eb4016 100644 --- a/roles/matrix-base/tasks/server_base/setup_raspbian.yml +++ b/roles/matrix-base/tasks/server_base/setup_raspbian.yml @@ -10,7 +10,7 @@ update_cache: true - name: Ensure Docker's APT key is trusted - apt_key: + ansible.builtin.apt_key: url: https://download.docker.com/linux/raspbian/gpg id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88 state: present @@ -19,7 +19,7 @@ when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce' - name: Ensure Docker repository is enabled - apt_repository: + ansible.builtin.apt_repository: repo: "deb [arch={{ matrix_debian_arch }}] https://download.docker.com/linux/raspbian {{ ansible_distribution_release }} stable" state: present update_cache: true diff --git a/roles/matrix-base/tasks/server_base/setup_redhat.yml b/roles/matrix-base/tasks/server_base/setup_redhat.yml index 92615ac7..189fcecd 100644 --- a/roles/matrix-base/tasks/server_base/setup_redhat.yml +++ b/roles/matrix-base/tasks/server_base/setup_redhat.yml @@ -10,7 +10,7 @@ when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce' - name: Ensure Docker's RPM key is trusted - rpm_key: + ansible.builtin.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' diff --git a/roles/matrix-base/tasks/server_base/setup_redhat8.yml b/roles/matrix-base/tasks/server_base/setup_redhat8.yml index 7b50160d..9e1aaa01 100644 --- a/roles/matrix-base/tasks/server_base/setup_redhat8.yml +++ b/roles/matrix-base/tasks/server_base/setup_redhat8.yml @@ -10,7 +10,7 @@ when: matrix_docker_installation_enabled | bool and matrix_docker_package_name == 'docker-ce' - name: Ensure Docker's RPM key is trusted - rpm_key: + ansible.builtin.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' @@ -38,7 +38,7 @@ when: matrix_docker_installation_enabled | bool - name: Ensure Docker-Py is installed - pip: + ansible.builtin.pip: name: docker-py state: latest when: matrix_docker_installation_enabled | bool diff --git a/roles/matrix-bot-go-neb/defaults/main.yml b/roles/matrix-bot-go-neb/defaults/main.yml index f01f28fc..61c5d54d 100644 --- a/roles/matrix-bot-go-neb/defaults/main.yml +++ b/roles/matrix-bot-go-neb/defaults/main.yml @@ -228,4 +228,4 @@ matrix_bot_go_neb_configuration_extension: "{{ matrix_bot_go_neb_configuration_e # 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-matrix-reminder-bot/defaults/main.yml b/roles/matrix-bot-matrix-reminder-bot/defaults/main.yml index 8a63413e..9eebed0a 100644 --- a/roles/matrix-bot-matrix-reminder-bot/defaults/main.yml +++ b/roles/matrix-bot-matrix-reminder-bot/defaults/main.yml @@ -97,4 +97,4 @@ matrix_bot_matrix_reminder_bot_configuration_extension: "{{ matrix_bot_matrix_re # 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-mjolnir/defaults/main.yml b/roles/matrix-bot-mjolnir/defaults/main.yml index e03dff40..0be97eae 100644 --- a/roles/matrix-bot-mjolnir/defaults/main.yml +++ b/roles/matrix-bot-mjolnir/defaults/main.yml @@ -56,4 +56,4 @@ matrix_bot_mjolnir_configuration_extension: "{{ matrix_bot_mjolnir_configuration # 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-bridge-appservice-discord/defaults/main.yml b/roles/matrix-bridge-appservice-discord/defaults/main.yml index 0d0d35fb..683d7ecb 100644 --- a/roles/matrix-bridge-appservice-discord/defaults/main.yml +++ b/roles/matrix-bridge-appservice-discord/defaults/main.yml @@ -89,7 +89,7 @@ matrix_appservice_discord_configuration_extension_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: "{{ 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" @@ -99,10 +99,10 @@ matrix_appservice_discord_registration_yaml: | namespaces: users: - exclusive: true - regex: '@_discord_.*:{{ matrix_appservice_discord_homeserver_domain|regex_escape }}' + regex: '@_discord_.*:{{ matrix_appservice_discord_homeserver_domain | regex_escape }}' aliases: - exclusive: true - regex: '#_discord_.*:{{ matrix_appservice_discord_homeserver_domain|regex_escape }}' + regex: '#_discord_.*:{{ matrix_appservice_discord_homeserver_domain | regex_escape }}' url: {{ matrix_appservice_discord_appservice_url }} sender_localpart: _discord_bot rate_limited: false diff --git a/roles/matrix-bridge-appservice-discord/templates/config.yaml.j2 b/roles/matrix-bridge-appservice-discord/templates/config.yaml.j2 index 569a3030..a530af2e 100644 --- a/roles/matrix-bridge-appservice-discord/templates/config.yaml.j2 +++ b/roles/matrix-bridge-appservice-discord/templates/config.yaml.j2 @@ -34,7 +34,7 @@ bridge: determineCodeLanguage: false # Authentication configuration for the discord bot. auth: - clientID: {{ matrix_appservice_discord_client_id|string|to_json }} + clientID: {{ matrix_appservice_discord_client_id | string|to_json }} botToken: {{ matrix_appservice_discord_bot_token|to_json }} # You must enable "Privileged Gateway Intents" in your bot settings on discord.com (e.g. https://discord.com/developers/applications/12345/bot) # for this to work diff --git a/roles/matrix-bridge-appservice-irc/defaults/main.yml b/roles/matrix-bridge-appservice-irc/defaults/main.yml index 19dd9e59..268a05dc 100644 --- a/roles/matrix-bridge-appservice-irc/defaults/main.yml +++ b/roles/matrix-bridge-appservice-irc/defaults/main.yml @@ -384,7 +384,7 @@ matrix_appservice_irc_configuration_extension_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: "{{ 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. diff --git a/roles/matrix-bridge-appservice-irc/tasks/setup_install.yml b/roles/matrix-bridge-appservice-irc/tasks/setup_install.yml index b04b1ade..c3bdd639 100644 --- a/roles/matrix-bridge-appservice-irc/tasks/setup_install.yml +++ b/roles/matrix-bridge-appservice-irc/tasks/setup_install.yml @@ -173,7 +173,7 @@ - name: Combine registration-template.yaml and own registration override config ansible.builtin.set_fact: - matrix_appservice_irc_registration: "{{ matrix_appservice_irc_registration_template|combine(matrix_appservice_irc_registration_override, recursive=True) }}" + matrix_appservice_irc_registration: "{{ matrix_appservice_irc_registration_template | combine(matrix_appservice_irc_registration_override, recursive=True) }}" - name: Ensure Appservice IRC registration.yaml installed ansible.builtin.copy: diff --git a/roles/matrix-bridge-appservice-slack/defaults/main.yml b/roles/matrix-bridge-appservice-slack/defaults/main.yml index 8f88c308..bbbbec99 100644 --- a/roles/matrix-bridge-appservice-slack/defaults/main.yml +++ b/roles/matrix-bridge-appservice-slack/defaults/main.yml @@ -97,7 +97,7 @@ matrix_appservice_slack_configuration_extension_yaml: | 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 }}" diff --git a/roles/matrix-bridge-appservice-webhooks/defaults/main.yml b/roles/matrix-bridge-appservice-webhooks/defaults/main.yml index 0824dc1c..f181f095 100644 --- a/roles/matrix-bridge-appservice-webhooks/defaults/main.yml +++ b/roles/matrix-bridge-appservice-webhooks/defaults/main.yml @@ -63,7 +63,7 @@ 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: "{{ 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 }}" diff --git a/roles/matrix-bridge-beeper-linkedin/defaults/main.yml b/roles/matrix-bridge-beeper-linkedin/defaults/main.yml index 18ca90e9..a8338093 100644 --- a/roles/matrix-bridge-beeper-linkedin/defaults/main.yml +++ b/roles/matrix-bridge-beeper-linkedin/defaults/main.yml @@ -92,7 +92,7 @@ matrix_beeper_linkedin_configuration_extension: "{{ matrix_beeper_linkedin_confi # 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 @@ -104,10 +104,10 @@ matrix_beeper_linkedin_registration_yaml: | rate_limited: false namespaces: users: - - regex: '^@linkedin_.+:{{ matrix_beeper_linkedin_homeserver_domain|regex_escape }}$' + - regex: '^@linkedin_.+:{{ matrix_beeper_linkedin_homeserver_domain | regex_escape }}$' exclusive: true - exclusive: true - regex: '^@{{ matrix_beeper_linkedin_appservice_bot_username|regex_escape }}:{{ matrix_beeper_linkedin_homeserver_domain|regex_escape }}$' + 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 }}" diff --git a/roles/matrix-bridge-go-skype-bridge/defaults/main.yml b/roles/matrix-bridge-go-skype-bridge/defaults/main.yml index dd08fc40..b05e78a5 100644 --- a/roles/matrix-bridge-go-skype-bridge/defaults/main.yml +++ b/roles/matrix-bridge-go-skype-bridge/defaults/main.yml @@ -105,7 +105,7 @@ matrix_go_skype_bridge_configuration_extension: "{{ matrix_go_skype_bridge_confi # 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 @@ -117,10 +117,10 @@ matrix_go_skype_bridge_registration_yaml: | rate_limited: false namespaces: users: - - regex: '^@skype-(.*):{{ matrix_go_skype_bridge_homeserver_domain|regex_escape }}$' + - regex: '^@skype-(.*):{{ matrix_go_skype_bridge_homeserver_domain | regex_escape }}$' exclusive: true - exclusive: true - regex: '^@{{ matrix_go_skype_bridge_appservice_bot_username|regex_escape }}:{{ matrix_go_skype_bridge_homeserver_domain|regex_escape }}$' + 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 }}" diff --git a/roles/matrix-bridge-hookshot/defaults/main.yml b/roles/matrix-bridge-hookshot/defaults/main.yml index ed99ef6d..6ca33b8a 100644 --- a/roles/matrix-bridge-hookshot/defaults/main.yml +++ b/roles/matrix-bridge-hookshot/defaults/main.yml @@ -237,7 +237,7 @@ matrix_hookshot_configuration_extension: "{{ matrix_hookshot_configuration_exten # 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. @@ -259,4 +259,4 @@ matrix_hookshot_registration_extension: "{{ matrix_hookshot_registration_extensi # 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-mautrix-facebook/defaults/main.yml b/roles/matrix-bridge-mautrix-facebook/defaults/main.yml index 0deb244d..51b4f357 100644 --- a/roles/matrix-bridge-mautrix-facebook/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-facebook/defaults/main.yml @@ -114,7 +114,7 @@ matrix_mautrix_facebook_configuration_extension: "{{ matrix_mautrix_facebook_con # 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 @@ -123,9 +123,9 @@ matrix_mautrix_facebook_registration_yaml: | namespaces: users: - exclusive: true - regex: '^@facebook_.+:{{ matrix_mautrix_facebook_homeserver_domain|regex_escape }}$' + regex: '^@facebook_.+:{{ matrix_mautrix_facebook_homeserver_domain | regex_escape }}$' - exclusive: true - regex: '^@{{ matrix_mautrix_facebook_appservice_bot_username|regex_escape }}:{{ matrix_mautrix_facebook_homeserver_domain|regex_escape }}$' + regex: '^@{{ matrix_mautrix_facebook_appservice_bot_username | regex_escape }}:{{ matrix_mautrix_facebook_homeserver_domain | regex_escape }}$' url: {{ matrix_mautrix_facebook_appservice_address }} # See https://github.com/mautrix/signal/issues/43 sender_localpart: _bot_{{ matrix_mautrix_facebook_appservice_bot_username }} diff --git a/roles/matrix-bridge-mautrix-googlechat/defaults/main.yml b/roles/matrix-bridge-mautrix-googlechat/defaults/main.yml index ebac567e..956d7174 100644 --- a/roles/matrix-bridge-mautrix-googlechat/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-googlechat/defaults/main.yml @@ -103,7 +103,7 @@ matrix_mautrix_googlechat_configuration_extension: "{{ matrix_mautrix_googlechat # 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 @@ -112,9 +112,9 @@ matrix_mautrix_googlechat_registration_yaml: | namespaces: users: - exclusive: true - regex: '^@googlechat_.+:{{ matrix_mautrix_googlechat_homeserver_domain|regex_escape }}$' + regex: '^@googlechat_.+:{{ matrix_mautrix_googlechat_homeserver_domain | regex_escape }}$' - exclusive: true - regex: '^@{{ matrix_mautrix_googlechat_appservice_bot_username|regex_escape }}:{{ matrix_mautrix_googlechat_homeserver_domain|regex_escape }}$' + regex: '^@{{ matrix_mautrix_googlechat_appservice_bot_username | regex_escape }}:{{ matrix_mautrix_googlechat_homeserver_domain | regex_escape }}$' url: {{ matrix_mautrix_googlechat_appservice_address }} # See https://github.com/mautrix/signal/issues/43 sender_localpart: _bot_{{ matrix_mautrix_googlechat_appservice_bot_username }} diff --git a/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml b/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml index 77db85fe..aaa9b305 100644 --- a/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml @@ -100,7 +100,7 @@ matrix_mautrix_hangouts_configuration_extension: "{{ matrix_mautrix_hangouts_con # 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 @@ -109,9 +109,9 @@ matrix_mautrix_hangouts_registration_yaml: | namespaces: users: - exclusive: true - regex: '^@hangouts_.+:{{ matrix_mautrix_hangouts_homeserver_domain|regex_escape }}$' + regex: '^@hangouts_.+:{{ matrix_mautrix_hangouts_homeserver_domain | regex_escape }}$' - exclusive: true - regex: '^@{{ matrix_mautrix_hangouts_appservice_bot_username|regex_escape }}:{{ matrix_mautrix_hangouts_homeserver_domain|regex_escape }}$' + regex: '^@{{ matrix_mautrix_hangouts_appservice_bot_username | regex_escape }}:{{ matrix_mautrix_hangouts_homeserver_domain | regex_escape }}$' url: {{ matrix_mautrix_hangouts_appservice_address }} # See https://github.com/mautrix/signal/issues/43 sender_localpart: _bot_{{ matrix_mautrix_hangouts_appservice_bot_username }} diff --git a/roles/matrix-bridge-mautrix-instagram/defaults/main.yml b/roles/matrix-bridge-mautrix-instagram/defaults/main.yml index 8452d6f3..88812397 100644 --- a/roles/matrix-bridge-mautrix-instagram/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-instagram/defaults/main.yml @@ -93,7 +93,7 @@ matrix_mautrix_instagram_configuration_extension: "{{ matrix_mautrix_instagram_c # 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 @@ -102,9 +102,9 @@ matrix_mautrix_instagram_registration_yaml: | namespaces: users: - exclusive: true - regex: '^@instagram_.+:{{ matrix_mautrix_instagram_homeserver_domain|regex_escape }}$' + regex: '^@instagram_.+:{{ matrix_mautrix_instagram_homeserver_domain | regex_escape }}$' - exclusive: true - regex: '^@{{ matrix_mautrix_instagram_appservice_bot_username|regex_escape }}:{{ matrix_mautrix_instagram_homeserver_domain|regex_escape }}$' + regex: '^@{{ matrix_mautrix_instagram_appservice_bot_username | regex_escape }}:{{ matrix_mautrix_instagram_homeserver_domain | regex_escape }}$' url: {{ matrix_mautrix_instagram_appservice_address }} # See https://github.com/mautrix/signal/issues/43 sender_localpart: _bot_{{ matrix_mautrix_instagram_appservice_bot_username }} diff --git a/roles/matrix-bridge-mautrix-signal/defaults/main.yml b/roles/matrix-bridge-mautrix-signal/defaults/main.yml index 429d8ea8..81ddb8cd 100644 --- a/roles/matrix-bridge-mautrix-signal/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-signal/defaults/main.yml @@ -128,7 +128,7 @@ matrix_mautrix_signal_configuration_extension: "{{ matrix_mautrix_signal_configu # 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') }}" diff --git a/roles/matrix-bridge-mautrix-signal/templates/registration.yaml.j2 b/roles/matrix-bridge-mautrix-signal/templates/registration.yaml.j2 index 32e913a1..5d6da2c4 100644 --- a/roles/matrix-bridge-mautrix-signal/templates/registration.yaml.j2 +++ b/roles/matrix-bridge-mautrix-signal/templates/registration.yaml.j2 @@ -5,12 +5,12 @@ hs_token: "{{ matrix_mautrix_signal_homeserver_token }}" namespaces: users: - exclusive: true - regex: '^@signal_.+:{{ matrix_mautrix_signal_homeserver_domain|regex_escape }}$' + regex: '^@signal_.+:{{ matrix_mautrix_signal_homeserver_domain | regex_escape }}$' - exclusive: true - regex: '^@{{ matrix_mautrix_signal_appservice_bot_username|regex_escape }}:{{ matrix_mautrix_signal_homeserver_domain|regex_escape }}$' + regex: '^@{{ matrix_mautrix_signal_appservice_bot_username | regex_escape }}:{{ matrix_mautrix_signal_homeserver_domain | regex_escape }}$' aliases: - exclusive: true - regex: '^#signal_.+:{{ matrix_mautrix_signal_homeserver_domain|regex_escape }}$' + regex: '^#signal_.+:{{ matrix_mautrix_signal_homeserver_domain | regex_escape }}$' url: {{ matrix_mautrix_signal_appservice_address }} # See https://github.com/mautrix/signal/issues/43 sender_localpart: _bot_{{ matrix_mautrix_signal_appservice_bot_username }} diff --git a/roles/matrix-bridge-mautrix-telegram/defaults/main.yml b/roles/matrix-bridge-mautrix-telegram/defaults/main.yml index a76186ae..fd7bf685 100644 --- a/roles/matrix-bridge-mautrix-telegram/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-telegram/defaults/main.yml @@ -121,7 +121,7 @@ matrix_mautrix_telegram_configuration_extension: "{{ matrix_mautrix_telegram_con # 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 @@ -130,12 +130,12 @@ matrix_mautrix_telegram_registration_yaml: | namespaces: users: - exclusive: true - regex: '^@telegram_.+:{{ matrix_mautrix_telegram_homeserver_domain|regex_escape }}$' + regex: '^@telegram_.+:{{ matrix_mautrix_telegram_homeserver_domain | regex_escape }}$' - exclusive: true - regex: '^@{{ matrix_mautrix_telegram_appservice_bot_username|regex_escape }}:{{ matrix_mautrix_telegram_homeserver_domain|regex_escape }}$' + regex: '^@{{ matrix_mautrix_telegram_appservice_bot_username | regex_escape }}:{{ matrix_mautrix_telegram_homeserver_domain | regex_escape }}$' aliases: - exclusive: true - regex: '^#telegram_.+:{{ matrix_mautrix_telegram_homeserver_domain|regex_escape }}$' + regex: '^#telegram_.+:{{ matrix_mautrix_telegram_homeserver_domain | regex_escape }}$' # See https://github.com/mautrix/signal/issues/43 sender_localpart: _bot_{{ matrix_mautrix_telegram_appservice_bot_username }} url: {{ matrix_mautrix_telegram_appservice_address }} diff --git a/roles/matrix-bridge-mautrix-twitter/defaults/main.yml b/roles/matrix-bridge-mautrix-twitter/defaults/main.yml index 4943d715..8bf855dc 100644 --- a/roles/matrix-bridge-mautrix-twitter/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-twitter/defaults/main.yml @@ -91,7 +91,7 @@ matrix_mautrix_twitter_configuration_extension: "{{ matrix_mautrix_twitter_confi # 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 @@ -100,9 +100,9 @@ matrix_mautrix_twitter_registration_yaml: | namespaces: users: - exclusive: true - regex: '^@twitter_.+:{{ matrix_mautrix_twitter_homeserver_domain|regex_escape }}$' + regex: '^@twitter_.+:{{ matrix_mautrix_twitter_homeserver_domain | regex_escape }}$' - exclusive: true - regex: '^@{{ matrix_mautrix_twitter_appservice_bot_username|regex_escape }}:{{ matrix_mautrix_twitter_homeserver_domain|regex_escape }}$' + regex: '^@{{ matrix_mautrix_twitter_appservice_bot_username | regex_escape }}:{{ matrix_mautrix_twitter_homeserver_domain | regex_escape }}$' url: {{ matrix_mautrix_twitter_appservice_address }} # See https://github.com/tulir/mautrix-signal/issues/43 sender_localpart: _bot_{{ matrix_mautrix_twitter_appservice_bot_username }} diff --git a/roles/matrix-bridge-mautrix-whatsapp/defaults/main.yml b/roles/matrix-bridge-mautrix-whatsapp/defaults/main.yml index 9c8652fb..7a511651 100644 --- a/roles/matrix-bridge-mautrix-whatsapp/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-whatsapp/defaults/main.yml @@ -110,7 +110,7 @@ matrix_mautrix_whatsapp_configuration_extension: "{{ matrix_mautrix_whatsapp_con # 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 @@ -122,10 +122,10 @@ matrix_mautrix_whatsapp_registration_yaml: | rate_limited: false namespaces: users: - - regex: '^@whatsapp_[0-9]+:{{ matrix_mautrix_whatsapp_homeserver_domain|regex_escape }}$' + - regex: '^@whatsapp_[0-9]+:{{ matrix_mautrix_whatsapp_homeserver_domain | regex_escape }}$' exclusive: true - exclusive: true - regex: '^@{{ matrix_mautrix_whatsapp_appservice_bot_username|regex_escape }}:{{ matrix_mautrix_whatsapp_homeserver_domain|regex_escape }}$' + 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 }}" diff --git a/roles/matrix-bridge-mx-puppet-discord/defaults/main.yml b/roles/matrix-bridge-mx-puppet-discord/defaults/main.yml index 3402bbbc..085a19aa 100644 --- a/roles/matrix-bridge-mx-puppet-discord/defaults/main.yml +++ b/roles/matrix-bridge-mx-puppet-discord/defaults/main.yml @@ -36,7 +36,7 @@ matrix_mx_puppet_discord_bridge_mediaUrl: "https://{{ matrix_server_fqn_matrix } # "@.*:yourserver.com" to allow users on a specific homeserver # "@.*" to allow anyone matrix_mx_puppet_discord_provisioning_whitelist: - - "@.*:{{ matrix_domain|regex_escape }}" + - "@.*:{{ matrix_domain | regex_escape }}" # Leave empty to disable blacklist # "@user:server.com" disallow a specific user @@ -92,7 +92,7 @@ matrix_mx_puppet_discord_configuration_extension: "{{ matrix_mx_puppet_discord_c # 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 }}" @@ -101,11 +101,11 @@ matrix_mx_puppet_discord_registration_yaml: | namespaces: users: - exclusive: true - regex: '@_discordpuppet_.*:{{ matrix_mx_puppet_discord_homeserver_domain|regex_escape }}' + regex: '@_discordpuppet_.*:{{ matrix_mx_puppet_discord_homeserver_domain | regex_escape }}' rooms: [] aliases: - exclusive: true - regex: '#_discordpuppet_.*:{{ matrix_mx_puppet_discord_homeserver_domain|regex_escape }}' + regex: '#_discordpuppet_.*:{{ matrix_mx_puppet_discord_homeserver_domain | regex_escape }}' protocols: [] rate_limited: false sender_localpart: _discordpuppet_bot diff --git a/roles/matrix-bridge-mx-puppet-groupme/defaults/main.yml b/roles/matrix-bridge-mx-puppet-groupme/defaults/main.yml index f2f7d963..9f0918b6 100644 --- a/roles/matrix-bridge-mx-puppet-groupme/defaults/main.yml +++ b/roles/matrix-bridge-mx-puppet-groupme/defaults/main.yml @@ -32,7 +32,7 @@ matrix_mx_puppet_groupme_appservice_address: 'http://matrix-mx-puppet-groupme:{{ # "@.*:yourserver.com" to allow users on a specific homeserver # "@.*" to allow anyone matrix_mx_puppet_groupme_provisioning_whitelist: - - "@.*:{{ matrix_domain|regex_escape }}" + - "@.*:{{ matrix_domain | regex_escape }}" # Leave empty to disable blacklist # "@user:server.com" disallow a specific user @@ -87,7 +87,7 @@ matrix_mx_puppet_groupme_configuration_extension: "{{ matrix_mx_puppet_groupme_c # 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 }}" @@ -96,11 +96,11 @@ matrix_mx_puppet_groupme_registration_yaml: | namespaces: users: - exclusive: true - regex: '@_groupmepuppet_.*:{{ matrix_mx_puppet_groupme_homeserver_domain|regex_escape }}' + regex: '@_groupmepuppet_.*:{{ matrix_mx_puppet_groupme_homeserver_domain | regex_escape }}' rooms: [] aliases: - exclusive: true - regex: '#_groupmepuppet_.*:{{ matrix_mx_puppet_groupme_homeserver_domain|regex_escape }}' + regex: '#_groupmepuppet_.*:{{ matrix_mx_puppet_groupme_homeserver_domain | regex_escape }}' protocols: [] rate_limited: false sender_localpart: _groupmepuppet_bot diff --git a/roles/matrix-bridge-mx-puppet-instagram/defaults/main.yml b/roles/matrix-bridge-mx-puppet-instagram/defaults/main.yml index 8c68f980..32f287d5 100644 --- a/roles/matrix-bridge-mx-puppet-instagram/defaults/main.yml +++ b/roles/matrix-bridge-mx-puppet-instagram/defaults/main.yml @@ -26,7 +26,7 @@ matrix_mx_puppet_instagram_appservice_address: 'http://matrix-mx-puppet-instagra # "@.*:yourserver.com" to allow users on a specific homeserver # "@.*" to allow anyone matrix_mx_puppet_instagram_provisioning_whitelist: - - "@.*:{{ matrix_domain|regex_escape }}" + - "@.*:{{ matrix_domain | regex_escape }}" # Leave empty to disable blacklist # "@user:server.com" disallow a specific user @@ -81,7 +81,7 @@ matrix_mx_puppet_instagram_configuration_extension: "{{ matrix_mx_puppet_instagr # 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 }}" @@ -90,11 +90,11 @@ matrix_mx_puppet_instagram_registration_yaml: | namespaces: users: - exclusive: true - regex: '@_instagrampuppet_.*:{{ matrix_mx_puppet_instagram_homeserver_domain|regex_escape }}' + regex: '@_instagrampuppet_.*:{{ matrix_mx_puppet_instagram_homeserver_domain | regex_escape }}' rooms: [] aliases: - exclusive: true - regex: '#_instagrampuppet_.*:{{ matrix_mx_puppet_instagram_homeserver_domain|regex_escape }}' + regex: '#_instagrampuppet_.*:{{ matrix_mx_puppet_instagram_homeserver_domain | regex_escape }}' protocols: [] rate_limited: false sender_localpart: _instagrampuppet_bot diff --git a/roles/matrix-bridge-mx-puppet-slack/defaults/main.yml b/roles/matrix-bridge-mx-puppet-slack/defaults/main.yml index cc437ad8..eae0b933 100644 --- a/roles/matrix-bridge-mx-puppet-slack/defaults/main.yml +++ b/roles/matrix-bridge-mx-puppet-slack/defaults/main.yml @@ -40,7 +40,7 @@ matrix_mx_puppet_slack_redirect_uri: 'https://{{ matrix_server_fqn_matrix }}{{ m # "@.*:yourserver.com" to allow users on a specific homeserver # "@.*" to allow anyone matrix_mx_puppet_slack_provisioning_whitelist: - - "@.*:{{ matrix_domain|regex_escape }}" + - "@.*:{{ matrix_domain | regex_escape }}" # Leave empty to disable blacklist # "@user:server.com" disallow a specific user @@ -96,7 +96,7 @@ matrix_mx_puppet_slack_configuration_extension: "{{ matrix_mx_puppet_slack_confi # 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 }}" @@ -105,11 +105,11 @@ matrix_mx_puppet_slack_registration_yaml: | namespaces: users: - exclusive: true - regex: '@_slackpuppet_.*:{{ matrix_mx_puppet_slack_homeserver_domain|regex_escape }}' + regex: '@_slackpuppet_.*:{{ matrix_mx_puppet_slack_homeserver_domain | regex_escape }}' rooms: [] aliases: - exclusive: true - regex: '#_slackpuppet_.*:{{ matrix_mx_puppet_slack_homeserver_domain|regex_escape }}' + regex: '#_slackpuppet_.*:{{ matrix_mx_puppet_slack_homeserver_domain | regex_escape }}' protocols: [] rate_limited: false sender_localpart: _slackpuppet_bot diff --git a/roles/matrix-bridge-mx-puppet-steam/defaults/main.yml b/roles/matrix-bridge-mx-puppet-steam/defaults/main.yml index 933b043c..e4140333 100644 --- a/roles/matrix-bridge-mx-puppet-steam/defaults/main.yml +++ b/roles/matrix-bridge-mx-puppet-steam/defaults/main.yml @@ -32,7 +32,7 @@ matrix_mx_puppet_steam_appservice_address: 'http://matrix-mx-puppet-steam:{{ mat # "@.*:yourserver.com" to allow users on a specific homeserver # "@.*" to allow anyone matrix_mx_puppet_steam_provisioning_whitelist: - - "@.*:{{ matrix_domain|regex_escape }}" + - "@.*:{{ matrix_domain | regex_escape }}" # Leave empty to disable blacklist # "@user:server.com" disallow a specific user @@ -87,7 +87,7 @@ matrix_mx_puppet_steam_configuration_extension: "{{ matrix_mx_puppet_steam_confi # 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 }}" @@ -96,11 +96,11 @@ matrix_mx_puppet_steam_registration_yaml: | namespaces: users: - exclusive: true - regex: '@_steampuppet_.*:{{ matrix_mx_puppet_steam_homeserver_domain|regex_escape }}' + regex: '@_steampuppet_.*:{{ matrix_mx_puppet_steam_homeserver_domain | regex_escape }}' rooms: [] aliases: - exclusive: true - regex: '#_steampuppet_.*:{{ matrix_mx_puppet_steam_homeserver_domain|regex_escape }}' + regex: '#_steampuppet_.*:{{ matrix_mx_puppet_steam_homeserver_domain | regex_escape }}' protocols: [] rate_limited: false sender_localpart: _steampuppet_bot diff --git a/roles/matrix-bridge-mx-puppet-twitter/defaults/main.yml b/roles/matrix-bridge-mx-puppet-twitter/defaults/main.yml index bcd6b4ff..73674220 100644 --- a/roles/matrix-bridge-mx-puppet-twitter/defaults/main.yml +++ b/roles/matrix-bridge-mx-puppet-twitter/defaults/main.yml @@ -41,7 +41,7 @@ matrix_mx_puppet_twitter_webhook_url: 'https://{{ matrix_server_fqn_matrix }}{{ # "@.*:yourserver.com" to allow users on a specific homeserver # "@.*" to allow anyone matrix_mx_puppet_twitter_provisioning_whitelist: - - "@.*:{{ matrix_domain|regex_escape }}" + - "@.*:{{ matrix_domain | regex_escape }}" # Leave empty to disable blacklist # "@user:server.com" disallow a specific user @@ -97,7 +97,7 @@ matrix_mx_puppet_twitter_configuration_extension: "{{ matrix_mx_puppet_twitter_c # 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_ @@ -110,11 +110,11 @@ matrix_mx_puppet_twitter_registration_yaml: | namespaces: users: - exclusive: true - regex: '@{{ matrix_mx_puppet_twitter_namespace_prefix|regex_escape }}.*:{{ matrix_mx_puppet_twitter_homeserver_domain|regex_escape }}' + regex: '@{{ matrix_mx_puppet_twitter_namespace_prefix | regex_escape }}.*:{{ matrix_mx_puppet_twitter_homeserver_domain | regex_escape }}' rooms: [] aliases: - exclusive: true - regex: '#{{ matrix_mx_puppet_twitter_namespace_prefix|regex_escape }}.*:{{ matrix_mx_puppet_twitter_homeserver_domain|regex_escape }}' + regex: '#{{ matrix_mx_puppet_twitter_namespace_prefix | regex_escape }}.*:{{ matrix_mx_puppet_twitter_homeserver_domain | regex_escape }}' protocols: [] rate_limited: false sender_localpart: "{{ matrix_mx_puppet_twitter_bot_localpart }}" 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 23d4a3a6..52c02fa9 100644 --- a/roles/matrix-bridge-mx-puppet-twitter/tasks/setup_install.yml +++ b/roles/matrix-bridge-mx-puppet-twitter/tasks/setup_install.yml @@ -81,6 +81,7 @@ - name: Ensure MX Puppet Twitter repository is present on self build ansible.builtin.git: repo: "{{ matrix_mx_puppet_twitter_container_image_self_build_repo }}" + version: master dest: "{{ matrix_mx_puppet_twitter_docker_src_files_path }}" force: "yes" become: true diff --git a/roles/matrix-bridge-sms/defaults/main.yml b/roles/matrix-bridge-sms/defaults/main.yml index 28a88e31..b4755d71 100644 --- a/roles/matrix-bridge-sms/defaults/main.yml +++ b/roles/matrix-bridge-sms/defaults/main.yml @@ -106,7 +106,7 @@ matrix_sms_bridge_configuration_extension_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: "{{ 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 @@ -115,10 +115,10 @@ matrix_sms_bridge_registration_yaml: | namespaces: users: - exclusive: true - regex: '^@sms_.+:{{ matrix_sms_bridge_homserver_domain|regex_escape }}$' + regex: '^@sms_.+:{{ matrix_sms_bridge_homserver_domain | regex_escape }}$' aliases: - exclusive: true - regex: '^#sms_.+:{{ matrix_sms_bridge_homserver_domain|regex_escape }}$' + regex: '^#sms_.+:{{ matrix_sms_bridge_homserver_domain | regex_escape }}$' url: {{ matrix_sms_bridge_appservice_url }} sender_localpart: smsbot rate_limited: false diff --git a/roles/matrix-client-cinny/defaults/main.yml b/roles/matrix-client-cinny/defaults/main.yml index 277f6e0c..efd88010 100644 --- a/roles/matrix-client-cinny/defaults/main.yml +++ b/roles/matrix-client-cinny/defaults/main.yml @@ -50,8 +50,8 @@ matrix_client_cinny_configuration_default: "{{ lookup('template', 'templates/con # completely redefining `matrix_client_cinny_configuration_default`. matrix_client_cinny_configuration_extension_json: '{}' -matrix_client_cinny_configuration_extension: "{{ matrix_client_cinny_configuration_extension_json|from_json if matrix_client_cinny_configuration_extension_json|from_json is mapping else {} }}" +matrix_client_cinny_configuration_extension: "{{ matrix_client_cinny_configuration_extension_json | from_json if matrix_client_cinny_configuration_extension_json | from_json is mapping else {} }}" # Holds the final cinny configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_client_cinny_configuration_default`. -matrix_client_cinny_configuration: "{{ matrix_client_cinny_configuration_default|combine(matrix_client_cinny_configuration_extension, recursive=True) }}" +matrix_client_cinny_configuration: "{{ matrix_client_cinny_configuration_default | combine(matrix_client_cinny_configuration_extension, recursive=True) }}" diff --git a/roles/matrix-client-cinny/tasks/setup_install.yml b/roles/matrix-client-cinny/tasks/setup_install.yml index 0159ea35..755b872f 100644 --- a/roles/matrix-client-cinny/tasks/setup_install.yml +++ b/roles/matrix-client-cinny/tasks/setup_install.yml @@ -36,7 +36,7 @@ - name: Ensure Cinny configuration installed ansible.builtin.copy: - content: "{{ matrix_client_cinny_configuration|to_nice_json }}" + content: "{{ matrix_client_cinny_configuration | to_nice_json }}" dest: "{{ matrix_client_cinny_data_path }}/config.json" mode: 0644 owner: "{{ matrix_user_username }}" diff --git a/roles/matrix-client-cinny/templates/config.json.j2 b/roles/matrix-client-cinny/templates/config.json.j2 index 9731a372..0da710ac 100644 --- a/roles/matrix-client-cinny/templates/config.json.j2 +++ b/roles/matrix-client-cinny/templates/config.json.j2 @@ -1,6 +1,6 @@ { "defaultHomeserver": 0, "homeserverList": [ - {{ matrix_client_cinny_default_hs_url|string|to_json }} + {{ matrix_client_cinny_default_hs_url | string|to_json }} ] } diff --git a/roles/matrix-client-element/defaults/main.yml b/roles/matrix-client-element/defaults/main.yml index e93b2c7c..e710d0f7 100644 --- a/roles/matrix-client-element/defaults/main.yml +++ b/roles/matrix-client-element/defaults/main.yml @@ -129,8 +129,8 @@ matrix_client_element_configuration_default: "{{ lookup('template', 'templates/c # } matrix_client_element_configuration_extension_json: '{}' -matrix_client_element_configuration_extension: "{{ matrix_client_element_configuration_extension_json|from_json if matrix_client_element_configuration_extension_json|from_json is mapping else {} }}" +matrix_client_element_configuration_extension: "{{ matrix_client_element_configuration_extension_json | from_json if matrix_client_element_configuration_extension_json | from_json is mapping else {} }}" # Holds the final Element configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_client_element_configuration_default`. -matrix_client_element_configuration: "{{ matrix_client_element_configuration_default|combine(matrix_client_element_configuration_extension, recursive=True) }}" +matrix_client_element_configuration: "{{ matrix_client_element_configuration_default | combine(matrix_client_element_configuration_extension, recursive=True) }}" diff --git a/roles/matrix-client-element/tasks/setup_install.yml b/roles/matrix-client-element/tasks/setup_install.yml index 356d5342..5fa34fa6 100644 --- a/roles/matrix-client-element/tasks/setup_install.yml +++ b/roles/matrix-client-element/tasks/setup_install.yml @@ -63,7 +63,7 @@ - name: Ensure Element configuration installed ansible.builtin.copy: - content: "{{ matrix_client_element_configuration|to_nice_json }}" + content: "{{ matrix_client_element_configuration | to_nice_json }}" dest: "{{ matrix_client_element_data_path }}/config.json" mode: 0644 owner: "{{ matrix_user_username }}" diff --git a/roles/matrix-client-element/templates/config.json.j2 b/roles/matrix-client-element/templates/config.json.j2 index e87907e4..e3477398 100644 --- a/roles/matrix-client-element/templates/config.json.j2 +++ b/roles/matrix-client-element/templates/config.json.j2 @@ -1,25 +1,25 @@ { "default_server_config": { "m.homeserver": { - "base_url": {{ matrix_client_element_default_hs_url|string|to_json }}, - "server_name": {{ matrix_client_element_default_server_name|string|to_json }} + "base_url": {{ matrix_client_element_default_hs_url | string|to_json }}, + "server_name": {{ matrix_client_element_default_server_name | string|to_json }} }, "m.identity_server": { - "base_url": {{ matrix_client_element_default_is_url|string|to_json }} + "base_url": {{ matrix_client_element_default_is_url | string|to_json }} } }, "settingDefaults": { "custom_themes": {{ matrix_client_element_settingDefaults_custom_themes|to_json }} }, - "default_theme": {{ matrix_client_element_default_theme|string|to_json }}, - "permalinkPrefix": {{ matrix_client_element_permalinkPrefix|string|to_json }}, + "default_theme": {{ matrix_client_element_default_theme | string|to_json }}, + "permalinkPrefix": {{ matrix_client_element_permalinkPrefix | string|to_json }}, "disable_custom_urls": {{ matrix_client_element_disable_custom_urls|to_json }}, "disable_guests": {{ matrix_client_element_disable_guests|to_json }}, "brand": {{ matrix_client_element_brand|to_json }}, - "integrations_ui_url": {{ matrix_client_element_integrations_ui_url|string|to_json }}, - "integrations_rest_url": {{ matrix_client_element_integrations_rest_url|string|to_json }}, + "integrations_ui_url": {{ matrix_client_element_integrations_ui_url | string|to_json }}, + "integrations_rest_url": {{ matrix_client_element_integrations_rest_url | string|to_json }}, "integrations_widgets_urls": {{ matrix_client_element_integrations_widgets_urls|to_json }}, - "integrations_jitsi_widget_url": {{ matrix_client_element_integrations_jitsi_widget_url|string|to_json }}, + "integrations_jitsi_widget_url": {{ matrix_client_element_integrations_jitsi_widget_url | string|to_json }}, "bug_report_endpoint_url": {{ matrix_client_element_bug_report_endpoint_url|to_json }}, "showLabsSettings": {{ matrix_client_element_showLabsSettings|to_json }}, "roomDirectory": { @@ -30,7 +30,7 @@ "enable_presence_by_hs_url": {{ matrix_client_element_enable_presence_by_hs_url|to_json }}, {% endif %} "embeddedPages": { - "homeUrl": {{ matrix_client_element_embedded_pages_home_url|string|to_json }} + "homeUrl": {{ matrix_client_element_embedded_pages_home_url | string|to_json }} }, {% if matrix_client_element_jitsi_preferredDomain %} "jitsi": { diff --git a/roles/matrix-client-hydrogen/defaults/main.yml b/roles/matrix-client-hydrogen/defaults/main.yml index 8171fc12..1baccdd3 100644 --- a/roles/matrix-client-hydrogen/defaults/main.yml +++ b/roles/matrix-client-hydrogen/defaults/main.yml @@ -64,8 +64,8 @@ matrix_client_hydrogen_configuration_default: "{{ lookup('template', 'templates/ # } matrix_client_hydrogen_configuration_extension_json: '{}' -matrix_client_hydrogen_configuration_extension: "{{ matrix_client_hydrogen_configuration_extension_json|from_json if matrix_client_hydrogen_configuration_extension_json|from_json is mapping else {} }}" +matrix_client_hydrogen_configuration_extension: "{{ matrix_client_hydrogen_configuration_extension_json | from_json if matrix_client_hydrogen_configuration_extension_json | from_json is mapping else {} }}" # Holds the final Hydrogen configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_client_hydrogen_configuration_default`. -matrix_client_hydrogen_configuration: "{{ matrix_client_hydrogen_configuration_default|combine(matrix_client_hydrogen_configuration_extension, recursive=True) }}" +matrix_client_hydrogen_configuration: "{{ matrix_client_hydrogen_configuration_default | combine(matrix_client_hydrogen_configuration_extension, recursive=True) }}" diff --git a/roles/matrix-client-hydrogen/tasks/setup_install.yml b/roles/matrix-client-hydrogen/tasks/setup_install.yml index 37877b87..4cd445d0 100644 --- a/roles/matrix-client-hydrogen/tasks/setup_install.yml +++ b/roles/matrix-client-hydrogen/tasks/setup_install.yml @@ -37,7 +37,7 @@ - name: Ensure Hydrogen configuration installed ansible.builtin.copy: - content: "{{ matrix_client_hydrogen_configuration|to_nice_json }}" + content: "{{ matrix_client_hydrogen_configuration | to_nice_json }}" dest: "{{ matrix_client_hydrogen_docker_src_files_path }}/src/platform/web/assets/config.json" mode: 0644 owner: "{{ matrix_user_username }}" diff --git a/roles/matrix-client-hydrogen/templates/config.json.j2 b/roles/matrix-client-hydrogen/templates/config.json.j2 index 3e556354..0c4331b6 100644 --- a/roles/matrix-client-hydrogen/templates/config.json.j2 +++ b/roles/matrix-client-hydrogen/templates/config.json.j2 @@ -4,7 +4,7 @@ "gatewayUrl": "https://matrix.org", "applicationServerKey": "BC-gpSdVHEXhvHSHS0AzzWrQoukv2BE7KzpoPO_FfPacqOo3l1pdqz7rSgmB04pZCWaHPz7XRe6fjLaC-WPDopM" }, - "defaultHomeServer": {{ matrix_client_hydrogen_default_hs_url|string|to_json }}, + "defaultHomeServer": {{ matrix_client_hydrogen_default_hs_url | string|to_json }}, "bugReportEndpointUrl": "https://element.io/bugreports/submit", "themeManifests": [ "assets/theme-Element.json" diff --git a/roles/matrix-corporal/defaults/main.yml b/roles/matrix-corporal/defaults/main.yml index 1aa512ee..bb1b8fa1 100644 --- a/roles/matrix-corporal/defaults/main.yml +++ b/roles/matrix-corporal/defaults/main.yml @@ -100,8 +100,8 @@ matrix_corporal_configuration_default: "{{ lookup('template', 'templates/config. # } matrix_corporal_configuration_extension_json: '{}' -matrix_corporal_configuration_extension: "{{ matrix_corporal_configuration_extension_json|from_json if matrix_corporal_configuration_extension_json|from_json is mapping else {} }}" +matrix_corporal_configuration_extension: "{{ matrix_corporal_configuration_extension_json | from_json if matrix_corporal_configuration_extension_json | from_json is mapping else {} }}" # Holds the final Corporal configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_corporal_configuration_default`. -matrix_corporal_configuration: "{{ matrix_corporal_configuration_default|combine(matrix_corporal_configuration_extension, recursive=True) }}" +matrix_corporal_configuration: "{{ matrix_corporal_configuration_default | combine(matrix_corporal_configuration_extension, recursive=True) }}" diff --git a/roles/matrix-corporal/tasks/setup_corporal.yml b/roles/matrix-corporal/tasks/setup_corporal.yml index 2f745502..583c27eb 100644 --- a/roles/matrix-corporal/tasks/setup_corporal.yml +++ b/roles/matrix-corporal/tasks/setup_corporal.yml @@ -54,7 +54,7 @@ - name: Ensure Matrix Corporal config installed ansible.builtin.copy: - content: "{{ matrix_corporal_configuration|to_nice_json }}" + content: "{{ matrix_corporal_configuration | to_nice_json }}" dest: "{{ matrix_corporal_config_dir_path }}/config.json" mode: 0644 owner: "{{ matrix_user_username }}" diff --git a/roles/matrix-dendrite/defaults/main.yml b/roles/matrix-dendrite/defaults/main.yml index d790fcc9..dd6d351e 100644 --- a/roles/matrix-dendrite/defaults/main.yml +++ b/roles/matrix-dendrite/defaults/main.yml @@ -27,10 +27,10 @@ matrix_dendrite_http_bind_port: 8008 matrix_dendrite_https_bind_port: ~ # This is passed as an `-http-bind-address` flag to the Dendrite server in the container -matrix_dendrite_http_bind_address: "{{ (':' + matrix_dendrite_http_bind_port|string) if matrix_dendrite_http_bind_port else '' }}" +matrix_dendrite_http_bind_address: "{{ (':' + matrix_dendrite_http_bind_port | string) if matrix_dendrite_http_bind_port else '' }}" # This is passed as an `-https-bind-address` flag to the Dendrite server in the container -matrix_dendrite_https_bind_address: "{{ (':' + matrix_dendrite_https_bind_port|string) if matrix_dendrite_https_bind_port else '' }}" +matrix_dendrite_https_bind_address: "{{ (':' + matrix_dendrite_https_bind_port | string) if matrix_dendrite_https_bind_port else '' }}" # Controls whether the matrix-dendrite container exposes the HTTP port (tcp/{{ matrix_dendrite_http_bind_port }} in the container). # @@ -171,4 +171,4 @@ matrix_dendrite_configuration_extension: "{{ matrix_dendrite_configuration_exten # 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/templates/dendrite/dendrite.yaml.j2 b/roles/matrix-dendrite/templates/dendrite/dendrite.yaml.j2 index fcede405..29f5c55f 100644 --- a/roles/matrix-dendrite/templates/dendrite/dendrite.yaml.j2 +++ b/roles/matrix-dendrite/templates/dendrite/dendrite.yaml.j2 @@ -165,7 +165,7 @@ client_api: # If set, allows registration by anyone who knows the shared secret, regardless of # whether registration is otherwise disabled. - registration_shared_secret: {{ matrix_dendrite_registration_shared_secret|string|to_json }} + registration_shared_secret: {{ matrix_dendrite_registration_shared_secret | string|to_json }} # Whether to require reCAPTCHA for registration. enable_registration_captcha: {{ matrix_dendrite_enable_registration_captcha|to_json }} diff --git a/roles/matrix-dendrite/vars/main.yml b/roles/matrix-dendrite/vars/main.yml index d0c07c0c..fcf020c2 100644 --- a/roles/matrix-dendrite/vars/main.yml +++ b/roles/matrix-dendrite/vars/main.yml @@ -5,7 +5,7 @@ matrix_dendrite_federation_api_url_endpoint_public: "https://{{ matrix_server_fq # Tells whether this role had executed or not. Toggled to `true` during runtime. matrix_dendrite_role_executed: false -matrix_dendrite_media_store_parent_path: "{{ matrix_dendrite_media_store_path|dirname }}" +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_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 1af7f293..a330accb 100644 --- a/roles/matrix-dimension/defaults/main.yml +++ b/roles/matrix-dimension/defaults/main.yml @@ -97,4 +97,4 @@ matrix_dimension_configuration_extension: "{{ matrix_dimension_configuration_ext # 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-dynamic-dns/defaults/main.yml b/roles/matrix-dynamic-dns/defaults/main.yml index 1da87f38..bdeea0f1 100644 --- a/roles/matrix-dynamic-dns/defaults/main.yml +++ b/roles/matrix-dynamic-dns/defaults/main.yml @@ -29,6 +29,7 @@ matrix_dynamic_dns_systemd_required_services_list: ['docker.service'] # Build the container from source when running in mode matrix_dynamic_dns_container_image_self_build: false matrix_dynamic_dns_container_image_self_build_repo: "https://github.com/linuxserver/docker-ddclient.git" +matrix_dynamic_dns_container_image_self_build_repo_branch: "{{ matrix_dynamic_dns_version }}" # Config paths matrix_dynamic_dns_base_path: "{{ matrix_base_data_path }}/dynamic-dns" diff --git a/roles/matrix-dynamic-dns/tasks/install.yml b/roles/matrix-dynamic-dns/tasks/install.yml index 8c7f3fc7..e83637bf 100644 --- a/roles/matrix-dynamic-dns/tasks/install.yml +++ b/roles/matrix-dynamic-dns/tasks/install.yml @@ -28,6 +28,7 @@ - name: Ensure Dynamic DNS repository is present on self build ansible.builtin.git: repo: "{{ matrix_dynamic_dns_container_image_self_build_repo }}" + version: "{{ matrix_dynamic_dns_container_image_self_build_repo_branch }}" dest: "{{ matrix_dynamic_dns_docker_src_files_path }}" force: "yes" become: true diff --git a/roles/matrix-email2matrix/templates/config.json.j2 b/roles/matrix-email2matrix/templates/config.json.j2 index c1be97fd..a7ca7bc4 100644 --- a/roles/matrix-email2matrix/templates/config.json.j2 +++ b/roles/matrix-email2matrix/templates/config.json.j2 @@ -6,7 +6,7 @@ "Workers": 10 }, "Matrix": { - "Mappings": {{ matrix_email2matrix_matrix_mappings|to_nice_json }} + "Mappings": {{ matrix_email2matrix_matrix_mappings | to_nice_json }} }, "Misc": { "Debug": {{ matrix_email2matrix_misc_debug|to_json }} diff --git a/roles/matrix-etherpad/defaults/main.yml b/roles/matrix-etherpad/defaults/main.yml index 656e43f9..8281f27f 100644 --- a/roles/matrix-etherpad/defaults/main.yml +++ b/roles/matrix-etherpad/defaults/main.yml @@ -88,8 +88,8 @@ matrix_etherpad_configuration_default: "{{ lookup('template', 'templates/setting # matrix_etherpad_configuration_extension_json: '{}' -matrix_etherpad_configuration_extension: "{{ matrix_etherpad_configuration_extension_json|from_json if matrix_etherpad_configuration_extension_json|from_json is mapping else {} }}" +matrix_etherpad_configuration_extension: "{{ matrix_etherpad_configuration_extension_json | from_json if matrix_etherpad_configuration_extension_json | from_json is mapping else {} }}" # Holds the final Etherpad configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_etherpad_configuration_json`. -matrix_etherpad_configuration: "{{ matrix_etherpad_configuration_default|combine(matrix_etherpad_configuration_extension, recursive=True) }}" +matrix_etherpad_configuration: "{{ matrix_etherpad_configuration_default | combine(matrix_etherpad_configuration_extension, recursive=True) }}" diff --git a/roles/matrix-etherpad/tasks/setup_install.yml b/roles/matrix-etherpad/tasks/setup_install.yml index e3b1397f..0243e9d7 100644 --- a/roles/matrix-etherpad/tasks/setup_install.yml +++ b/roles/matrix-etherpad/tasks/setup_install.yml @@ -10,7 +10,7 @@ - name: Ensure Etherpad config installed ansible.builtin.copy: - content: "{{ matrix_etherpad_configuration|to_nice_json }}" + content: "{{ matrix_etherpad_configuration | to_nice_json }}" dest: "{{ matrix_etherpad_base_path }}/settings.json" mode: 0640 owner: "{{ matrix_etherpad_user_uid }}" diff --git a/roles/matrix-jitsi/tasks/util/setup_jitsi_auth.yml b/roles/matrix-jitsi/tasks/util/setup_jitsi_auth.yml index 8c25fa3a..d9da9ebe 100644 --- a/roles/matrix-jitsi/tasks/util/setup_jitsi_auth.yml +++ b/roles/matrix-jitsi/tasks/util/setup_jitsi_auth.yml @@ -15,11 +15,13 @@ # - name: Ensure Jitsi internal authentication users are configured - ansible.builtin.shell: "docker exec matrix-jitsi-prosody prosodyctl --config /config/prosody.cfg.lua register {{ item.username | quote }} meet.jitsi {{ item.password | quote }}" + ansible.builtin.shell: "{{ matrix_host_command_docker }} exec matrix-jitsi-prosody prosodyctl --config /config/prosody.cfg.lua register {{ item.username | quote }} meet.jitsi {{ item.password | quote }}" with_items: "{{ matrix_jitsi_prosody_auth_internal_accounts }}" when: - matrix_jitsi_auth_type == "internal" - matrix_jitsi_prosody_auth_internal_accounts|length > 0 + register: matrix_jitsi_user_configuration_result + changed_when: matrix_jitsi_user_configuration_result.rc == 0 # # Tasks related to configuring other Jitsi authentication mechanisms diff --git a/roles/matrix-ma1sd/defaults/main.yml b/roles/matrix-ma1sd/defaults/main.yml index b62225e7..65768265 100644 --- a/roles/matrix-ma1sd/defaults/main.yml +++ b/roles/matrix-ma1sd/defaults/main.yml @@ -160,4 +160,4 @@ matrix_ma1sd_configuration_extension: "{{ matrix_ma1sd_configuration_extension_y # 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/setup_install.yml b/roles/matrix-ma1sd/tasks/setup_install.yml index 3995da24..61f01b29 100644 --- a/roles/matrix-ma1sd/tasks/setup_install.yml +++ b/roles/matrix-ma1sd/tasks/setup_install.yml @@ -90,9 +90,11 @@ register: matrix_ma1sd_git_pull_results - name: Ensure ma1sd Docker image is built - ansible.builtin.shell: "DOCKER_BUILDKIT=1 ./gradlew dockerBuild" - args: + ansible.builtin.command: + cmd: ./gradlew dockerBuild chdir: "{{ matrix_ma1sd_docker_src_files_path }}" + environment: + DOCKER_BUILDKIT: 1 when: matrix_ma1sd_git_pull_results.changed - name: Ensure ma1sd Docker image is tagged correctly diff --git a/roles/matrix-nginx-proxy/tasks/nginx-proxy/setup_metrics_auth.yml b/roles/matrix-nginx-proxy/tasks/nginx-proxy/setup_metrics_auth.yml index 5d100577..c511e402 100644 --- a/roles/matrix-nginx-proxy/tasks/nginx-proxy/setup_metrics_auth.yml +++ b/roles/matrix-nginx-proxy/tasks/nginx-proxy/setup_metrics_auth.yml @@ -51,6 +51,7 @@ {{ matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_apache_container_image }} -c 'cat /password | htpasswd -i -c /data/matrix-metrics-htpasswd {{ matrix_nginx_proxy_proxy_matrix_metrics_basic_auth_username }} && chmod 600 /data/matrix-metrics-htpasswd' + changed_when: true - name: Delete temporary metrics password file ansible.builtin.file: diff --git a/roles/matrix-nginx-proxy/tasks/self_check_well_known_file.yml b/roles/matrix-nginx-proxy/tasks/self_check_well_known_file.yml index 0a7b5845..95a43dea 100644 --- a/roles/matrix-nginx-proxy/tasks/self_check_well_known_file.yml +++ b/roles/matrix-nginx-proxy/tasks/self_check_well_known_file.yml @@ -25,7 +25,7 @@ - name: Parse JSON for well-known payload at the matrix hostname ansible.builtin.set_fact: - well_known_matrix_payload: "{{ result_well_known_matrix.content|from_json }}" + well_known_matrix_payload: "{{ result_well_known_matrix.content | from_json }}" - name: Fail if .well-known not CORS-aware on the matrix hostname ansible.builtin.fail: @@ -55,7 +55,7 @@ - name: Parse JSON for well-known payload at the identity hostname ansible.builtin.set_fact: - well_known_identity_payload: "{{ result_well_known_identity.content|from_json }}" + well_known_identity_payload: "{{ result_well_known_identity.content | from_json }}" - name: Fail if .well-known not CORS-aware on the identity hostname ansible.builtin.fail: 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 889a33ba..d0b254a2 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 @@ -13,7 +13,7 @@ # In order to do any sort of generation (below), we need to ensure the directory exists first - name: Ensure SSL certificate directory exists ansible.builtin.file: - path: "{{ matrix_ssl_certificate_csr_path|dirname }}" + path: "{{ matrix_ssl_certificate_csr_path | dirname }}" state: directory mode: 0750 owner: "{{ matrix_user_username }}" diff --git a/roles/matrix-nginx-proxy/templates/nginx/conf.d/matrix-synapse.conf.j2 b/roles/matrix-nginx-proxy/templates/nginx/conf.d/matrix-synapse.conf.j2 index 69f13a1a..735f4538 100644 --- a/roles/matrix-nginx-proxy/templates/nginx/conf.d/matrix-synapse.conf.j2 +++ b/roles/matrix-nginx-proxy/templates/nginx/conf.d/matrix-synapse.conf.j2 @@ -1,9 +1,9 @@ #jinja2: lstrip_blocks: "True" -{% set generic_workers = matrix_nginx_proxy_synapse_workers_list|selectattr('type', 'equalto', 'generic_worker')|list %} -{% set media_repository_workers = matrix_nginx_proxy_synapse_workers_list|selectattr('type', 'equalto', 'media_repository')|list %} -{% set user_dir_workers = matrix_nginx_proxy_synapse_workers_list|selectattr('type', 'equalto', 'user_dir')|list %} -{% set frontend_proxy_workers = matrix_nginx_proxy_synapse_workers_list|selectattr('type', 'equalto', 'frontend_proxy')|list %} +{% set generic_workers = matrix_nginx_proxy_synapse_workers_list | selectattr('type', 'equalto', 'generic_worker') | list %} +{% set media_repository_workers = matrix_nginx_proxy_synapse_workers_list | selectattr('type', 'equalto', 'media_repository') | list %} +{% set user_dir_workers = matrix_nginx_proxy_synapse_workers_list | selectattr('type', 'equalto', 'user_dir') | list %} +{% set frontend_proxy_workers = matrix_nginx_proxy_synapse_workers_list | selectattr('type', 'equalto', 'frontend_proxy') | list %} {% if matrix_nginx_proxy_synapse_workers_enabled %} {% if matrix_nginx_proxy_synapse_cache_enabled %} proxy_cache_path {{ matrix_nginx_proxy_synapse_cache_path }} levels=1:2 keys_zone={{ matrix_nginx_proxy_synapse_cache_keys_zone_name }}:{{ matrix_nginx_proxy_synapse_cache_keys_zone_size }} inactive={{ matrix_nginx_proxy_synapse_cache_inactive_time }} max_size={{ matrix_nginx_proxy_synapse_cache_max_size_mb }}m; diff --git a/roles/matrix-ntfy/defaults/main.yml b/roles/matrix-ntfy/defaults/main.yml index 9f0a6eb8..66bc5be4 100644 --- a/roles/matrix-ntfy/defaults/main.yml +++ b/roles/matrix-ntfy/defaults/main.yml @@ -45,4 +45,4 @@ matrix_ntfy_configuration_extension: "{{ matrix_ntfy_configuration_extension_yam # 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-postgres-backup/tasks/util/detect_existing_postgres_version.yml b/roles/matrix-postgres-backup/tasks/util/detect_existing_postgres_version.yml index cce35e00..877e5934 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 @@ -27,7 +27,7 @@ - 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', '') }}" + matrix_postgres_backup_detected_version: "{{ result_pg_version['content'] | b64decode | replace('\n', '') }}" when: matrix_postgres_backup_detected_existing | bool - name: Determine corresponding Docker image to detected version (assume default of latest) diff --git a/roles/matrix-postgres/tasks/util/create_additional_database.yml b/roles/matrix-postgres/tasks/util/create_additional_database.yml index b4fee2c8..da95b870 100644 --- a/roles/matrix-postgres/tasks/util/create_additional_database.yml +++ b/roles/matrix-postgres/tasks/util/create_additional_database.yml @@ -33,6 +33,7 @@ {{ matrix_postgres_docker_image_to_use }} -c 'psql -h {{ matrix_postgres_connection_hostname }} --file=/matrix-postgres-init-additional-db-user-and-role.sql' + changed_when: true - name: Delete additional database initialization SQL file for {{ additional_db.name }} ansible.builtin.file: 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 e19dfbea..2d03cd7f 100644 --- a/roles/matrix-postgres/tasks/util/detect_existing_postgres_version.yml +++ b/roles/matrix-postgres/tasks/util/detect_existing_postgres_version.yml @@ -27,7 +27,7 @@ - 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', '') }}" + matrix_postgres_detected_version: "{{ result_pg_version['content'] | b64decode | replace('\n', '') }}" when: matrix_postgres_detected_existing | bool - name: Determine corresponding Docker image to detected version (assume default of latest) 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 469eb86a..83d0d4e9 100644 --- a/roles/matrix-postgres/tasks/util/migrate_db_to_postgres.yml +++ b/roles/matrix-postgres/tasks/util/migrate_db_to_postgres.yml @@ -131,6 +131,8 @@ {{ matrix_postgres_pgloader_docker_image }} -c 'pgloader {{ matrix_postgres_db_migration_request.pgloader_options | default([]) | join(' ') }} /in.db {{ matrix_postgres_db_migration_request.dst }}' + register: matrix_postgres_migrate_db_to_postgres_import_result + changed_when: matrix_postgres_migrate_db_to_postgres_import_result.rc == 0 - block: # We can't use `{{ role_path }}` here, neither with `import_tasks`, nor with `include_tasks`, @@ -152,12 +154,16 @@ {{ matrix_postgres_docker_image_to_use }} 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 }}" + register: matrix_postgres_migrate_db_to_postgres_additional_queries_result + changed_when: matrix_postgres_migrate_db_to_postgres_additional_queries_result.rc == 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: cmd: "mv {{ matrix_postgres_db_migration_request.src }} {{ matrix_postgres_db_migration_request.src }}.backup" + register: matrix_postgres_migrate_db_to_postgres_move_result + changed_when: matrix_postgres_migrate_db_to_postgres_move_result.rc == 0 - name: Inject result ansible.builtin.set_fact: diff --git a/roles/matrix-prometheus-postgres-exporter/defaults/main.yml b/roles/matrix-prometheus-postgres-exporter/defaults/main.yml index b7cd08b9..82a12f42 100644 --- a/roles/matrix-prometheus-postgres-exporter/defaults/main.yml +++ b/roles/matrix-prometheus-postgres-exporter/defaults/main.yml @@ -12,8 +12,8 @@ matrix_prometheus_postgres_exporter_docker_image_force_pull: "{{ matrix_promethe # A list of extra arguments to pass to the container matrix_prometheus_postgres_exporter_container_extra_arguments: ["-e PG_EXPORTER_AUTO_DISCOVER_DATABASES=true", - "-e PG_EXPORTER_WEB_LISTEN_ADDRESS=\":{{matrix_prometheus_postgres_exporter_port}}\"", - "-e DATA_SOURCE_NAME=\"postgresql://{{matrix_prometheus_postgres_exporter_database_username}}:{{matrix_prometheus_postgres_exporter_database_password}}@{{matrix_prometheus_postgres_exporter_database_hostname}}:5432/{{matrix_prometheus_postgres_exporter_database_name}}?sslmode=disable\""] + "-e PG_EXPORTER_WEB_LISTEN_ADDRESS=\":{{ matrix_prometheus_postgres_exporter_port }}\"", + "-e DATA_SOURCE_NAME=\"postgresql://{{ matrix_prometheus_postgres_exporter_database_username }}:{{ matrix_prometheus_postgres_exporter_database_password }}@{{ matrix_prometheus_postgres_exporter_database_hostname }}:5432/{{ matrix_prometheus_postgres_exporter_database_name }}?sslmode=disable\""] # List of systemd services that matrix-prometheus-postgres-exporter.service depends on matrix_prometheus_postgres_exporter_systemd_required_services_list: ['docker.service'] diff --git a/roles/matrix-prometheus/defaults/main.yml b/roles/matrix-prometheus/defaults/main.yml index aeb6ea6d..8f5c2148 100644 --- a/roles/matrix-prometheus/defaults/main.yml +++ b/roles/matrix-prometheus/defaults/main.yml @@ -79,4 +79,4 @@ matrix_prometheus_configuration_extension: "{{ matrix_prometheus_configuration_e # 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-registration/defaults/main.yml b/roles/matrix-registration/defaults/main.yml index 060f51a2..1e53ae98 100644 --- a/roles/matrix-registration/defaults/main.yml +++ b/roles/matrix-registration/defaults/main.yml @@ -119,4 +119,4 @@ matrix_registration_configuration_extension: "{{ matrix_registration_configurati # 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-sygnal/defaults/main.yml b/roles/matrix-sygnal/defaults/main.yml index 2c0f3a86..1268d602 100644 --- a/roles/matrix-sygnal/defaults/main.yml +++ b/roles/matrix-sygnal/defaults/main.yml @@ -73,4 +73,4 @@ matrix_sygnal_configuration_extension: "{{ matrix_sygnal_configuration_extension # 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-synapse/defaults/main.yml b/roles/matrix-synapse/defaults/main.yml index 279730bf..87ef3d6a 100644 --- a/roles/matrix-synapse/defaults/main.yml +++ b/roles/matrix-synapse/defaults/main.yml @@ -523,7 +523,7 @@ matrix_synapse_ext_password_provider_shared_secret_auth_m_login_password_support 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_yaml: | - shared_secret: {{ matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret|string | 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 }} @@ -682,4 +682,4 @@ matrix_synapse_configuration_extension: "{{ matrix_synapse_configuration_extensi # 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/register_user.yml b/roles/matrix-synapse/tasks/register_user.yml index d7354d05..8c344b2d 100644 --- a/roles/matrix-synapse/tasks/register_user.yml +++ b/roles/matrix-synapse/tasks/register_user.yml @@ -29,3 +29,5 @@ - name: Register user ansible.builtin.command: "{{ matrix_local_bin_path }}/matrix-synapse-register-user {{ username|quote }} {{ password|quote }} {{ '1' if admin == 'yes' else '0' }}" + register: matrix_synapse_register_user_result + changed_when: matrix_synapse_register_user_result.rc == 0 diff --git a/roles/matrix-synapse/tasks/rust-synapse-compress-state/compress_room.yml b/roles/matrix-synapse/tasks/rust-synapse-compress-state/compress_room.yml index 30849ded..221a7570 100644 --- a/roles/matrix-synapse/tasks/rust-synapse-compress-state/compress_room.yml +++ b/roles/matrix-synapse/tasks/rust-synapse-compress-state/compress_room.yml @@ -21,6 +21,7 @@ async: "{{ matrix_synapse_rust_synapse_compress_state_compress_room_time }}" poll: 10 register: matrix_synapse_rust_synapse_compress_state_compress_room_command_result + changed_when: matrix_synapse_rust_synapse_compress_state_compress_room_command_result.rc == 0 - ansible.builtin.debug: var="matrix_synapse_rust_synapse_compress_state_compress_room_command_result" @@ -43,6 +44,7 @@ async: "{{ matrix_synapse_rust_synapse_compress_state_psql_import_time }}" poll: 10 register: matrix_synapse_rust_synapse_compress_state_psql_import_command_result + changed_when: matrix_synapse_rust_synapse_compress_state_psql_import_command_result.rc == 0 - name: Clean up ansible.builtin.file: 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 097b816a..fcea8606 100644 --- a/roles/matrix-synapse/tasks/rust-synapse-compress-state/main.yml +++ b/roles/matrix-synapse/tasks/rust-synapse-compress-state/main.yml @@ -70,6 +70,7 @@ async: "{{ matrix_synapse_rust_synapse_compress_state_find_rooms_command_wait_time }}" poll: 10 register: matrix_synapse_rust_synapse_compress_state_find_rooms_command_result + changed_when: false # We expect the output to be like this: # diff --git a/roles/matrix-synapse/tasks/synapse/setup_install.yml b/roles/matrix-synapse/tasks/synapse/setup_install.yml index 51e22d75..e4ec0f67 100644 --- a/roles/matrix-synapse/tasks/synapse/setup_install.yml +++ b/roles/matrix-synapse/tasks/synapse/setup_install.yml @@ -32,6 +32,7 @@ - name: Check if Synapse Docker image exists ansible.builtin.command: "{{ matrix_host_command_docker }} images --quiet --filter 'reference={{ matrix_synapse_docker_image }}'" register: matrix_synapse_docker_image_check_result + changed_when: false # Invoking the `docker build` command here, instead of calling the `docker_image` Ansible module, # because the latter does not support BuildKit. diff --git a/roles/matrix-synapse/tasks/synapse/workers/init.yml b/roles/matrix-synapse/tasks/synapse/workers/init.yml index 7c396422..4b007bc3 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,7 +64,7 @@ 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] }}" diff --git a/roles/matrix-synapse/tasks/synapse/workers/setup_uninstall.yml b/roles/matrix-synapse/tasks/synapse/workers/setup_uninstall.yml index f79a4115..98c81a2e 100644 --- a/roles/matrix-synapse/tasks/synapse/workers/setup_uninstall.yml +++ b/roles/matrix-synapse/tasks/synapse/workers/setup_uninstall.yml @@ -7,7 +7,7 @@ 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 diff --git a/roles/matrix-synapse/tasks/update_user_password.yml b/roles/matrix-synapse/tasks/update_user_password.yml index 1ae3183e..586bf51b 100644 --- a/roles/matrix-synapse/tasks/update_user_password.yml +++ b/roles/matrix-synapse/tasks/update_user_password.yml @@ -38,6 +38,9 @@ - name: Generate password hash ansible.builtin.shell: "{{ matrix_host_command_docker }} exec matrix-synapse /usr/local/bin/hash_password -c /data/homeserver.yaml -p {{ password|quote }}" register: password_hash + changed_when: false - name: Update user password hash ansible.builtin.command: "{{ matrix_local_bin_path }}/matrix-postgres-update-user-password-hash {{ username|quote }} {{ password_hash.stdout|quote }}" + register: matrix_synapse_update_user_password_result + changed_when: matrix_synapse_update_user_password_result.rc == 0 diff --git a/roles/matrix-synapse/templates/synapse/homeserver.yaml.j2 b/roles/matrix-synapse/templates/synapse/homeserver.yaml.j2 index c2364650..87cedb40 100644 --- a/roles/matrix-synapse/templates/synapse/homeserver.yaml.j2 +++ b/roles/matrix-synapse/templates/synapse/homeserver.yaml.j2 @@ -352,13 +352,13 @@ worker_app: synapse.app.homeserver # thx https://oznetnerd.com/2017/04/18/jinja2-selectattr-filter/ # reduce the main worker's offerings to core homeserver business -{% if matrix_synapse_workers_enabled_list|selectattr('type', 'equalto', 'federation_sender')|list %} +{% if matrix_synapse_workers_enabled_list | selectattr('type', 'equalto', 'federation_sender') | list %} send_federation: false {% endif %} -{% if matrix_synapse_workers_enabled_list|selectattr('type', 'equalto', 'media_repository')|list %} +{% if matrix_synapse_workers_enabled_list | selectattr('type', 'equalto', 'media_repository') | list %} enable_media_repo: false {% endif %} -{% if matrix_synapse_workers_enabled_list|selectattr('type', 'equalto', 'pusher')|list %} +{% if matrix_synapse_workers_enabled_list | selectattr('type', 'equalto', 'pusher') | list %} start_pushers: false {% endif %} @@ -870,8 +870,8 @@ database: name: "psycopg2" txn_limit: {{ matrix_synapse_database_txn_limit }} args: - user: {{ matrix_synapse_database_user|string|to_json }} - password: {{ matrix_synapse_database_password|string|to_json }} + user: {{ matrix_synapse_database_user | string|to_json }} + password: {{ matrix_synapse_database_password | string|to_json }} database: "{{ matrix_synapse_database_database }}" host: "{{ matrix_synapse_database_host }}" port: {{ matrix_synapse_database_port }} @@ -1256,7 +1256,7 @@ turn_uris: {{ matrix_synapse_turn_uris|to_json }} # The shared secret used to compute passwords for the TURN server # -turn_shared_secret: {{ matrix_synapse_turn_shared_secret|string|to_json }} +turn_shared_secret: {{ matrix_synapse_turn_shared_secret | string|to_json }} # The Username and password if the TURN server needs them and # does not use a token @@ -1393,7 +1393,7 @@ registration_requires_token: {{ matrix_synapse_registration_requires_token|to_js # If set, allows registration of standard or admin accounts by anyone who # has the shared secret, even if registration is otherwise disabled. # -registration_shared_secret: {{ matrix_synapse_registration_shared_secret|string|to_json }} +registration_shared_secret: {{ matrix_synapse_registration_shared_secret | string|to_json }} # Set the number of bcrypt rounds used to generate password hash. # Larger numbers increase the work factor needed to generate the hash. @@ -1657,13 +1657,13 @@ app_service_config_files: {{ matrix_synapse_app_service_config_files|to_json }} # the registration_shared_secret is used, if one is given; otherwise, # a secret key is derived from the signing key. # -macaroon_secret_key: {{ matrix_synapse_macaroon_secret_key|string|to_json }} +macaroon_secret_key: {{ matrix_synapse_macaroon_secret_key | string|to_json }} # a secret which is used to calculate HMACs for form values, to stop # falsification of values. Must be specified for the User Consent # forms to work. # -form_secret: {{ matrix_synapse_form_secret|string|to_json }} +form_secret: {{ matrix_synapse_form_secret | string|to_json }} ## Signing Keys ## @@ -2263,7 +2263,7 @@ password_config: # Uncomment and change to a secret random string for extra security. # DO NOT CHANGE THIS AFTER INITIAL SETUP! # - pepper: {{ matrix_synapse_password_config_pepper|string|to_json }} + pepper: {{ matrix_synapse_password_config_pepper | string|to_json }} # Define and enforce a password policy. Each parameter is optional. # This is an implementation of MSC2000. @@ -2330,7 +2330,7 @@ email: # The hostname of the outgoing SMTP server to use. Defaults to 'localhost'. # #smtp_host: mail.server - smtp_host: {{ matrix_synapse_email_smtp_host|string|to_json }} + smtp_host: {{ matrix_synapse_email_smtp_host | string|to_json }} # The port on the mail server for outgoing SMTP. Defaults to 25. # @@ -2340,8 +2340,8 @@ email: # Username/password for authentication to the SMTP server. By default, no # authentication is attempted. {% if matrix_synapse_email_smtp_user %} - smtp_user: {{ matrix_synapse_email_smtp_user|string|to_json }} - smtp_pass: {{ matrix_synapse_email_smtp_pass|string|to_json }} + smtp_user: {{ matrix_synapse_email_smtp_user | string|to_json }} + smtp_pass: {{ matrix_synapse_email_smtp_pass | string|to_json }} {% endif %} # Uncomment the following to require TLS transport security for SMTP. @@ -2371,7 +2371,7 @@ email: # trailing 's'. # #notif_from: "Your Friendly %(app)s homeserver " - notif_from: {{ matrix_synapse_email_notif_from|string|to_json }} + notif_from: {{ matrix_synapse_email_notif_from | string|to_json }} # app_name defines the default value for '%(app)s' in notif_from and email # subjects. It defaults to 'Matrix'. @@ -2398,7 +2398,7 @@ email: # supported for backwards-compatibility but is now deprecated.) # #client_base_url: "http://localhost/riot" - client_base_url: {{ matrix_synapse_email_client_base_url|string|to_json }} + client_base_url: {{ matrix_synapse_email_client_base_url | string|to_json }} # Configure the time that a validation email will expire after sending. # Defaults to 1h. @@ -2409,7 +2409,7 @@ email: # to the identity server as the org.matrix.web_client_location key. Defaults # to unset, giving no guidance to the identity server. # - invite_client_location: {{ matrix_synapse_email_invite_client_location|string|to_json }} + invite_client_location: {{ matrix_synapse_email_invite_client_location | string|to_json }} # Subjects to use when sending emails from Synapse. # @@ -2510,7 +2510,7 @@ password_providers: {% if matrix_synapse_ext_password_provider_rest_auth_enabled %} - module: "rest_auth_provider.RestAuthProvider" config: - endpoint: {{ matrix_synapse_ext_password_provider_rest_auth_endpoint|string|to_json }} + endpoint: {{ matrix_synapse_ext_password_provider_rest_auth_endpoint | string|to_json }} policy: registration: username: @@ -2525,20 +2525,20 @@ password_providers: - module: "ldap_auth_provider.LdapAuthProvider" config: enabled: true - uri: {{ matrix_synapse_ext_password_provider_ldap_uri|string|to_json }} + uri: {{ matrix_synapse_ext_password_provider_ldap_uri | string|to_json }} start_tls: {{ matrix_synapse_ext_password_provider_ldap_start_tls|to_json }} - base: {{ matrix_synapse_ext_password_provider_ldap_base|string|to_json }} + base: {{ matrix_synapse_ext_password_provider_ldap_base | string|to_json }} active_directory: {{ matrix_synapse_ext_password_provider_ldap_active_directory|to_json }} - default_domain: {{ matrix_synapse_ext_password_provider_ldap_default_domain|string|to_json }} + default_domain: {{ matrix_synapse_ext_password_provider_ldap_default_domain | string|to_json }} attributes: - uid: {{ matrix_synapse_ext_password_provider_ldap_attributes_uid|string|to_json }} - mail: {{ matrix_synapse_ext_password_provider_ldap_attributes_mail|string|to_json }} - name: {{ matrix_synapse_ext_password_provider_ldap_attributes_name|string|to_json }} + uid: {{ matrix_synapse_ext_password_provider_ldap_attributes_uid | string|to_json }} + mail: {{ matrix_synapse_ext_password_provider_ldap_attributes_mail | string|to_json }} + name: {{ matrix_synapse_ext_password_provider_ldap_attributes_name | string|to_json }} {% if matrix_synapse_ext_password_provider_ldap_bind_dn %} - bind_dn: {{ matrix_synapse_ext_password_provider_ldap_bind_dn|string|to_json }} - bind_password: {{ matrix_synapse_ext_password_provider_ldap_bind_password|string|to_json }} + bind_dn: {{ matrix_synapse_ext_password_provider_ldap_bind_dn | string|to_json }} + bind_password: {{ matrix_synapse_ext_password_provider_ldap_bind_password | string|to_json }} {% endif %} - filter: {{ matrix_synapse_ext_password_provider_ldap_filter|string|to_json }} + filter: {{ matrix_synapse_ext_password_provider_ldap_filter | string|to_json }} {% endif %} {% endif %} From bb8b8c4bf0b44b2e5048b56ca7ad5046b0777f61 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Mon, 18 Jul 2022 13:03:13 +0300 Subject: [PATCH 05/16] Fix tasks include regression --- roles/matrix-jitsi/tasks/setup_jitsi_prosody.yml | 2 +- roles/matrix-postgres/tasks/setup_postgres.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/matrix-jitsi/tasks/setup_jitsi_prosody.yml b/roles/matrix-jitsi/tasks/setup_jitsi_prosody.yml index 92715e6b..9383b48b 100644 --- a/roles/matrix-jitsi/tasks/setup_jitsi_prosody.yml +++ b/roles/matrix-jitsi/tasks/setup_jitsi_prosody.yml @@ -53,7 +53,7 @@ - name: Ensure authentication is properly configured ansible.builtin.include_tasks: - ansible.builtin.file: "{{ role_path }}/tasks/util/setup_jitsi_auth.yml" + file: "{{ role_path }}/tasks/util/setup_jitsi_auth.yml" when: - matrix_jitsi_enabled | bool - matrix_jitsi_enable_auth | bool diff --git a/roles/matrix-postgres/tasks/setup_postgres.yml b/roles/matrix-postgres/tasks/setup_postgres.yml index 695876f6..c292c92e 100644 --- a/roles/matrix-postgres/tasks/setup_postgres.yml +++ b/roles/matrix-postgres/tasks/setup_postgres.yml @@ -132,7 +132,7 @@ when: "matrix_postgres_enabled | bool and matrix_postgres_systemd_service_result.changed" - ansible.builtin.include_tasks: - ansible.builtin.file: "{{ role_path }}/tasks/util/create_additional_databases.yml" + file: "{{ role_path }}/tasks/util/create_additional_databases.yml" apply: tags: - always From 318bfa84d5d887abb90959387c6966379cc22122 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Mon, 18 Jul 2022 13:21:32 +0300 Subject: [PATCH 06/16] Fix spacing around filter invocations --- roles/matrix-base/defaults/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/matrix-base/defaults/main.yml b/roles/matrix-base/defaults/main.yml index b3aa3a75..056b2694 100644 --- a/roles/matrix-base/defaults/main.yml +++ b/roles/matrix-base/defaults/main.yml @@ -246,11 +246,11 @@ matrix_well_known_matrix_support_configuration_default: "{{ lookup('template', ' matrix_well_known_matrix_support_configuration_extension_json: '{}' -matrix_well_known_matrix_support_configuration_extension: "{{ matrix_well_known_matrix_support_configuration_extension_json|from_json if matrix_well_known_matrix_support_configuration_extension_json|from_json is mapping else {} }}" +matrix_well_known_matrix_support_configuration_extension: "{{ matrix_well_known_matrix_support_configuration_extension_json | from_json if matrix_well_known_matrix_support_configuration_extension_json | from_json is mapping else {} }}" # Holds the final `/.well-known/matrix/support` configuration (a combination of the default and its extension). # You most likely don't need to touch this variable. Instead, see `matrix_well_known_matrix_support_configuration_default` and `matrix_well_known_matrix_support_configuration_extension_json`. -matrix_well_known_matrix_support_configuration: "{{ matrix_well_known_matrix_support_configuration_default|combine(matrix_well_known_matrix_support_configuration_extension, recursive=True) }}" +matrix_well_known_matrix_support_configuration: "{{ matrix_well_known_matrix_support_configuration_default | combine(matrix_well_known_matrix_support_configuration_extension, recursive=True) }}" # The Docker network that all services would be put into matrix_docker_network: "matrix" From 211ff20891747f638ad953b884c227d5344901af Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Mon, 18 Jul 2022 14:08:35 +0300 Subject: [PATCH 07/16] Fix package-latest ansible-lint errors Reference: https://ansible-lint.readthedocs.io/en/latest/default_rules/#package-latest --- roles/matrix-base/tasks/server_base/setup_archlinux.yml | 4 ++-- roles/matrix-base/tasks/server_base/setup_debian.yml | 4 ++-- roles/matrix-base/tasks/server_base/setup_fedora.yml | 6 +++--- roles/matrix-base/tasks/server_base/setup_raspbian.yml | 4 ++-- roles/matrix-base/tasks/server_base/setup_redhat.yml | 4 ++-- roles/matrix-base/tasks/server_base/setup_redhat8.yml | 8 ++++---- roles/matrix-base/tasks/util/ensure_fuse_installed.yml | 6 +++--- roles/matrix-base/tasks/util/ensure_openssl_installed.yml | 6 +++--- roles/matrix-ma1sd/tasks/setup_install.yml | 2 +- 9 files changed, 22 insertions(+), 22 deletions(-) diff --git a/roles/matrix-base/tasks/server_base/setup_archlinux.yml b/roles/matrix-base/tasks/server_base/setup_archlinux.yml index 73c18cee..c912e58f 100644 --- a/roles/matrix-base/tasks/server_base/setup_archlinux.yml +++ b/roles/matrix-base/tasks/server_base/setup_archlinux.yml @@ -5,12 +5,12 @@ name: - python-docker - python-dnspython - state: latest + state: present update_cache: true - name: Ensure Docker is installed pacman: name: - docker - state: latest + state: present 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 d6ef5cd9..271fab41 100644 --- a/roles/matrix-base/tasks/server_base/setup_debian.yml +++ b/roles/matrix-base/tasks/server_base/setup_debian.yml @@ -29,7 +29,7 @@ ansible.builtin.apt: name: - "{{ matrix_ntpd_package }}" - state: latest + state: present update_cache: true - name: Ensure Docker is installed @@ -37,5 +37,5 @@ name: - "{{ matrix_docker_package_name }}" - "python{{ '3' if ansible_python.version.major == 3 else '' }}-docker" - state: latest + state: present 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 b5646c8f..2c7d528f 100644 --- a/roles/matrix-base/tasks/server_base/setup_fedora.yml +++ b/roles/matrix-base/tasks/server_base/setup_fedora.yml @@ -21,7 +21,7 @@ ansible.builtin.yum: name: - "{{ matrix_ntpd_package }}" - state: latest + state: present update_cache: true - name: Ensure Docker is installed @@ -29,11 +29,11 @@ name: - "{{ matrix_docker_package_name }}" - python3-pip - state: latest + state: present when: matrix_docker_installation_enabled | bool - name: Ensure Docker-Py is installed ansible.builtin.pip: name: docker-py - state: latest + state: present 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 b5eb4016..54ea4d18 100644 --- a/roles/matrix-base/tasks/server_base/setup_raspbian.yml +++ b/roles/matrix-base/tasks/server_base/setup_raspbian.yml @@ -29,7 +29,7 @@ ansible.builtin.apt: name: - "{{ matrix_ntpd_package }}" - state: latest + state: present update_cache: true - name: Ensure Docker is installed @@ -37,5 +37,5 @@ name: - "{{ matrix_docker_package_name }}" - "python{{'3' if ansible_python.version.major == 3 else ''}}-docker" - state: latest + state: present 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 189fcecd..4e5c97d4 100644 --- a/roles/matrix-base/tasks/server_base/setup_redhat.yml +++ b/roles/matrix-base/tasks/server_base/setup_redhat.yml @@ -19,7 +19,7 @@ ansible.builtin.yum: name: - "{{ matrix_ntpd_package }}" - state: latest + state: present update_cache: true - name: Ensure Docker is installed @@ -27,5 +27,5 @@ name: - "{{ matrix_docker_package_name }}" - docker-python - state: latest + state: present 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 9e1aaa01..932dbab5 100644 --- a/roles/matrix-base/tasks/server_base/setup_redhat8.yml +++ b/roles/matrix-base/tasks/server_base/setup_redhat8.yml @@ -19,14 +19,14 @@ ansible.builtin.yum: name: - epel-release - state: latest + state: present update_cache: true - name: Ensure yum packages are installed ansible.builtin.yum: name: - "{{ matrix_ntpd_package }}" - state: latest + state: present update_cache: true - name: Ensure Docker is installed @@ -34,11 +34,11 @@ name: - "{{ matrix_docker_package_name }}" - python3-pip - state: latest + state: present when: matrix_docker_installation_enabled | bool - name: Ensure Docker-Py is installed ansible.builtin.pip: name: docker-py - state: latest + state: present when: matrix_docker_installation_enabled | bool diff --git a/roles/matrix-base/tasks/util/ensure_fuse_installed.yml b/roles/matrix-base/tasks/util/ensure_fuse_installed.yml index dfb1ddc8..47d2d9e8 100644 --- a/roles/matrix-base/tasks/util/ensure_fuse_installed.yml +++ b/roles/matrix-base/tasks/util/ensure_fuse_installed.yml @@ -4,7 +4,7 @@ ansible.builtin.yum: name: - fuse - state: latest + state: present when: ansible_os_family == 'RedHat' # This is for both Debian and Raspbian @@ -12,12 +12,12 @@ ansible.builtin.apt: name: - fuse - state: latest + state: present when: ansible_os_family == 'Debian' - name: Ensure fuse installed (Archlinux) pacman: name: - fuse3 - state: latest + state: present when: ansible_distribution == 'Archlinux' diff --git a/roles/matrix-base/tasks/util/ensure_openssl_installed.yml b/roles/matrix-base/tasks/util/ensure_openssl_installed.yml index 909c0f1c..ae22fb49 100644 --- a/roles/matrix-base/tasks/util/ensure_openssl_installed.yml +++ b/roles/matrix-base/tasks/util/ensure_openssl_installed.yml @@ -4,7 +4,7 @@ ansible.builtin.yum: name: - openssl - state: latest + state: present when: ansible_os_family == 'RedHat' # This is for both Debian and Raspbian @@ -12,12 +12,12 @@ ansible.builtin.apt: name: - openssl - state: latest + state: present when: ansible_os_family == 'Debian' - name: Ensure openssl installed (Archlinux) pacman: name: - openssl - state: latest + state: present when: ansible_distribution == 'Archlinux' diff --git a/roles/matrix-ma1sd/tasks/setup_install.yml b/roles/matrix-ma1sd/tasks/setup_install.yml index 61f01b29..073f22aa 100644 --- a/roles/matrix-ma1sd/tasks/setup_install.yml +++ b/roles/matrix-ma1sd/tasks/setup_install.yml @@ -75,7 +75,7 @@ pacman: name: - gradle - state: latest + state: present update_cache: true when: ansible_distribution == 'Archlinux' From 0ab2001ce79f85ec5a06b0ef973c0818788090b0 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Mon, 18 Jul 2022 14:43:52 +0300 Subject: [PATCH 08/16] Fix git-latest ansible-lint errors Reference: https://ansible-lint.readthedocs.io/en/latest/default_rules/#git-latest Our variable naming is not necessarily consistent across roles. I've tried to follow the naming conventions of each individual role. All new variables are suffixed with `_version`, but the prefix may be somewhat different. --- roles/matrix-backup-borg/defaults/main.yml | 1 + roles/matrix-backup-borg/tasks/setup_install.yml | 1 + roles/matrix-bot-buscarron/defaults/main.yml | 1 + roles/matrix-bot-buscarron/tasks/setup_install.yml | 1 + roles/matrix-bot-honoroit/defaults/main.yml | 1 + roles/matrix-bot-honoroit/tasks/setup_install.yml | 1 + .../matrix-bot-matrix-registration-bot/defaults/main.yml | 1 + .../tasks/setup_install.yml | 1 + roles/matrix-bot-matrix-reminder-bot/defaults/main.yml | 1 + .../tasks/setup_install.yml | 1 + roles/matrix-bridge-appservice-irc/defaults/main.yml | 8 ++++++-- .../matrix-bridge-appservice-irc/tasks/setup_install.yml | 1 + roles/matrix-bridge-appservice-slack/defaults/main.yml | 8 ++++++-- .../tasks/setup_install.yml | 1 + roles/matrix-bridge-mautrix-googlechat/defaults/main.yml | 1 + .../tasks/setup_install.yml | 1 + roles/matrix-bridge-mautrix-hangouts/defaults/main.yml | 1 + .../tasks/setup_install.yml | 1 + roles/matrix-bridge-mautrix-instagram/defaults/main.yml | 1 + .../tasks/setup_install.yml | 1 + roles/matrix-bridge-mautrix-signal/defaults/main.yml | 2 ++ .../matrix-bridge-mautrix-signal/tasks/setup_install.yml | 2 ++ roles/matrix-bridge-mautrix-telegram/defaults/main.yml | 2 ++ .../tasks/setup_install.yml | 2 ++ roles/matrix-bridge-mautrix-twitter/defaults/main.yml | 1 + .../matrix-bridge-mautrix-twitter/tasks/setup_install.yml | 2 +- roles/matrix-bridge-mx-puppet-groupme/defaults/main.yml | 1 + .../tasks/setup_install.yml | 1 + roles/matrix-bridge-mx-puppet-instagram/defaults/main.yml | 1 + .../tasks/setup_install.yml | 1 + roles/matrix-bridge-mx-puppet-steam/defaults/main.yml | 1 + .../matrix-bridge-mx-puppet-steam/tasks/setup_install.yml | 1 + roles/matrix-client-element/defaults/main.yml | 1 + roles/matrix-client-element/tasks/prepare_themes.yml | 1 + 34 files changed, 48 insertions(+), 5 deletions(-) diff --git a/roles/matrix-backup-borg/defaults/main.yml b/roles/matrix-backup-borg/defaults/main.yml index 83a5ca44..89381788 100644 --- a/roles/matrix-backup-borg/defaults/main.yml +++ b/roles/matrix-backup-borg/defaults/main.yml @@ -8,6 +8,7 @@ matrix_backup_borg_config_path: "{{ matrix_backup_borg_base_path }}/config" matrix_backup_borg_container_image_self_build: false matrix_backup_borg_docker_repo: "https://gitlab.com/etke.cc/borgmatic" +matrix_backup_borg_docker_repo_version: main matrix_backup_borg_docker_src_files_path: "{{ matrix_backup_borg_base_path }}/docker-src" # version determined automatically, based on postgres server version (if enabled), otherwise latest is used diff --git a/roles/matrix-backup-borg/tasks/setup_install.yml b/roles/matrix-backup-borg/tasks/setup_install.yml index 686313a2..95f1a5de 100644 --- a/roles/matrix-backup-borg/tasks/setup_install.yml +++ b/roles/matrix-backup-borg/tasks/setup_install.yml @@ -63,6 +63,7 @@ - name: Ensure borg repository is present on self-build ansible.builtin.git: repo: "{{ matrix_backup_borg_docker_repo }}" + version: "{{ matrix_backup_borg_docker_repo_version }}" dest: "{{ matrix_backup_borg_docker_src_files_path }}" force: "yes" become: true diff --git a/roles/matrix-bot-buscarron/defaults/main.yml b/roles/matrix-bot-buscarron/defaults/main.yml index aff54ceb..6d289bb9 100644 --- a/roles/matrix-bot-buscarron/defaults/main.yml +++ b/roles/matrix-bot-buscarron/defaults/main.yml @@ -6,6 +6,7 @@ matrix_bot_buscarron_enabled: true matrix_bot_buscarron_container_image_self_build: false matrix_bot_buscarron_docker_repo: "https://gitlab.com/etke.cc/buscarron.git" +matrix_bot_buscarron_docker_repo_version: "{{ matrix_bot_buscarron_version }}" matrix_bot_buscarron_docker_src_files_path: "{{ matrix_base_data_path }}/buscarron/docker-src" matrix_bot_buscarron_version: v1.2.0 diff --git a/roles/matrix-bot-buscarron/tasks/setup_install.yml b/roles/matrix-bot-buscarron/tasks/setup_install.yml index e9ba1258..b2ed24f5 100644 --- a/roles/matrix-bot-buscarron/tasks/setup_install.yml +++ b/roles/matrix-bot-buscarron/tasks/setup_install.yml @@ -62,6 +62,7 @@ - name: Ensure buscarron repository is present on self-build ansible.builtin.git: repo: "{{ matrix_bot_buscarron_docker_repo }}" + version: "{{ matrix_bot_buscarron_docker_repo_version }}" dest: "{{ matrix_bot_buscarron_docker_src_files_path }}" force: "yes" become: true diff --git a/roles/matrix-bot-honoroit/defaults/main.yml b/roles/matrix-bot-honoroit/defaults/main.yml index 665c64e9..a48fb878 100644 --- a/roles/matrix-bot-honoroit/defaults/main.yml +++ b/roles/matrix-bot-honoroit/defaults/main.yml @@ -6,6 +6,7 @@ matrix_bot_honoroit_enabled: true matrix_bot_honoroit_container_image_self_build: false matrix_bot_honoroit_docker_repo: "https://gitlab.com/etke.cc/honoroit.git" +matrix_bot_honoroit_docker_repo_version: "{{ matrix_bot_honoroit_version }}" matrix_bot_honoroit_docker_src_files_path: "{{ matrix_base_data_path }}/honoroit/docker-src" matrix_bot_honoroit_version: v0.9.9 diff --git a/roles/matrix-bot-honoroit/tasks/setup_install.yml b/roles/matrix-bot-honoroit/tasks/setup_install.yml index f41c4a26..b2a6e0d4 100644 --- a/roles/matrix-bot-honoroit/tasks/setup_install.yml +++ b/roles/matrix-bot-honoroit/tasks/setup_install.yml @@ -62,6 +62,7 @@ - name: Ensure honoroit repository is present on self-build ansible.builtin.git: repo: "{{ matrix_bot_honoroit_docker_repo }}" + version: "{{ matrix_bot_honoroit_docker_repo_version }}" dest: "{{ matrix_bot_honoroit_docker_src_files_path }}" force: "yes" become: true diff --git a/roles/matrix-bot-matrix-registration-bot/defaults/main.yml b/roles/matrix-bot-matrix-registration-bot/defaults/main.yml index 6cd0d15a..d8e52b71 100644 --- a/roles/matrix-bot-matrix-registration-bot/defaults/main.yml +++ b/roles/matrix-bot-matrix-registration-bot/defaults/main.yml @@ -5,6 +5,7 @@ matrix_bot_matrix_registration_bot_enabled: true matrix_bot_matrix_registration_bot_container_image_self_build: false matrix_bot_matrix_registration_bot_docker_repo: "https://github.com/moan0s/matrix-registration-bot.git" +matrix_bot_matrix_registration_bot_docker_repo_version: "{{ matrix_bot_matrix_registration_bot_version if matrix_bot_matrix_registration_bot_version != 'latest' else 'main' }}" matrix_bot_matrix_registration_bot_docker_src_files_path: "{{ matrix_bot_matrix_registration_bot_base_path }}/docker-src" matrix_bot_matrix_registration_bot_version: latest 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 e5155cdd..d4522321 100644 --- a/roles/matrix-bot-matrix-registration-bot/tasks/setup_install.yml +++ b/roles/matrix-bot-matrix-registration-bot/tasks/setup_install.yml @@ -36,6 +36,7 @@ - name: Ensure matrix-registration-bot repository is present on self-build ansible.builtin.git: repo: "{{ matrix_bot_matrix_registration_bot_docker_repo }}" + version: "{{ matrix_bot_matrix_registration_bot_docker_repo_version }}" dest: "{{ matrix_bot_matrix_registration_bot_docker_src_files_path }}" force: "yes" become: true diff --git a/roles/matrix-bot-matrix-reminder-bot/defaults/main.yml b/roles/matrix-bot-matrix-reminder-bot/defaults/main.yml index 9eebed0a..610a43a3 100644 --- a/roles/matrix-bot-matrix-reminder-bot/defaults/main.yml +++ b/roles/matrix-bot-matrix-reminder-bot/defaults/main.yml @@ -6,6 +6,7 @@ matrix_bot_matrix_reminder_bot_enabled: true matrix_bot_matrix_reminder_bot_container_image_self_build: false matrix_bot_matrix_reminder_bot_docker_repo: "https://github.com/anoadragon453/matrix-reminder-bot.git" +matrix_bot_matrix_reminder_bot_docker_repo_version: "{{ matrix_bot_matrix_reminder_bot_version }}" matrix_bot_matrix_reminder_bot_docker_src_files_path: "{{ matrix_base_data_path }}/matrix-reminder-bot/docker-src" matrix_bot_matrix_reminder_bot_version: release-v0.2.1 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 915831d3..f66542b8 100644 --- a/roles/matrix-bot-matrix-reminder-bot/tasks/setup_install.yml +++ b/roles/matrix-bot-matrix-reminder-bot/tasks/setup_install.yml @@ -55,6 +55,7 @@ - name: Ensure matrix-reminder-bot repository is present on self-build ansible.builtin.git: repo: "{{ matrix_bot_matrix_reminder_bot_docker_repo }}" + version: "{{ matrix_bot_matrix_reminder_bot_docker_repo_version }}" dest: "{{ matrix_bot_matrix_reminder_bot_docker_src_files_path }}" force: "yes" become: true diff --git a/roles/matrix-bridge-appservice-irc/defaults/main.yml b/roles/matrix-bridge-appservice-irc/defaults/main.yml index 268a05dc..aaee2b48 100644 --- a/roles/matrix-bridge-appservice-irc/defaults/main.yml +++ b/roles/matrix-bridge-appservice-irc/defaults/main.yml @@ -6,10 +6,14 @@ matrix_appservice_irc_enabled: true matrix_appservice_irc_container_image_self_build: false matrix_appservice_irc_docker_repo: "https://github.com/matrix-org/matrix-appservice-irc.git" +matrix_appservice_irc_docker_repo_version: "{{ 'master' if matrix_appservice_irc_version == 'latest' else matrix_appservice_irc_version }}" matrix_appservice_irc_docker_src_files_path: "{{ matrix_base_data_path }}/appservice-irc/docker-src" -matrix_appservice_irc_version: release-0.34.0 -matrix_appservice_irc_docker_image: "{{ matrix_container_global_registry_prefix }}matrixdotorg/matrix-appservice-irc:{{ matrix_appservice_irc_version }}" +# matrix_appservice_irc_version used to contain the full Docker image tag (e.g. `release-X.X.X`). +# It's a bare version number now. We try to somewhat retain compatibility below. +matrix_appservice_irc_version: 0.34.0 +matrix_appservice_irc_docker_image: "{{ matrix_container_global_registry_prefix }}matrixdotorg/matrix-appservice-irc:{{ matrix_appservice_irc_docker_image_tag }}" +matrix_appservice_irc_docker_image_tag: "{{ 'latest' if matrix_appservice_irc_version == 'latest' else ('release-' + matrix_appservice_irc_version) }}" matrix_appservice_irc_docker_image_force_pull: "{{ matrix_appservice_irc_docker_image.endswith(':latest') }}" matrix_appservice_irc_base_path: "{{ matrix_base_data_path }}/appservice-irc" diff --git a/roles/matrix-bridge-appservice-irc/tasks/setup_install.yml b/roles/matrix-bridge-appservice-irc/tasks/setup_install.yml index c3bdd639..5362491c 100644 --- a/roles/matrix-bridge-appservice-irc/tasks/setup_install.yml +++ b/roles/matrix-bridge-appservice-irc/tasks/setup_install.yml @@ -72,6 +72,7 @@ - name: Ensure matrix-appservice-irc repository is present when self-building ansible.builtin.git: repo: "{{ matrix_appservice_irc_docker_repo }}" + version: "{{ matrix_appservice_irc_docker_repo_version }}" dest: "{{ matrix_appservice_irc_docker_src_files_path }}" force: "yes" become: true diff --git a/roles/matrix-bridge-appservice-slack/defaults/main.yml b/roles/matrix-bridge-appservice-slack/defaults/main.yml index bbbbec99..a27f4db5 100644 --- a/roles/matrix-bridge-appservice-slack/defaults/main.yml +++ b/roles/matrix-bridge-appservice-slack/defaults/main.yml @@ -6,10 +6,14 @@ matrix_appservice_slack_enabled: true matrix_appservice_slack_container_image_self_build: false matrix_appservice_slack_docker_repo: "https://github.com/matrix-org/matrix-appservice-slack.git" +matrix_appservice_slack_docker_repo_version: "{{ 'master' if matrix_appservice_slack_version == 'latest' else matrix_appservice_slack_version }}" matrix_appservice_slack_docker_src_files_path: "{{ matrix_base_data_path }}/appservice-slack/docker-src" -matrix_appservice_slack_version: release-1.11.0 -matrix_appservice_slack_docker_image: "{{ matrix_container_global_registry_prefix }}matrixdotorg/matrix-appservice-slack:{{ matrix_appservice_slack_version }}" +# matrix_appservice_slack_version used to contain the full Docker image tag (e.g. `release-X.X.X`). +# It's a bare version number now. We try to somewhat retain compatibility below. +matrix_appservice_slack_version: 1.11.0 +matrix_appservice_slack_docker_image: "{{ matrix_container_global_registry_prefix }}matrixdotorg/matrix-appservice-slack:{{ matrix_appservice_slack_docker_image_tag }}" +matrix_appservice_slack_docker_image_tag: "{{ 'latest' if matrix_appservice_slack_version == 'latest' else ('release-' + matrix_appservice_slack_version) }}" matrix_appservice_slack_docker_image_force_pull: "{{ matrix_appservice_slack_docker_image.endswith(':latest') }}" matrix_appservice_slack_base_path: "{{ matrix_base_data_path }}/appservice-slack" diff --git a/roles/matrix-bridge-appservice-slack/tasks/setup_install.yml b/roles/matrix-bridge-appservice-slack/tasks/setup_install.yml index 32428f73..a2921d98 100644 --- a/roles/matrix-bridge-appservice-slack/tasks/setup_install.yml +++ b/roles/matrix-bridge-appservice-slack/tasks/setup_install.yml @@ -46,6 +46,7 @@ - name: Ensure matrix-appservice-slack repository is present when self-building ansible.builtin.git: repo: "{{ matrix_appservice_slack_docker_repo }}" + version: "{{ matrix_appservice_slack_docker_repo_version }}" dest: "{{ matrix_appservice_slack_docker_src_files_path }}" force: "yes" become: true diff --git a/roles/matrix-bridge-mautrix-googlechat/defaults/main.yml b/roles/matrix-bridge-mautrix-googlechat/defaults/main.yml index 956d7174..85d534e5 100644 --- a/roles/matrix-bridge-mautrix-googlechat/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-googlechat/defaults/main.yml @@ -6,6 +6,7 @@ matrix_mautrix_googlechat_enabled: true matrix_mautrix_googlechat_container_image_self_build: false matrix_mautrix_googlechat_container_image_self_build_repo: "https://github.com/mautrix/googlechat.git" +matrix_mautrix_googlechat_container_image_self_build_repo_version: "{{ 'master' if matrix_mautrix_googlechat_version == 'latest' else matrix_mautrix_googlechat_version }}" matrix_mautrix_googlechat_version: v0.3.3 # See: https://mau.dev/mautrix/googlechat/container_registry diff --git a/roles/matrix-bridge-mautrix-googlechat/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-googlechat/tasks/setup_install.yml index 8a9b55df..47dd9b12 100644 --- a/roles/matrix-bridge-mautrix-googlechat/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-googlechat/tasks/setup_install.yml @@ -63,6 +63,7 @@ - name: Ensure Mautrix Hangots repository is present on self build ansible.builtin.git: repo: "{{ matrix_mautrix_googlechat_container_image_self_build_repo }}" + version: "{{ matrix_mautrix_googlechat_container_image_self_build_repo_version }}" dest: "{{ matrix_mautrix_googlechat_docker_src_files_path }}" force: "yes" become: true diff --git a/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml b/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml index aaa9b305..fc467871 100644 --- a/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-hangouts/defaults/main.yml @@ -6,6 +6,7 @@ matrix_mautrix_hangouts_enabled: true matrix_mautrix_hangouts_container_image_self_build: false matrix_mautrix_hangouts_container_image_self_build_repo: "https://github.com/mautrix/hangouts.git" +matrix_mautrix_hangouts_container_image_self_build_repo_version: "{{ 'master' if matrix_mautrix_hangouts_version == 'latest' else matrix_mautrix_googlechat_version }}" matrix_mautrix_hangouts_version: latest # See: https://mau.dev/mautrix/hangouts/container_registry diff --git a/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml index a135fd1f..45a79fb4 100644 --- a/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml @@ -63,6 +63,7 @@ - name: Ensure Mautrix Hangots repository is present on self build ansible.builtin.git: repo: "{{ matrix_mautrix_hangouts_container_image_self_build_repo }}" + version: "{{ matrix_mautrix_hangouts_container_image_self_build_repo_version }}" dest: "{{ matrix_mautrix_hangouts_docker_src_files_path }}" force: "yes" become: true diff --git a/roles/matrix-bridge-mautrix-instagram/defaults/main.yml b/roles/matrix-bridge-mautrix-instagram/defaults/main.yml index 88812397..e31f3f46 100644 --- a/roles/matrix-bridge-mautrix-instagram/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-instagram/defaults/main.yml @@ -6,6 +6,7 @@ matrix_mautrix_instagram_enabled: true matrix_mautrix_instagram_container_image_self_build: false matrix_mautrix_instagram_container_image_self_build_repo: "https://github.com/mautrix/instagram.git" +matrix_mautrix_instagram_container_image_self_build_repo_version: "{{ 'master' if matrix_mautrix_instagram_version == 'latest' else matrix_mautrix_instagram_version }}" matrix_mautrix_instagram_version: v0.1.3 # See: https://mau.dev/tulir/mautrix-instagram/container_registry diff --git a/roles/matrix-bridge-mautrix-instagram/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-instagram/tasks/setup_install.yml index cac885ad..88b0286e 100644 --- a/roles/matrix-bridge-mautrix-instagram/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-instagram/tasks/setup_install.yml @@ -36,6 +36,7 @@ - name: Ensure Mautrix instagram repository is present on self-build ansible.builtin.git: repo: "{{ matrix_mautrix_instagram_container_image_self_build_repo }}" + version: "{{ matrix_mautrix_instagram_container_image_self_build_repo_version }}" dest: "{{ matrix_mautrix_instagram_docker_src_files_path }}" force: "yes" become: true diff --git a/roles/matrix-bridge-mautrix-signal/defaults/main.yml b/roles/matrix-bridge-mautrix-signal/defaults/main.yml index 81ddb8cd..84ef38cd 100644 --- a/roles/matrix-bridge-mautrix-signal/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-signal/defaults/main.yml @@ -6,6 +6,7 @@ matrix_mautrix_signal_enabled: true matrix_mautrix_signal_container_image_self_build: false matrix_mautrix_signal_docker_repo: "https://mau.dev/mautrix/signal.git" +matrix_mautrix_signal_docker_repo_version: "{{ 'master' if matrix_mautrix_signal_version == 'latest' else matrix_mautrix_signal_version }}" matrix_mautrix_signal_docker_src_files_path: "{{ matrix_base_data_path }}/mautrix-signal/docker-src" matrix_mautrix_signal_version: v0.3.0 @@ -16,6 +17,7 @@ matrix_mautrix_signal_docker_image_force_pull: "{{ matrix_mautrix_signal_docker_ matrix_mautrix_signal_daemon_container_image_self_build: false matrix_mautrix_signal_daemon_docker_repo: "https://gitlab.com/signald/signald" +matrix_mautrix_signal_daemon_docker_repo_version: "{{ 'master' if matrix_mautrix_signal_daemon_version == 'latest' else matrix_mautrix_signal_daemon_version }}" matrix_mautrix_signal_daemon_docker_src_files_path: "{{ matrix_base_data_path }}/mautrix-signald/docker-src" matrix_mautrix_signal_daemon_docker_image: "docker.io/signald/signald:{{ matrix_mautrix_signal_daemon_docker_image_tag }}" diff --git a/roles/matrix-bridge-mautrix-signal/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-signal/tasks/setup_install.yml index d92f2b3f..3a7ad508 100644 --- a/roles/matrix-bridge-mautrix-signal/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-signal/tasks/setup_install.yml @@ -24,6 +24,7 @@ - name: Ensure Mautrix Signal repository is present on self-build ansible.builtin.git: repo: "{{ matrix_mautrix_signal_docker_repo }}" + version: "{{ matrix_mautrix_signal_docker_repo_version }}" dest: "{{ matrix_mautrix_signal_docker_src_files_path }}" force: "yes" become: true @@ -56,6 +57,7 @@ - name: Ensure Mautrix Signal Daemon repository is present on self-build ansible.builtin.git: repo: "{{ matrix_mautrix_signal_daemon_docker_repo }}" + version: "{{ matrix_mautrix_signal_daemon_docker_repo_version }}" dest: "{{ matrix_mautrix_signal_daemon_docker_src_files_path }}" force: "yes" become: true diff --git a/roles/matrix-bridge-mautrix-telegram/defaults/main.yml b/roles/matrix-bridge-mautrix-telegram/defaults/main.yml index fd7bf685..2ac9fe04 100644 --- a/roles/matrix-bridge-mautrix-telegram/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-telegram/defaults/main.yml @@ -7,11 +7,13 @@ matrix_mautrix_telegram_enabled: true matrix_telegram_lottieconverter_container_image_self_build: false matrix_telegram_lottieconverter_container_image_self_build_mask_arch: false matrix_telegram_lottieconverter_docker_repo: "https://mau.dev/tulir/lottieconverter.git" +matrix_telegram_lottieconverter_docker_repo_version: "master" matrix_telegram_lottieconverter_docker_src_files_path: "{{ matrix_base_data_path }}/lotticonverter/docker-src" matrix_telegram_lottieconverter_docker_image: "dock.mau.dev/tulir/lottieconverter:alpine-3.15" # needs to be ajusted according to FROM clause of Dockerfile of mautrix-telegram matrix_mautrix_telegram_container_image_self_build: false matrix_mautrix_telegram_docker_repo: "https://mau.dev/mautrix/telegram.git" +matrix_mautrix_telegram_docker_repo_version: "{{ 'master' if matrix_mautrix_telegram_version == 'latest' else matrix_mautrix_telegram_version }}" matrix_mautrix_telegram_docker_src_files_path: "{{ matrix_base_data_path }}/mautrix-telegram/docker-src" matrix_mautrix_telegram_version: v0.11.3 diff --git a/roles/matrix-bridge-mautrix-telegram/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-telegram/tasks/setup_install.yml index 52bb8328..b6a0a745 100644 --- a/roles/matrix-bridge-mautrix-telegram/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-telegram/tasks/setup_install.yml @@ -63,6 +63,7 @@ - name: Ensure lottieconverter is present when self-building ansible.builtin.git: repo: "{{ matrix_telegram_lottieconverter_docker_repo }}" + version: "{{ matrix_telegram_lottieconverter_docker_repo_version }}" dest: "{{ matrix_telegram_lottieconverter_docker_src_files_path }}" force: "yes" become: true @@ -85,6 +86,7 @@ - name: Ensure matrix-mautrix-telegram repository is present when self-building ansible.builtin.git: repo: "{{ matrix_mautrix_telegram_docker_repo }}" + version: "{{ matrix_mautrix_telegram_docker_repo_version }}" dest: "{{ matrix_mautrix_telegram_docker_src_files_path }}" force: "yes" become: true diff --git a/roles/matrix-bridge-mautrix-twitter/defaults/main.yml b/roles/matrix-bridge-mautrix-twitter/defaults/main.yml index 8bf855dc..512195cb 100644 --- a/roles/matrix-bridge-mautrix-twitter/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-twitter/defaults/main.yml @@ -6,6 +6,7 @@ matrix_mautrix_twitter_enabled: true matrix_mautrix_twitter_container_image_self_build: false matrix_mautrix_twitter_container_image_self_build_repo: "https://github.com/mautrix/twitter.git" +matrix_mautrix_twitter_container_image_self_build_repo_version: "{{ 'master' if matrix_mautrix_twitter_version == 'latest' else matrix_mautrix_twitter_version }}" matrix_mautrix_twitter_version: v0.1.4 # See: https://mau.dev/tulir/mautrix-twitter/container_registry diff --git a/roles/matrix-bridge-mautrix-twitter/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-twitter/tasks/setup_install.yml index a611f352..05887c6d 100644 --- a/roles/matrix-bridge-mautrix-twitter/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-twitter/tasks/setup_install.yml @@ -40,8 +40,8 @@ - name: Ensure Mautrix Twitter repository is present on self-build ansible.builtin.git: repo: "{{ matrix_mautrix_twitter_container_image_self_build_repo }}" + version: "{{ matrix_mautrix_twitter_container_image_self_build_repo_version }}" dest: "{{ matrix_mautrix_twitter_docker_src_files_path }}" - # version: "{{ matrix_coturn_docker_image.split(':')[1] }}" force: "yes" become: true become_user: "{{ matrix_user_username }}" diff --git a/roles/matrix-bridge-mx-puppet-groupme/defaults/main.yml b/roles/matrix-bridge-mx-puppet-groupme/defaults/main.yml index 9f0918b6..a7016b30 100644 --- a/roles/matrix-bridge-mx-puppet-groupme/defaults/main.yml +++ b/roles/matrix-bridge-mx-puppet-groupme/defaults/main.yml @@ -6,6 +6,7 @@ matrix_mx_puppet_groupme_enabled: true matrix_mx_puppet_groupme_container_image_self_build: false matrix_mx_puppet_groupme_container_image_self_build_repo: "https://gitlab.com/robintown/mx-puppet-groupme" +matrix_mx_puppet_groupme_container_image_self_build_repo_version: "{{ 'main' if matrix_mx_puppet_groupme_version == 'latest' else matrix_mx_puppet_groupme_version }}" # Controls whether the mx-puppet-groupme container exposes its HTTP port (tcp/8437 in the container). # 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 3393db21..812f8560 100644 --- a/roles/matrix-bridge-mx-puppet-groupme/tasks/setup_install.yml +++ b/roles/matrix-bridge-mx-puppet-groupme/tasks/setup_install.yml @@ -81,6 +81,7 @@ - name: Ensure MX Puppet Groupme repository is present on self build ansible.builtin.git: repo: "{{ matrix_mx_puppet_groupme_container_image_self_build_repo }}" + version: "{{ matrix_mx_puppet_groupme_container_image_self_build_repo_version }}" dest: "{{ matrix_mx_puppet_groupme_docker_src_files_path }}" force: "yes" become: true diff --git a/roles/matrix-bridge-mx-puppet-instagram/defaults/main.yml b/roles/matrix-bridge-mx-puppet-instagram/defaults/main.yml index 32f287d5..aae6eb5a 100644 --- a/roles/matrix-bridge-mx-puppet-instagram/defaults/main.yml +++ b/roles/matrix-bridge-mx-puppet-instagram/defaults/main.yml @@ -6,6 +6,7 @@ matrix_mx_puppet_instagram_enabled: true matrix_mx_puppet_instagram_container_image_self_build: false matrix_mx_puppet_instagram_container_image_self_build_repo: "https://github.com/Sorunome/mx-puppet-instagram.git" +matrix_mx_puppet_instagram_container_image_self_build_repo_version: "{{ 'master' if matrix_mx_puppet_instagram_version == 'latest' else matrix_mx_puppet_instagram_version }}" matrix_mx_puppet_instagram_version: latest matrix_mx_puppet_instagram_docker_image: "{{ matrix_mx_puppet_instagram_docker_image_name_prefix }}sorunome/mx-puppet-instagram:{{ matrix_mx_puppet_instagram_version }}" 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 9222266b..abd78144 100644 --- a/roles/matrix-bridge-mx-puppet-instagram/tasks/setup_install.yml +++ b/roles/matrix-bridge-mx-puppet-instagram/tasks/setup_install.yml @@ -64,6 +64,7 @@ - name: Ensure mx-puppet-instagram repository is present on self build ansible.builtin.git: repo: "{{ matrix_mx_puppet_instagram_container_image_self_build_repo }}" + version: "{{ matrix_mx_puppet_instagram_container_image_self_build_repo_version }}" dest: "{{ matrix_mx_puppet_instagram_docker_src_files_path }}" force: "yes" become: true diff --git a/roles/matrix-bridge-mx-puppet-steam/defaults/main.yml b/roles/matrix-bridge-mx-puppet-steam/defaults/main.yml index e4140333..89541162 100644 --- a/roles/matrix-bridge-mx-puppet-steam/defaults/main.yml +++ b/roles/matrix-bridge-mx-puppet-steam/defaults/main.yml @@ -6,6 +6,7 @@ matrix_mx_puppet_steam_enabled: true matrix_mx_puppet_steam_container_image_self_build: false matrix_mx_puppet_steam_container_image_self_build_repo: "https://github.com/icewind1991/mx-puppet-steam.git" +matrix_mx_puppet_steam_container_image_self_build_repo_version: "{{ 'master' if matrix_mx_puppet_steam_version == 'latest' else matrix_mx_puppet_steam_version }}" # Controls whether the mx-puppet-steam container exposes its HTTP port (tcp/8432 in the container). # 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 87c2a424..89de2456 100644 --- a/roles/matrix-bridge-mx-puppet-steam/tasks/setup_install.yml +++ b/roles/matrix-bridge-mx-puppet-steam/tasks/setup_install.yml @@ -81,6 +81,7 @@ - name: Ensure MX Puppet Steam repository is present on self build ansible.builtin.git: repo: "{{ matrix_mx_puppet_steam_container_image_self_build_repo }}" + version: "{{ matrix_mx_puppet_steam_container_image_self_build_repo_version }}" dest: "{{ matrix_mx_puppet_steam_docker_src_files_path }}" force: "yes" become: true diff --git a/roles/matrix-client-element/defaults/main.yml b/roles/matrix-client-element/defaults/main.yml index e710d0f7..15218760 100644 --- a/roles/matrix-client-element/defaults/main.yml +++ b/roles/matrix-client-element/defaults/main.yml @@ -89,6 +89,7 @@ matrix_client_element_enable_presence_by_hs_url: ~ # will be installed and enabled automatically. matrix_client_element_themes_enabled: false matrix_client_element_themes_repository_url: https://github.com/aaronraimist/element-themes +matrix_client_element_themes_repository_version: master # Controls the default theme matrix_client_element_default_theme: 'light' diff --git a/roles/matrix-client-element/tasks/prepare_themes.yml b/roles/matrix-client-element/tasks/prepare_themes.yml index 4ba38943..c8ab9388 100644 --- a/roles/matrix-client-element/tasks/prepare_themes.yml +++ b/roles/matrix-client-element/tasks/prepare_themes.yml @@ -8,6 +8,7 @@ - name: Ensure Element themes repository is pulled ansible.builtin.git: repo: "{{ matrix_client_element_themes_repository_url }}" + version: "{{ matrix_client_element_themes_repository_version }}" dest: "{{ role_path }}/files/scratchpad/themes" - name: Find all Element theme files From 1693c4ca1d4cd3276966d5818d19c505081da86a Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Mon, 18 Jul 2022 15:08:10 +0300 Subject: [PATCH 09/16] Fix no-changed-when ansible-lint errors Reference: https://ansible-lint.readthedocs.io/en/latest/default_rules/#no-changed-when --- .../tasks/migrate_nedb_to_postgres.yml | 4 ++ .../tasks/setup_install.yml | 10 ++++- .../tasks/migrate_nedb_to_postgres.yml | 4 ++ .../tasks/setup_install.yml | 19 ++++++---- .../tasks/setup_install.yml | 18 +++++---- .../tasks/setup_install.yml | 5 ++- .../tasks/run_docker_prune.yml | 5 ++- roles/matrix-dendrite/tasks/register_user.yml | 7 +++- roles/matrix-ma1sd/tasks/migrate_mxisd.yml | 15 ++++++-- .../tasks/import_generic_sqlite_db.yml | 4 ++ .../matrix-postgres/tasks/import_postgres.yml | 5 ++- .../tasks/import_synapse_sqlite_db.yml | 31 +++++++++------- .../tasks/migrate_postgres_data_directory.yml | 5 ++- roles/matrix-postgres/tasks/run_vacuum.yml | 3 +- .../tasks/upgrade_postgres.yml | 37 ++++++++++++------- 15 files changed, 116 insertions(+), 56 deletions(-) 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 6b87ab01..d5f4eefd 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 @@ -52,6 +52,8 @@ {{ matrix_appservice_irc_docker_image }} -c '/usr/local/bin/node /app/lib/scripts/migrate-db-to-pgres.js --dbdir /data --privateKey /data/passkey.pem --connectionString {{ matrix_appservice_irc_database_connection_string }}' + register: matrix_appservice_irc_import_nedb_to_postgres_result + changed_when: matrix_appservice_irc_import_nedb_to_postgres_result.rc == 0 - name: Archive NeDB database files ansible.builtin.command: @@ -59,6 +61,8 @@ with_items: - rooms.db - users.db + register: matrix_appservice_irc_import_nedb_to_postgres_move_result + changed_when: matrix_appservice_irc_import_nedb_to_postgres_move_result.rc == 0 - name: Inject result ansible.builtin.set_fact: diff --git a/roles/matrix-bridge-appservice-irc/tasks/setup_install.yml b/roles/matrix-bridge-appservice-irc/tasks/setup_install.yml index 5362491c..6b7fc92d 100644 --- a/roles/matrix-bridge-appservice-irc/tasks/setup_install.yml +++ b/roles/matrix-bridge-appservice-irc/tasks/setup_install.yml @@ -30,10 +30,16 @@ failed_when: false - name: (Data relocation) Move AppService IRC passkey.pem file to ./data directory - ansible.builtin.command: "mv {{ matrix_appservice_irc_base_path }}/passkey.pem {{ matrix_appservice_irc_data_path }}/passkey.pem" + ansible.builtin.command: + cmd: "mv {{ matrix_appservice_irc_base_path }}/passkey.pem {{ matrix_appservice_irc_data_path }}/passkey.pem" + register: matrix_appservice_irc_move_passkey_result + changed_when: matrix_appservice_irc_move_passkey_result.rc == 0 - name: (Data relocation) Move AppService IRC database files to ./data directory - ansible.builtin.command: "mv {{ matrix_appservice_irc_base_path }}/{{ item }} {{ matrix_appservice_irc_data_path }}/{{ item }}" + ansible.builtin.command: + cmd: "mv {{ matrix_appservice_irc_base_path }}/{{ item }} {{ matrix_appservice_irc_data_path }}/{{ item }}" + register: matrix_appservice_irc_move_dbs_result + changed_when: matrix_appservice_irc_move_dbs_result.rc == 0 with_items: - rooms.db - users.db 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 a13d9cc2..b9aca080 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 @@ -46,10 +46,14 @@ {{ matrix_appservice_slack_docker_image }} -c '/usr/local/bin/node /usr/src/app/lib/scripts/migrateToPostgres.js --dbdir /data --connectionString {{ matrix_appservice_slack_database_connection_string }}' + register: matrix_appservice_slack_import_nedb_to_postgres_result + changed_when: matrix_appservice_slack_import_nedb_to_postgres_result.rc == 0 - name: Archive NeDB database files ansible.builtin.command: cmd: "mv {{ matrix_appservice_slack_data_path }}/{{ item }} {{ matrix_appservice_slack_data_path }}/{{ item }}.backup" + register: matrix_appservice_slack_import_nedb_to_postgres_move_result + changed_when: matrix_appservice_slack_import_nedb_to_postgres_move_result.rc == 0 with_items: - teams.db - room-store.db diff --git a/roles/matrix-bridge-beeper-linkedin/tasks/setup_install.yml b/roles/matrix-bridge-beeper-linkedin/tasks/setup_install.yml index bfbc1a6b..04a787b8 100644 --- a/roles/matrix-bridge-beeper-linkedin/tasks/setup_install.yml +++ b/roles/matrix-bridge-beeper-linkedin/tasks/setup_install.yml @@ -48,14 +48,17 @@ # Building the container image (using the default Dockerfile) requires that a docker-requirements.txt file be generated. # See: https://gitlab.com/beeper/linkedin/-/blob/94442db17ccb9769b377cdb8e4bf1cb3955781d7/.gitlab-ci.yml#L30-40 - name: Ensure docker-requirements.txt is generated before building Beeper LinkedIn Docker Image - ansible.builtin.command: | - {{ matrix_host_command_docker }} run \ - --rm \ - --entrypoint=/bin/sh \ - --mount type=bind,src={{ matrix_beeper_linkedin_docker_src_files_path }},dst=/work \ - -w /work \ - docker.io/python:3.9.6-buster \ - -c "pip install poetry && poetry export --without-hashes -E e2be -E images -E metrics | sed 's/==.*//g' > docker-requirements.txt" + ansible.builtin.command: + cmd: | + {{ matrix_host_command_docker }} run \ + --rm \ + --entrypoint=/bin/sh \ + --mount type=bind,src={{ matrix_beeper_linkedin_docker_src_files_path }},dst=/work \ + -w /work \ + docker.io/python:3.9.6-buster \ + -c "pip install poetry && poetry export --without-hashes -E e2be -E images -E metrics | sed 's/==.*//g' > docker-requirements.txt" + register: matrix_beeper_linkedin_generate_docker_requirements_result + changed_when: matrix_beeper_linkedin_generate_docker_requirements_result.rc == 0 - name: Ensure Beeper LinkedIn Docker image is built docker_image: diff --git a/roles/matrix-bridge-hookshot/tasks/setup_install.yml b/roles/matrix-bridge-hookshot/tasks/setup_install.yml index e1ced948..0c6bfc34 100644 --- a/roles/matrix-bridge-hookshot/tasks/setup_install.yml +++ b/roles/matrix-bridge-hookshot/tasks/setup_install.yml @@ -69,15 +69,17 @@ group: "{{ matrix_user_groupname }}" - name: Validate hookshot config.yml - ansible.builtin.command: | - {{ matrix_host_command_docker }} run - --rm - --name={{ matrix_hookshot_container_url }}-validate - --user={{ matrix_user_uid }}:{{ matrix_user_gid }} - --cap-drop=ALL - -v {{ matrix_hookshot_base_path }}/config.yml:/config.yml - {{ matrix_hookshot_docker_image }} node Config/Config.js /config.yml + ansible.builtin.command: + cmd: | + {{ matrix_host_command_docker }} run + --rm + --name={{ matrix_hookshot_container_url }}-validate + --user={{ matrix_user_uid }}:{{ matrix_user_gid }} + --cap-drop=ALL + -v {{ matrix_hookshot_base_path }}/config.yml:/config.yml + {{ matrix_hookshot_docker_image }} node Config/Config.js /config.yml register: hookshot_config_validation_result + changed_when: false - name: Fail if hookshot config.yml invalid ansible.builtin.fail: 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 48c92bf0..77b4d1cd 100644 --- a/roles/matrix-bridge-mx-puppet-discord/tasks/setup_install.yml +++ b/roles/matrix-bridge-mx-puppet-discord/tasks/setup_install.yml @@ -36,7 +36,10 @@ failed_when: false - name: (Data relocation) Move mx-puppet-discord database file to ./data directory - ansible.builtin.command: "mv {{ matrix_mx_puppet_discord_base_path }}/database.db {{ matrix_mx_puppet_discord_data_path }}/database.db" + ansible.builtin.command: + cmd: "mv {{ matrix_mx_puppet_discord_base_path }}/database.db {{ matrix_mx_puppet_discord_data_path }}/database.db" + register: matrix_mx_puppet_discord_relocate_database_result + changed_when: matrix_mx_puppet_discord_relocate_database_result.rc == 0 when: "matrix_mx_puppet_discord_stat_database.stat.exists" - ansible.builtin.set_fact: diff --git a/roles/matrix-common-after/tasks/run_docker_prune.yml b/roles/matrix-common-after/tasks/run_docker_prune.yml index 27fc1615..02dfadc5 100644 --- a/roles/matrix-common-after/tasks/run_docker_prune.yml +++ b/roles/matrix-common-after/tasks/run_docker_prune.yml @@ -1,4 +1,7 @@ --- - name: Run Docker System Prune - ansible.builtin.command: "{{ matrix_host_command_docker }} system prune -a -f" + ansible.builtin.command: + cmd: "{{ matrix_host_command_docker }} system prune -a -f" + register: matrix_common_after_docker_prune_result + changed_when: matrix_common_after_docker_prune_result.rc == 0 diff --git a/roles/matrix-dendrite/tasks/register_user.yml b/roles/matrix-dendrite/tasks/register_user.yml index d1ac111e..52544d5c 100644 --- a/roles/matrix-dendrite/tasks/register_user.yml +++ b/roles/matrix-dendrite/tasks/register_user.yml @@ -19,7 +19,10 @@ - name: Wait a while, so that Dendrite can manage to start ansible.builtin.pause: seconds: 7 - when: "start_result.changed" + when: start_result.changed | bool - name: Register user - ansible.builtin.command: "{{ matrix_local_bin_path }}/matrix-dendrite-create-account {{ username|quote }} {{ password|quote }}" + ansible.builtin.command: + cmd: "{{ matrix_local_bin_path }}/matrix-dendrite-create-account {{ username|quote }} {{ password|quote }}" + register: matrix_dendrite_register_user_result + changed_when: matrix_dendrite_register_user_result.rc == 0 diff --git a/roles/matrix-ma1sd/tasks/migrate_mxisd.yml b/roles/matrix-ma1sd/tasks/migrate_mxisd.yml index f80af0fd..7457001c 100644 --- a/roles/matrix-ma1sd/tasks/migrate_mxisd.yml +++ b/roles/matrix-ma1sd/tasks/migrate_mxisd.yml @@ -44,7 +44,10 @@ # recursively copy remote directories (like `/matrix/mxisd/data/sign.key`) in older versions of Ansible. - block: - name: Copy mxisd data files to ma1sd folder - ansible.builtin.command: "cp -ar {{ matrix_base_data_path }}/mxisd/data {{ matrix_ma1sd_base_path }}" + ansible.builtin.command: + cmd: "cp -ar {{ matrix_base_data_path }}/mxisd/data {{ matrix_ma1sd_base_path }}" + register: matrix_ma1sd_migrate_mxisd_data_files_copying_result + changed_when: matrix_ma1sd_migrate_mxisd_data_files_copying_result.rc == 0 - name: Check existence of mxisd.db file ansible.builtin.stat: @@ -52,11 +55,17 @@ register: matrix_ma1sd_mxisd_db_stat - name: Rename database (mxisd.db -> ma1sd.db) - ansible.builtin.command: "mv {{ matrix_ma1sd_data_path }}/mxisd.db {{ matrix_ma1sd_data_path }}/ma1sd.db" + ansible.builtin.command: + cmd: "mv {{ matrix_ma1sd_data_path }}/mxisd.db {{ matrix_ma1sd_data_path }}/ma1sd.db" + register: matrix_ma1sd_migrate_mxisd_move_db_result + changed_when: matrix_ma1sd_migrate_mxisd_move_db_result.rc == 0 when: "matrix_ma1sd_mxisd_db_stat.stat.exists" - name: Rename mxisd folder - ansible.builtin.command: "mv {{ matrix_base_data_path }}/mxisd {{ matrix_base_data_path }}/mxisd.migrated" + ansible.builtin.command: + cmd: "mv {{ matrix_base_data_path }}/mxisd {{ matrix_base_data_path }}/mxisd.migrated" + register: matrix_ma1sd_migrate_mxisd_move_directory_result + changed_when: matrix_ma1sd_migrate_mxisd_move_directory_result.rc == 0 when: "ma1sd_migrate_mxisd_data_dir_stat.stat.exists" - name: Ensure outdated matrix-mxisd.service doesn't exist diff --git a/roles/matrix-postgres/tasks/import_generic_sqlite_db.yml b/roles/matrix-postgres/tasks/import_generic_sqlite_db.yml index 37f3353e..671cb33f 100644 --- a/roles/matrix-postgres/tasks/import_generic_sqlite_db.yml +++ b/roles/matrix-postgres/tasks/import_generic_sqlite_db.yml @@ -80,10 +80,14 @@ {{ matrix_postgres_pgloader_docker_image }} -c 'pgloader /in.db {{ postgres_db_connection_string }}' + register: matrix_postgres_import_generic_sqlite_db_import_result + changed_when: matrix_postgres_import_generic_sqlite_db_import_result.rc == 0 - name: Archive SQLite database ({{ sqlite_database_path }} -> {{ sqlite_database_path }}.backup) ansible.builtin.command: cmd: "mv {{ sqlite_database_path }} {{ sqlite_database_path }}.backup" + register: matrix_postgres_import_generic_sqlite_db_move_result + changed_when: matrix_postgres_import_generic_sqlite_db_move_result.rc == 0 - name: Inject result ansible.builtin.set_fact: diff --git a/roles/matrix-postgres/tasks/import_postgres.yml b/roles/matrix-postgres/tasks/import_postgres.yml index d74afe1d..00d7ee3d 100644 --- a/roles/matrix-postgres/tasks/import_postgres.yml +++ b/roles/matrix-postgres/tasks/import_postgres.yml @@ -101,6 +101,9 @@ and manually run the above import command directly on the server. - name: Perform Postgres database import - ansible.builtin.command: "{{ matrix_postgres_import_command }}" + ansible.builtin.command: + cmd: "{{ matrix_postgres_import_command }}" async: "{{ postgres_import_wait_time }}" poll: 10 + register: matrix_postgres_import_postgres_command_result + changed_when: matrix_postgres_import_postgres_command_result.rc == 0 diff --git a/roles/matrix-postgres/tasks/import_synapse_sqlite_db.yml b/roles/matrix-postgres/tasks/import_synapse_sqlite_db.yml index 636b7b8e..a459b6e1 100644 --- a/roles/matrix-postgres/tasks/import_synapse_sqlite_db.yml +++ b/roles/matrix-postgres/tasks/import_synapse_sqlite_db.yml @@ -70,17 +70,20 @@ # Also, some old `docker_container` versions were buggy and would leave containers behind # on failure, which we had to work around to allow retries (by re-running the playbook). - name: Import SQLite database into Postgres - ansible.builtin.command: | - docker run - --rm - --name=matrix-synapse-migrate - --log-driver=none - --user={{ matrix_user_uid }}:{{ matrix_user_gid }} - --cap-drop=ALL - --network={{ matrix_docker_network }} - --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 }} - {{ matrix_synapse_docker_image }} - /usr/local/bin/synapse_port_db --sqlite-database /{{ server_path_homeserver_db | basename }} --postgres-config /data/homeserver.yaml + ansible.builtin.command: + cmd: | + docker run + --rm + --name=matrix-synapse-migrate + --log-driver=none + --user={{ matrix_user_uid }}:{{ matrix_user_gid }} + --cap-drop=ALL + --network={{ matrix_docker_network }} + --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 }} + {{ matrix_synapse_docker_image }} + /usr/local/bin/synapse_port_db --sqlite-database /{{ server_path_homeserver_db | basename }} --postgres-config /data/homeserver.yaml + register: matrix_postgres_import_synapse_sqlite_db_result + changed_when: matrix_postgres_import_synapse_sqlite_db_result.rc == 0 diff --git a/roles/matrix-postgres/tasks/migrate_postgres_data_directory.yml b/roles/matrix-postgres/tasks/migrate_postgres_data_directory.yml index 8c92e3e9..aeb54680 100644 --- a/roles/matrix-postgres/tasks/migrate_postgres_data_directory.yml +++ b/roles/matrix-postgres/tasks/migrate_postgres_data_directory.yml @@ -51,8 +51,11 @@ - 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: + cmd: "mv {{ item.path }} {{ matrix_postgres_data_path }}/{{ item.path | basename }}" with_items: "{{ result_pg_old_data_dir_find.files }}" + register: matrix_postgres_migrate_postgres_data_directory_move_result + changed_when: matrix_postgres_migrate_postgres_data_directory_move_result.rc == 0 when: "result_pg_old_data_dir_stat.stat.exists" # Intentionally not starting matrix-postgres here. diff --git a/roles/matrix-postgres/tasks/run_vacuum.yml b/roles/matrix-postgres/tasks/run_vacuum.yml index 04088588..39761fc6 100644 --- a/roles/matrix-postgres/tasks/run_vacuum.yml +++ b/roles/matrix-postgres/tasks/run_vacuum.yml @@ -65,7 +65,7 @@ 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' }}" + 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' }}" - name: Ensure matrix-synapse is stopped ansible.builtin.service: @@ -78,6 +78,7 @@ async: "{{ postgres_vacuum_wait_time }}" poll: 10 register: matrix_postgres_synapse_vacuum_result + changed_when: matrix_postgres_synapse_vacuum_result.rc == 0 # Intentionally show the results - ansible.builtin.debug: var="matrix_postgres_synapse_vacuum_result" diff --git a/roles/matrix-postgres/tasks/upgrade_postgres.yml b/roles/matrix-postgres/tasks/upgrade_postgres.yml index 8e0d480d..6adeaa29 100644 --- a/roles/matrix-postgres/tasks/upgrade_postgres.yml +++ b/roles/matrix-postgres/tasks/upgrade_postgres.yml @@ -78,18 +78,21 @@ # role (`matrix_postgres_connection_username`) and database (`matrix_postgres_db_name`) by itself on startup, # we need to remove these from the dump, or we'll get errors saying these already exist. - name: Perform Postgres database dump - ansible.builtin.command: >- - {{ matrix_host_command_docker }} run --rm --name matrix-postgres-dump - --log-driver=none - --user={{ matrix_user_uid }}:{{ matrix_user_gid }} - --network={{ matrix_docker_network }} - --env-file={{ matrix_postgres_base_path }}/env-postgres-psql - --entrypoint=/bin/sh - --mount type=bind,src={{ postgres_dump_dir }},dst=/out - {{ matrix_postgres_detected_version_corresponding_docker_image }} - -c "pg_dumpall -h matrix-postgres - {{ '| gzip -c ' if postgres_dump_name.endswith('.gz') else '' }} - > /out/{{ postgres_dump_name }}" + ansible.builtin.command: + cmd: >- + {{ matrix_host_command_docker }} run --rm --name matrix-postgres-dump + --log-driver=none + --user={{ matrix_user_uid }}:{{ matrix_user_gid }} + --network={{ matrix_docker_network }} + --env-file={{ matrix_postgres_base_path }}/env-postgres-psql + --entrypoint=/bin/sh + --mount type=bind,src={{ postgres_dump_dir }},dst=/out + {{ matrix_postgres_detected_version_corresponding_docker_image }} + -c "pg_dumpall -h matrix-postgres + {{ '| gzip -c ' if postgres_dump_name.endswith('.gz') else '' }} + > /out/{{ postgres_dump_name }}" + register: matrix_postgres_upgrade_postgres_dump_command_result + changed_when: matrix_postgres_upgrade_postgres_dump_command_result.rc == 0 - name: Ensure matrix-postgres is stopped ansible.builtin.service: @@ -97,7 +100,10 @@ state: stopped - name: Rename existing Postgres data directory - ansible.builtin.command: "mv {{ matrix_postgres_data_path }} {{ postgres_auto_upgrade_backup_data_path }}" + ansible.builtin.command: + cmd: "mv {{ matrix_postgres_data_path }} {{ postgres_auto_upgrade_backup_data_path }}" + register: matrix_postgres_upgrade_postgres_move_command_result + changed_when: matrix_postgres_upgrade_postgres_move_command_result.rc == 0 - 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." @@ -155,7 +161,10 @@ and restore the automatically-made backup (`mv {{ postgres_auto_upgrade_backup_data_path }} {{ matrix_postgres_data_path }}`). - name: Perform Postgres database import - ansible.builtin.command: "{{ matrix_postgres_import_command }}" + ansible.builtin.command: + cmd: "{{ matrix_postgres_import_command }}" + register: matrix_postgres_upgrade_postgres_import_command_result + changed_when: matrix_postgres_upgrade_postgres_import_command_result.rc == 0 - name: Delete Postgres database dump file ansible.builtin.file: From cac9bf2637fd37b72bb62752e7c0cbc6fb75a4f5 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Mon, 18 Jul 2022 15:13:09 +0300 Subject: [PATCH 10/16] Fix syntax error regression --- roles/matrix-synapse/vars/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/matrix-synapse/vars/main.yml b/roles/matrix-synapse/vars/main.yml index 62fa0ac2..e049fcd1 100644 --- a/roles/matrix-synapse/vars/main.yml +++ b/roles/matrix-synapse/vars/main.yml @@ -24,11 +24,11 @@ matrix_synapse_media_store_directory_name: "{{ matrix_synapse_media_store_path | # 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]) }}" From c1849ae888133ad8e69b29f719a62416b355234f Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Mon, 18 Jul 2022 15:33:41 +0300 Subject: [PATCH 11/16] Fix the remaining var-spacing ansible-lint errors Reference: https://ansible-lint.readthedocs.io/en/latest/default_rules/#var-spacing --- roles/matrix-bridge-appservice-slack/defaults/main.yml | 2 +- roles/matrix-dendrite/tasks/register_user.yml | 2 +- roles/matrix-postgres/defaults/main.yml | 4 ++-- roles/matrix-postgres/tasks/import_postgres.yml | 2 ++ roles/matrix-postgres/tasks/upgrade_postgres.yml | 4 ++++ roles/matrix-synapse/vars/main.yml | 6 +++++- 6 files changed, 15 insertions(+), 5 deletions(-) diff --git a/roles/matrix-bridge-appservice-slack/defaults/main.yml b/roles/matrix-bridge-appservice-slack/defaults/main.yml index a27f4db5..6e5285cf 100644 --- a/roles/matrix-bridge-appservice-slack/defaults/main.yml +++ b/roles/matrix-bridge-appservice-slack/defaults/main.yml @@ -115,7 +115,7 @@ matrix_appservice_slack_registration_yaml: | - exclusive: false regex: '#{{ matrix_appservice_slack_user_prefix }}.*' rooms: [] - url: "{{matrix_appservice_slack_appservice_url}}:{{ matrix_appservice_slack_matrix_port }}" + url: "{{ matrix_appservice_slack_appservice_url }}:{{ matrix_appservice_slack_matrix_port }}" sender_localpart: slackbot rate_limited: true protocols: null diff --git a/roles/matrix-dendrite/tasks/register_user.yml b/roles/matrix-dendrite/tasks/register_user.yml index 52544d5c..e1b97482 100644 --- a/roles/matrix-dendrite/tasks/register_user.yml +++ b/roles/matrix-dendrite/tasks/register_user.yml @@ -23,6 +23,6 @@ - name: Register user ansible.builtin.command: - cmd: "{{ matrix_local_bin_path }}/matrix-dendrite-create-account {{ username|quote }} {{ password|quote }}" + cmd: "{{ matrix_local_bin_path }}/matrix-dendrite-create-account {{ username | quote }} {{ password | quote }}" register: matrix_dendrite_register_user_result changed_when: matrix_dendrite_register_user_result.rc == 0 diff --git a/roles/matrix-postgres/defaults/main.yml b/roles/matrix-postgres/defaults/main.yml index b5442309..39481f2e 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)" # noqa var-spacing # 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" # noqa var-spacing # 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_postgres.yml b/roles/matrix-postgres/tasks/import_postgres.yml index 00d7ee3d..24a87dfb 100644 --- a/roles/matrix-postgres/tasks/import_postgres.yml +++ b/roles/matrix-postgres/tasks/import_postgres.yml @@ -84,6 +84,8 @@ grep -vE '{{ matrix_postgres_import_roles_ignore_regex }}' | grep -vE '{{ matrix_postgres_import_databases_ignore_regex }}' | psql -v ON_ERROR_STOP=1 -h matrix-postgres --dbname={{ postgres_default_import_database }}" + tags: + - skip_ansible_lint # This is a hack. # See: https://ansibledaily.com/print-to-standard-output-without-escaping/ diff --git a/roles/matrix-postgres/tasks/upgrade_postgres.yml b/roles/matrix-postgres/tasks/upgrade_postgres.yml index 6adeaa29..53e5796b 100644 --- a/roles/matrix-postgres/tasks/upgrade_postgres.yml +++ b/roles/matrix-postgres/tasks/upgrade_postgres.yml @@ -93,6 +93,8 @@ > /out/{{ postgres_dump_name }}" register: matrix_postgres_upgrade_postgres_dump_command_result changed_when: matrix_postgres_upgrade_postgres_dump_command_result.rc == 0 + tags: + - skip_ansible_lint - name: Ensure matrix-postgres is stopped ansible.builtin.service: @@ -144,6 +146,8 @@ grep -vE '{{ matrix_postgres_import_roles_ignore_regex }}' | grep -vE '{{ matrix_postgres_import_databases_ignore_regex }}' | psql -v ON_ERROR_STOP=1 -h matrix-postgres" + tags: + - skip_ansible_lint # This is a hack. # See: https://ansibledaily.com/print-to-standard-output-without-escaping/ diff --git a/roles/matrix-synapse/vars/main.yml b/roles/matrix-synapse/vars/main.yml index e049fcd1..2d9b62cf 100644 --- a/roles/matrix-synapse/vars/main.yml +++ b/roles/matrix-synapse/vars/main.yml @@ -31,4 +31,8 @@ matrix_synapse_workers_generic_worker_client_server_endpoints: "{{ matrix_synaps # # 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_synapse_workers_generic_worker_federation_endpoints_regex) | list | difference([none]) }}" + +# matrix_synapse_workers_generic_worker_federation_endpoints_regex contains the regex used in matrix_synapse_workers_generic_worker_federation_endpoints. +# It's intentionally put in a separate variable, to avoid tripping ansible-lint's var-spacing rule. +matrix_synapse_workers_generic_worker_federation_endpoints_regex: '.*(/_matrix/federation|/_matrix/key).*' From 3408c710ee0e9d9ad5e525ca9b8ecd0d16780146 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Mon, 18 Jul 2022 15:43:02 +0300 Subject: [PATCH 12/16] Add ansible-lint configuration file --- .config/ansible-lint.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .config/ansible-lint.yml diff --git a/.config/ansible-lint.yml b/.config/ansible-lint.yml new file mode 100644 index 00000000..9b409a06 --- /dev/null +++ b/.config/ansible-lint.yml @@ -0,0 +1,14 @@ +--- + +use_default_rules: true + +skip_list: + - unnamed-task + - no-handler + - no-jinja-nesting + - schema + - var-naming + - command-instead-of-shell + - role-name + +offline: false From 7831dc91b3a9617642660b069855fbfd96c76750 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Mon, 18 Jul 2022 16:15:04 +0300 Subject: [PATCH 13/16] Import tasks from other roles in a better way One that doesn't trip up ansible-lint, causing `load-failure` errors. --- roles/matrix-backup-borg/tasks/setup_install.yml | 5 ++++- roles/matrix-bot-buscarron/tasks/setup_install.yml | 4 +++- roles/matrix-bot-honoroit/tasks/setup_install.yml | 4 +++- .../tasks/setup_install.yml | 4 +++- .../tasks/setup_install.yml | 4 +++- .../matrix-bridge-go-skype-bridge/tasks/setup_install.yml | 4 +++- .../tasks/setup_install.yml | 4 +++- .../tasks/setup_install.yml | 4 +++- .../tasks/setup_install.yml | 4 +++- .../tasks/setup_install.yml | 4 +++- .../tasks/setup_install.yml | 4 +++- .../tasks/setup_install.yml | 4 +++- .../tasks/setup_install.yml | 4 +++- .../tasks/setup_install.yml | 4 +++- .../matrix-bridge-mx-puppet-slack/tasks/setup_install.yml | 4 +++- .../matrix-bridge-mx-puppet-steam/tasks/setup_install.yml | 4 +++- .../tasks/setup_install.yml | 4 +++- roles/matrix-dimension/tasks/setup_install.yml | 4 +++- roles/matrix-ma1sd/tasks/setup_install.yml | 4 +++- .../tasks/setup_postgres_backup.yml | 8 +++++--- .../tasks/{util => }/detect_existing_postgres_version.yml | 3 +++ roles/matrix-postgres/tasks/import_postgres.yml | 2 +- .../tasks/{util => }/migrate_db_to_postgres.yml | 6 +++--- .../tasks/migrate_postgres_data_directory.yml | 3 +++ roles/matrix-postgres/tasks/run_vacuum.yml | 2 +- roles/matrix-postgres/tasks/setup_postgres.yml | 2 +- roles/matrix-postgres/tasks/upgrade_postgres.yml | 2 +- roles/matrix-registration/tasks/setup_install.yml | 4 +++- 28 files changed, 79 insertions(+), 30 deletions(-) rename roles/matrix-postgres/tasks/{util => }/detect_existing_postgres_version.yml (92%) rename roles/matrix-postgres/tasks/{util => }/migrate_db_to_postgres.yml (96%) diff --git a/roles/matrix-backup-borg/tasks/setup_install.yml b/roles/matrix-backup-borg/tasks/setup_install.yml index 95f1a5de..cc9816fa 100644 --- a/roles/matrix-backup-borg/tasks/setup_install.yml +++ b/roles/matrix-backup-borg/tasks/setup_install.yml @@ -1,6 +1,9 @@ --- + - block: - - ansible.builtin.import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/detect_existing_postgres_version.yml" + - ansible.builtin.import_role: + name: matrix-postgres + tasks_from: detect_existing_postgres_version - name: Fail if detected Postgres version is unsupported ansible.builtin.fail: diff --git a/roles/matrix-bot-buscarron/tasks/setup_install.yml b/roles/matrix-bot-buscarron/tasks/setup_install.yml index b2ed24f5..0db7b728 100644 --- a/roles/matrix-bot-buscarron/tasks/setup_install.yml +++ b/roles/matrix-bot-buscarron/tasks/setup_install.yml @@ -18,7 +18,9 @@ engine_old: 'sqlite' systemd_services_to_stop: ['matrix-bot-buscarron.service'] - - ansible.builtin.import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" + - ansible.builtin.import_role: + name: matrix-postgres + tasks_from: migrate_db_to_postgres - ansible.builtin.set_fact: matrix_bot_buscarron_requires_restart: true diff --git a/roles/matrix-bot-honoroit/tasks/setup_install.yml b/roles/matrix-bot-honoroit/tasks/setup_install.yml index b2a6e0d4..9bb979fc 100644 --- a/roles/matrix-bot-honoroit/tasks/setup_install.yml +++ b/roles/matrix-bot-honoroit/tasks/setup_install.yml @@ -18,7 +18,9 @@ engine_old: 'sqlite' systemd_services_to_stop: ['matrix-bot-honoroit.service'] - - ansible.builtin.import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" + - ansible.builtin.import_role: + name: matrix-postgres + tasks_from: migrate_db_to_postgres - ansible.builtin.set_fact: matrix_bot_honoroit_requires_restart: true 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 f66542b8..0ad895af 100644 --- a/roles/matrix-bot-matrix-reminder-bot/tasks/setup_install.yml +++ b/roles/matrix-bot-matrix-reminder-bot/tasks/setup_install.yml @@ -19,7 +19,9 @@ engine_old: 'sqlite' systemd_services_to_stop: ['matrix-bot-matrix-reminder-bot.service'] - - ansible.builtin.import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" + - ansible.builtin.import_role: + name: matrix-postgres + tasks_from: migrate_db_to_postgres - ansible.builtin.set_fact: matrix_bot_matrix_reminder_bot_requires_restart: true diff --git a/roles/matrix-bridge-appservice-discord/tasks/setup_install.yml b/roles/matrix-bridge-appservice-discord/tasks/setup_install.yml index 4b12442b..af17613c 100644 --- a/roles/matrix-bridge-appservice-discord/tasks/setup_install.yml +++ b/roles/matrix-bridge-appservice-discord/tasks/setup_install.yml @@ -19,7 +19,9 @@ engine_old: 'sqlite' systemd_services_to_stop: ['matrix-appservice-discord.service'] - - ansible.builtin.import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" + - ansible.builtin.import_role: + name: matrix-postgres + tasks_from: migrate_db_to_postgres - ansible.builtin.set_fact: matrix_appservice_discord_requires_restart: true 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 ba37c59c..7403ff5c 100644 --- a/roles/matrix-bridge-go-skype-bridge/tasks/setup_install.yml +++ b/roles/matrix-bridge-go-skype-bridge/tasks/setup_install.yml @@ -28,7 +28,9 @@ systemd_services_to_stop: ['matrix-go-skype-bridge.service'] pgloader_options: ['--with "quote identifiers"'] - - ansible.builtin.import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" + - ansible.builtin.import_role: + name: matrix-postgres + tasks_from: migrate_db_to_postgres - ansible.builtin.set_fact: matrix_go_skype_bridge_requires_restart: true diff --git a/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml index 0855c197..3e7d8f05 100644 --- a/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml @@ -27,7 +27,9 @@ engine_old: 'sqlite' systemd_services_to_stop: ['matrix-mautrix-facebook.service'] - - ansible.builtin.import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" + - ansible.builtin.import_role: + name: matrix-postgres + tasks_from: migrate_db_to_postgres - ansible.builtin.set_fact: matrix_mautrix_facebook_requires_restart: true diff --git a/roles/matrix-bridge-mautrix-googlechat/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-googlechat/tasks/setup_install.yml index 47dd9b12..f2192a34 100644 --- a/roles/matrix-bridge-mautrix-googlechat/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-googlechat/tasks/setup_install.yml @@ -27,7 +27,9 @@ engine_old: 'sqlite' systemd_services_to_stop: ['matrix-mautrix-googlechat.service'] - - ansible.builtin.import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" + - ansible.builtin.import_role: + name: matrix-postgres + tasks_from: migrate_db_to_postgres - ansible.builtin.set_fact: matrix_mautrix_googlechat_requires_restart: true diff --git a/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml index 45a79fb4..4087162e 100644 --- a/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml @@ -27,7 +27,9 @@ engine_old: 'sqlite' systemd_services_to_stop: ['matrix-mautrix-hangouts.service'] - - ansible.builtin.import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" + - ansible.builtin.import_role: + name: matrix-postgres + tasks_from: migrate_db_to_postgres - ansible.builtin.set_fact: matrix_mautrix_hangouts_requires_restart: true diff --git a/roles/matrix-bridge-mautrix-telegram/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-telegram/tasks/setup_install.yml index b6a0a745..6ce39657 100644 --- a/roles/matrix-bridge-mautrix-telegram/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-telegram/tasks/setup_install.yml @@ -27,7 +27,9 @@ engine_old: 'sqlite' systemd_services_to_stop: ['matrix-mautrix-telegram.service'] - - ansible.builtin.import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" + - ansible.builtin.import_role: + name: matrix-postgres + tasks_from: migrate_db_to_postgres - ansible.builtin.set_fact: matrix_mautrix_telegram_requires_restart: true diff --git a/roles/matrix-bridge-mautrix-whatsapp/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-whatsapp/tasks/setup_install.yml index c80407e1..c3edd6a7 100644 --- a/roles/matrix-bridge-mautrix-whatsapp/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-whatsapp/tasks/setup_install.yml @@ -28,7 +28,9 @@ systemd_services_to_stop: ['matrix-mautrix-whatsapp.service'] pgloader_options: ['--with "quote identifiers"'] - - ansible.builtin.import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" + - ansible.builtin.import_role: + name: matrix-postgres + tasks_from: migrate_db_to_postgres - ansible.builtin.set_fact: matrix_mautrix_whatsapp_requires_restart: true 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 77b4d1cd..d60f73f9 100644 --- a/roles/matrix-bridge-mx-puppet-discord/tasks/setup_install.yml +++ b/roles/matrix-bridge-mx-puppet-discord/tasks/setup_install.yml @@ -61,7 +61,9 @@ engine_old: 'sqlite' systemd_services_to_stop: ['matrix-mx-puppet-discord.service'] - - ansible.builtin.import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" + - ansible.builtin.import_role: + name: matrix-postgres + tasks_from: migrate_db_to_postgres - ansible.builtin.set_fact: matrix_mx_puppet_discord_requires_restart: true 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 812f8560..497f0109 100644 --- a/roles/matrix-bridge-mx-puppet-groupme/tasks/setup_install.yml +++ b/roles/matrix-bridge-mx-puppet-groupme/tasks/setup_install.yml @@ -59,7 +59,9 @@ engine_old: 'sqlite' systemd_services_to_stop: ['matrix-mx-puppet-groupme.service'] - - ansible.builtin.import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" + - ansible.builtin.import_role: + name: matrix-postgres + tasks_from: migrate_db_to_postgres - ansible.builtin.set_fact: matrix_mx_puppet_groupme_requires_restart: true 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 abd78144..7695d88e 100644 --- a/roles/matrix-bridge-mx-puppet-instagram/tasks/setup_install.yml +++ b/roles/matrix-bridge-mx-puppet-instagram/tasks/setup_install.yml @@ -28,7 +28,9 @@ engine_old: 'sqlite' systemd_services_to_stop: ['matrix-mx-puppet-instagram.service'] - - ansible.builtin.import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" + - ansible.builtin.import_role: + name: matrix-postgres + tasks_from: migrate_db_to_postgres - ansible.builtin.set_fact: matrix_mx_puppet_instagram_requires_restart: true 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 5dab3c4a..70dac9ac 100644 --- a/roles/matrix-bridge-mx-puppet-slack/tasks/setup_install.yml +++ b/roles/matrix-bridge-mx-puppet-slack/tasks/setup_install.yml @@ -55,7 +55,9 @@ engine_old: 'sqlite' systemd_services_to_stop: ['matrix-mx-puppet-slack.service'] - - ansible.builtin.import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" + - ansible.builtin.import_role: + name: matrix-postgres + tasks_from: migrate_db_to_postgres - ansible.builtin.set_fact: matrix_mx_puppet_slack_requires_restart: true 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 89de2456..80487630 100644 --- a/roles/matrix-bridge-mx-puppet-steam/tasks/setup_install.yml +++ b/roles/matrix-bridge-mx-puppet-steam/tasks/setup_install.yml @@ -59,7 +59,9 @@ engine_old: 'sqlite' systemd_services_to_stop: ['matrix-mx-puppet-steam.service'] - - ansible.builtin.import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" + - ansible.builtin.import_role: + name: matrix-postgres + tasks_from: migrate_db_to_postgres - ansible.builtin.set_fact: matrix_mx_puppet_steam_requires_restart: true 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 52c02fa9..305cd5de 100644 --- a/roles/matrix-bridge-mx-puppet-twitter/tasks/setup_install.yml +++ b/roles/matrix-bridge-mx-puppet-twitter/tasks/setup_install.yml @@ -59,7 +59,9 @@ engine_old: 'sqlite' systemd_services_to_stop: ['matrix-mx-puppet-twitter.service'] - - ansible.builtin.import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" + - ansible.builtin.import_role: + name: matrix-postgres + tasks_from: migrate_db_to_postgres - ansible.builtin.set_fact: matrix_mx_puppet_twitter_requires_restart: true diff --git a/roles/matrix-dimension/tasks/setup_install.yml b/roles/matrix-dimension/tasks/setup_install.yml index c5456174..7060285a 100644 --- a/roles/matrix-dimension/tasks/setup_install.yml +++ b/roles/matrix-dimension/tasks/setup_install.yml @@ -61,7 +61,9 @@ additional_psql_statements_list: "{{ matrix_dimension_pgloader_additional_psql_statements_list }}" additional_psql_statements_db_name: "{{ matrix_dimension_database_name }}" - - ansible.builtin.import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" + - ansible.builtin.import_role: + name: matrix-postgres + tasks_from: migrate_db_to_postgres - ansible.builtin.set_fact: matrix_dimension_requires_restart: true diff --git a/roles/matrix-ma1sd/tasks/setup_install.yml b/roles/matrix-ma1sd/tasks/setup_install.yml index 073f22aa..ef32288f 100644 --- a/roles/matrix-ma1sd/tasks/setup_install.yml +++ b/roles/matrix-ma1sd/tasks/setup_install.yml @@ -38,7 +38,9 @@ systemd_services_to_stop: ['matrix-ma1sd.service'] pgloader_options: ['--with "quote identifiers"'] - - ansible.builtin.import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" + - ansible.builtin.import_role: + name: matrix-postgres + tasks_from: migrate_db_to_postgres - ansible.builtin.set_fact: matrix_ma1sd_requires_restart: true diff --git a/roles/matrix-postgres-backup/tasks/setup_postgres_backup.yml b/roles/matrix-postgres-backup/tasks/setup_postgres_backup.yml index d45c152c..a6246757 100644 --- a/roles/matrix-postgres-backup/tasks/setup_postgres_backup.yml +++ b/roles/matrix-postgres-backup/tasks/setup_postgres_backup.yml @@ -1,9 +1,11 @@ --- # -# Tasks related to setting up an internal postgres server +# Tasks related to setting up postgres backup # -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/util/detect_existing_postgres_version.yml" +- ansible.builtin.import_role: + name: matrix-postgres + tasks_from: detect_existing_postgres_version 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. @@ -62,7 +64,7 @@ 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) +# Tasks related to getting rid of postgres backup (if it was previously enabled) # - name: Check existence of matrix-postgres-backup service diff --git a/roles/matrix-postgres/tasks/util/detect_existing_postgres_version.yml b/roles/matrix-postgres/tasks/detect_existing_postgres_version.yml similarity index 92% rename from roles/matrix-postgres/tasks/util/detect_existing_postgres_version.yml rename to roles/matrix-postgres/tasks/detect_existing_postgres_version.yml index 2d03cd7f..4f4e5e9a 100644 --- a/roles/matrix-postgres/tasks/util/detect_existing_postgres_version.yml +++ b/roles/matrix-postgres/tasks/detect_existing_postgres_version.yml @@ -2,6 +2,9 @@ # This utility aims to determine if there is some existing Postgres version in use or not. # If there is, it also tries to detect the Docker image that corresponds to that version. +# +# This utility is intentionally not in `tasks/util`, because if it were, it wouldn't be possible +# to include it in other roles via the import_role module: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/import_role_module.html - name: Initialize Postgres version determination variables (default to empty) ansible.builtin.set_fact: diff --git a/roles/matrix-postgres/tasks/import_postgres.yml b/roles/matrix-postgres/tasks/import_postgres.yml index 24a87dfb..53d67436 100644 --- a/roles/matrix-postgres/tasks/import_postgres.yml +++ b/roles/matrix-postgres/tasks/import_postgres.yml @@ -56,7 +56,7 @@ delegate_to: 127.0.0.1 become: false -- ansible.builtin.import_tasks: tasks/util/detect_existing_postgres_version.yml +- ansible.builtin.import_tasks: tasks/detect_existing_postgres_version.yml - name: Abort, if no existing Postgres version detected ansible.builtin.fail: diff --git a/roles/matrix-postgres/tasks/util/migrate_db_to_postgres.yml b/roles/matrix-postgres/tasks/migrate_db_to_postgres.yml similarity index 96% rename from roles/matrix-postgres/tasks/util/migrate_db_to_postgres.yml rename to roles/matrix-postgres/tasks/migrate_db_to_postgres.yml index 83d0d4e9..be967d68 100644 --- a/roles/matrix-postgres/tasks/util/migrate_db_to_postgres.yml +++ b/roles/matrix-postgres/tasks/migrate_db_to_postgres.yml @@ -135,9 +135,9 @@ changed_when: matrix_postgres_migrate_db_to_postgres_import_result.rc == 0 - 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. - - ansible.builtin.import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/detect_existing_postgres_version.yml" + - ansible.builtin.import_role: + name: matrix-postgres + tasks_from: detect_existing_postgres_version - 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 }}" diff --git a/roles/matrix-postgres/tasks/migrate_postgres_data_directory.yml b/roles/matrix-postgres/tasks/migrate_postgres_data_directory.yml index aeb54680..fde580f5 100644 --- a/roles/matrix-postgres/tasks/migrate_postgres_data_directory.yml +++ b/roles/matrix-postgres/tasks/migrate_postgres_data_directory.yml @@ -9,6 +9,9 @@ # # For this reason, we store the Postgres data in `/matrix/postgres/data` and need to relocate any installations # which still store it in the parent directory (`/matrix/postgres`). +# +# This utility is intentionally not in `tasks/util`, because if it were, it wouldn't be possible +# to include it in other roles via the import_role module: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/import_role_module.html - name: Check if old Postgres data directory is used ansible.builtin.stat: diff --git a/roles/matrix-postgres/tasks/run_vacuum.yml b/roles/matrix-postgres/tasks/run_vacuum.yml index 39761fc6..ce2bee6b 100644 --- a/roles/matrix-postgres/tasks/run_vacuum.yml +++ b/roles/matrix-postgres/tasks/run_vacuum.yml @@ -35,7 +35,7 @@ delegate_to: 127.0.0.1 become: false -- ansible.builtin.import_tasks: tasks/util/detect_existing_postgres_version.yml +- ansible.builtin.import_tasks: tasks/detect_existing_postgres_version.yml - name: Abort, if no existing Postgres version detected ansible.builtin.fail: diff --git a/roles/matrix-postgres/tasks/setup_postgres.yml b/roles/matrix-postgres/tasks/setup_postgres.yml index c292c92e..49eb3249 100644 --- a/roles/matrix-postgres/tasks/setup_postgres.yml +++ b/roles/matrix-postgres/tasks/setup_postgres.yml @@ -7,7 +7,7 @@ - ansible.builtin.import_tasks: "{{ role_path }}/tasks/migrate_postgres_data_directory.yml" when: matrix_postgres_enabled | bool -- ansible.builtin.import_tasks: "{{ role_path }}/tasks/util/detect_existing_postgres_version.yml" +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/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. diff --git a/roles/matrix-postgres/tasks/upgrade_postgres.yml b/roles/matrix-postgres/tasks/upgrade_postgres.yml index 53e5796b..2f228a4c 100644 --- a/roles/matrix-postgres/tasks/upgrade_postgres.yml +++ b/roles/matrix-postgres/tasks/upgrade_postgres.yml @@ -40,7 +40,7 @@ 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" -- ansible.builtin.import_tasks: tasks/util/detect_existing_postgres_version.yml +- ansible.builtin.import_tasks: tasks/detect_existing_postgres_version.yml - name: Abort, if no existing Postgres version detected ansible.builtin.fail: diff --git a/roles/matrix-registration/tasks/setup_install.yml b/roles/matrix-registration/tasks/setup_install.yml index dbdb4aea..d3048337 100644 --- a/roles/matrix-registration/tasks/setup_install.yml +++ b/roles/matrix-registration/tasks/setup_install.yml @@ -24,7 +24,9 @@ - ALTER TABLE tokens ALTER COLUMN ex_date TYPE TIMESTAMP WITHOUT TIME ZONE; additional_psql_statements_db_name: "{{ matrix_registration_database_name }}" - - ansible.builtin.import_tasks: "{{ role_path }}/../matrix-postgres/tasks/util/migrate_db_to_postgres.yml" + - ansible.builtin.import_role: + name: matrix-postgres + tasks_from: migrate_db_to_postgres - ansible.builtin.set_fact: matrix_registration_requires_restart: true From c73680712b9d954f668584c7cfdfca4a4d59e415 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Mon, 18 Jul 2022 16:43:12 +0300 Subject: [PATCH 14/16] Fix (suppress) var-naming ansible-lint errors Reference: https://ansible-lint.readthedocs.io/en/latest/default_rules/#var-naming We don't really fix these, but just suppress them, because they're like that intentionally. We try to name variables in a way that is consistent with the configuration key they control. If the upstream component uses camelCase, we also need to include camelCase in the variable name. --- .config/ansible-lint.yml | 1 - roles/matrix-base/defaults/main.yml | 2 +- .../defaults/main.yml | 12 ++++++------ .../defaults/main.yml | 19 ++++++++++--------- .../defaults/main.yml | 13 +++++++------ .../matrix-bridge-hookshot/defaults/main.yml | 16 ++++++++-------- .../defaults/main.yml | 2 +- roles/matrix-client-element/defaults/main.yml | 14 +++++++------- .../tasks/prepare_themes.yml | 2 +- roles/matrix-dimension/defaults/main.yml | 2 +- roles/matrix-jitsi/defaults/main.yml | 2 +- roles/matrix-ma1sd/defaults/main.yml | 4 ++-- 12 files changed, 45 insertions(+), 44 deletions(-) diff --git a/.config/ansible-lint.yml b/.config/ansible-lint.yml index 9b409a06..beff4658 100644 --- a/.config/ansible-lint.yml +++ b/.config/ansible-lint.yml @@ -7,7 +7,6 @@ skip_list: - no-handler - no-jinja-nesting - schema - - var-naming - command-instead-of-shell - role-name diff --git a/roles/matrix-base/defaults/main.yml b/roles/matrix-base/defaults/main.yml index 056b2694..b658f4e2 100644 --- a/roles/matrix-base/defaults/main.yml +++ b/roles/matrix-base/defaults/main.yml @@ -157,7 +157,7 @@ matrix_integration_manager_ui_url: ~ # The domain name where a Jitsi server is self-hosted. # If set, `/.well-known/matrix/client` will suggest Element clients to use that Jitsi server. # See: https://github.com/vector-im/element-web/blob/develop/docs/jitsi.md#configuring-element-to-use-your-self-hosted-jitsi-server -matrix_client_element_jitsi_preferredDomain: '' +matrix_client_element_jitsi_preferredDomain: '' # noqa var-naming # Controls whether Element should use End-to-End Encryption by default. # Setting this to false will update `/.well-known/matrix/client` and tell Element clients to avoid E2EE. diff --git a/roles/matrix-bridge-appservice-discord/defaults/main.yml b/roles/matrix-bridge-appservice-discord/defaults/main.yml index 683d7ecb..9f6109ed 100644 --- a/roles/matrix-bridge-appservice-discord/defaults/main.yml +++ b/roles/matrix-bridge-appservice-discord/defaults/main.yml @@ -39,10 +39,10 @@ matrix_appservice_discord_appservice_url: 'http://matrix-appservice-discord:9005 matrix_appservice_discord_bridge_domain: "{{ matrix_domain }}" # As of right now, the homeserver URL must be a public URL. See below. -matrix_appservice_discord_bridge_homeserverUrl: "{{ matrix_homeserver_url }}" -matrix_appservice_discord_bridge_disablePresence: false -matrix_appservice_discord_bridge_enableSelfServiceBridging: false -matrix_appservice_discord_bridge_disablePortalBridging: false +matrix_appservice_discord_bridge_homeserverUrl: "{{ matrix_homeserver_url }}" # noqa var-naming +matrix_appservice_discord_bridge_disablePresence: false # noqa var-naming +matrix_appservice_discord_bridge_enableSelfServiceBridging: false # noqa var-naming +matrix_appservice_discord_bridge_disablePortalBridging: false # noqa var-naming # Database-related configuration fields. # @@ -65,7 +65,7 @@ matrix_appservice_discord_database_name: 'matrix_appservice_discord' # These 2 variables are what actually ends up in the bridge configuration. # It's best if you don't change them directly, but rather redefine the sub-variables that constitute them. matrix_appservice_discord_database_filename: "{{ matrix_appservice_discord_sqlite_database_path_in_container }}" -matrix_appservice_discord_database_connString: 'postgresql://{{ matrix_appservice_discord_database_username }}:{{ matrix_appservice_discord_database_password }}@{{ matrix_appservice_discord_database_hostname }}:{{ matrix_appservice_discord_database_port }}/{{ matrix_appservice_discord_database_name }}' +matrix_appservice_discord_database_connString: 'postgresql://{{ matrix_appservice_discord_database_username }}:{{ matrix_appservice_discord_database_password }}@{{ matrix_appservice_discord_database_hostname }}:{{ matrix_appservice_discord_database_port }}/{{ matrix_appservice_discord_database_name }}' # noqa var-naming # Tells whether the bot should make use of "Privileged Gateway Intents". @@ -74,7 +74,7 @@ matrix_appservice_discord_database_connString: 'postgresql://{{ matrix_appservic # by triggering all Intent checkboxes on a page like this: `https://discord.com/developers/applications/694448564151123988/bot` # # Learn more: https://gist.github.com/advaith1/e69bcc1cdd6d0087322734451f15aa2f -matrix_appservice_discord_auth_usePrivilegedIntents: false +matrix_appservice_discord_auth_usePrivilegedIntents: false # noqa var-naming matrix_appservice_discord_configuration_yaml: "{{ lookup('template', 'templates/config.yaml.j2') }}" diff --git a/roles/matrix-bridge-appservice-irc/defaults/main.yml b/roles/matrix-bridge-appservice-irc/defaults/main.yml index aaee2b48..93a8e084 100644 --- a/roles/matrix-bridge-appservice-irc/defaults/main.yml +++ b/roles/matrix-bridge-appservice-irc/defaults/main.yml @@ -23,7 +23,7 @@ matrix_appservice_irc_data_path: "{{ matrix_appservice_irc_base_path }}/data" matrix_appservice_irc_homeserver_url: "{{ matrix_homeserver_container_url }}" matrix_appservice_irc_homeserver_media_url: 'https://{{ matrix_server_fqn_matrix }}' matrix_appservice_irc_homeserver_domain: '{{ matrix_domain }}' -matrix_appservice_irc_homeserver_enablePresence: true +matrix_appservice_irc_homeserver_enablePresence: true # noqa var-naming matrix_appservice_irc_appservice_address: 'http://matrix-appservice-irc:9999' matrix_appservice_irc_database_engine: nedb @@ -38,14 +38,15 @@ matrix_appservice_irc_database_name: matrix_appservice_irc matrix_appservice_irc_database_connection_string: 'postgresql://{{ matrix_appservice_irc_database_username }}:{{ matrix_appservice_irc_database_password }}@{{ matrix_appservice_irc_database_hostname }}:{{ matrix_appservice_irc_database_port }}/{{ matrix_appservice_irc_database_name }}?sslmode=disable' # This is what actually goes into `database.connectionString` for the bridge. -matrix_appservice_irc_database_connectionString: "{{ - { - 'nedb': 'nedb:///data', - 'postgres': matrix_appservice_irc_database_connection_string, - }[matrix_appservice_irc_database_engine] -}}" - -matrix_appservice_irc_ircService_servers: [] +matrix_appservice_irc_database_connectionString: |- # noqa var-naming + {{ + { + 'nedb': 'nedb:///data', + 'postgres': matrix_appservice_irc_database_connection_string, + }[matrix_appservice_irc_database_engine] + }} + +matrix_appservice_irc_ircService_servers: [] # noqa var-naming # Example of `matrix_appservice_irc_ircService_servers` with one server (and all its options): # diff --git a/roles/matrix-bridge-appservice-slack/defaults/main.yml b/roles/matrix-bridge-appservice-slack/defaults/main.yml index 6e5285cf..71fca8e6 100644 --- a/roles/matrix-bridge-appservice-slack/defaults/main.yml +++ b/roles/matrix-bridge-appservice-slack/defaults/main.yml @@ -67,12 +67,13 @@ matrix_appservice_slack_database_name: matrix_appservice_slack matrix_appservice_slack_database_connection_string: 'postgresql://{{ matrix_appservice_slack_database_username }}:{{ matrix_appservice_slack_database_password }}@{{ matrix_appservice_slack_database_hostname }}:{{ matrix_appservice_slack_database_port }}/{{ matrix_appservice_slack_database_name }}?sslmode=disable' # This is what actually goes into `database.connectionString` for the bridge. -matrix_appservice_slack_database_connectionString: "{{ - { - 'nedb': 'nedb:///data', - 'postgres': matrix_appservice_slack_database_connection_string, - }[matrix_appservice_slack_database_engine] -}}" +matrix_appservice_slack_database_connectionString: |- # noqa var-naming + {{ + { + 'nedb': 'nedb:///data', + 'postgres': matrix_appservice_slack_database_connection_string, + }[matrix_appservice_slack_database_engine] + }} matrix_appservice_slack_configuration_yaml: "{{ lookup('template', 'templates/config.yaml.j2') }}" diff --git a/roles/matrix-bridge-hookshot/defaults/main.yml b/roles/matrix-bridge-hookshot/defaults/main.yml index 6ca33b8a..62f797d0 100644 --- a/roles/matrix-bridge-hookshot/defaults/main.yml +++ b/roles/matrix-bridge-hookshot/defaults/main.yml @@ -72,7 +72,7 @@ matrix_hookshot_github_oauth_uri: "{{ matrix_hookshot_urlprefix }}{{ matrix_hook # These are the default settings mentioned here and don't need to be modified: https://matrix-org.github.io/matrix-hookshot/usage/room_configuration/github_repo.html#configuration matrix_hookshot_github_ignore_hooks: "{}" matrix_hookshot_github_command_prefix: '!gh' -matrix_hookshot_github_showIssueRoomLink: false +matrix_hookshot_github_showIssueRoomLink: false # noqa var-naming matrix_hookshot_github_pr_diff: "{enabled: false, maxLines: 5}" matrix_hookshot_github_including_labels: '' matrix_hookshot_github_excluding_labels: '' @@ -97,7 +97,7 @@ matrix_hookshot_gitlab_secret: '' matrix_hookshot_figma_enabled: false # Default value of matrix_hookshot_figma_endpoint: "/hookshot/webhooks/figma/webhook" matrix_hookshot_figma_endpoint: "{{ matrix_hookshot_webhook_endpoint }}/figma/webhook" -matrix_hookshot_figma_publicUrl: "{{ matrix_hookshot_urlprefix }}{{ matrix_hookshot_figma_endpoint }}" +matrix_hookshot_figma_publicUrl: "{{ matrix_hookshot_urlprefix }}{{ matrix_hookshot_figma_endpoint }}" # noqa var-naming # To bridge figma webhooks, you need to configure one of multiple instances like this: # matrix_hookshot_figma_instances: # your-instance: @@ -144,9 +144,9 @@ matrix_hookshot_provisioning_endpoint: "{{ matrix_hookshot_public_endpoint }}{{ matrix_hookshot_widgets_enabled: true matrix_hookshot_widgets_port: 9003 -matrix_hookshot_widgets_addToAdminRooms: false # default off as it is a beta feature -matrix_hookshot_widgets_roomSetupWidget_enabled: true -matrix_hookshot_widgets_roomSetupWidget_addOnInvite: false +matrix_hookshot_widgets_addToAdminRooms: false # default off as it is a beta feature # noqa var-naming +matrix_hookshot_widgets_roomSetupWidget_enabled: true # noqa var-naming +matrix_hookshot_widgets_roomSetupWidget_addOnInvite: false # noqa var-naming # `disallowedIpRanges` describes which IP ranges should be disallowed when resolving homeserver IP addresses (for security reasons). Unless you know what you are doing, it is recommended to not include this key. The following IPs are blocked by default, unless you supply another list. # matrix_hookshot_widgets_disallowedIpRanges: # - 127.0.0.0/8 @@ -168,12 +168,12 @@ matrix_hookshot_widgets_roomSetupWidget_addOnInvite: false # - 2001:db8::/32 # - ff00::/8 # - fec0::/10 -matrix_hookshot_widgets_disallowedIpRanges: '' +matrix_hookshot_widgets_disallowedIpRanges: '' # noqa var-naming matrix_hookshot_widgets_internal: "/widgetapi" # Default value of matrix_hookshot_widgets_endpoint: "/hookshot/widgetapi" matrix_hookshot_widgets_endpoint: "{{ matrix_hookshot_public_endpoint }}{{ matrix_hookshot_widgets_internal }}" -matrix_hookshot_widgets_publicUrl: "{{ matrix_hookshot_urlprefix }}{{ matrix_hookshot_widgets_endpoint }}/v1/static" -matrix_hookshot_widgets_branding_widgetTitle: "Hookshot Configuration" +matrix_hookshot_widgets_publicUrl: "{{ matrix_hookshot_urlprefix }}{{ matrix_hookshot_widgets_endpoint }}/v1/static" # noqa var-naming +matrix_hookshot_widgets_branding_widgetTitle: "Hookshot Configuration" # noqa var-naming # You can configure access to the bridge as documented here https://matrix-org.github.io/matrix-hookshot/setup.html#permissions diff --git a/roles/matrix-bridge-mx-puppet-discord/defaults/main.yml b/roles/matrix-bridge-mx-puppet-discord/defaults/main.yml index 085a19aa..771af992 100644 --- a/roles/matrix-bridge-mx-puppet-discord/defaults/main.yml +++ b/roles/matrix-bridge-mx-puppet-discord/defaults/main.yml @@ -30,7 +30,7 @@ matrix_mx_puppet_discord_homeserver_address: "{{ matrix_homeserver_container_url matrix_mx_puppet_discord_homeserver_domain: '{{ matrix_domain }}' matrix_mx_puppet_discord_appservice_address: 'http://matrix-mx-puppet-discord:{{ matrix_mx_puppet_discord_appservice_port }}' -matrix_mx_puppet_discord_bridge_mediaUrl: "https://{{ matrix_server_fqn_matrix }}" +matrix_mx_puppet_discord_bridge_mediaUrl: "https://{{ matrix_server_fqn_matrix }}" # noqa var-naming # "@user:server.com" to allow specific user # "@.*:yourserver.com" to allow users on a specific homeserver diff --git a/roles/matrix-client-element/defaults/main.yml b/roles/matrix-client-element/defaults/main.yml index 15218760..119f31a2 100644 --- a/roles/matrix-client-element/defaults/main.yml +++ b/roles/matrix-client-element/defaults/main.yml @@ -39,9 +39,9 @@ matrix_client_element_integrations_ui_url: "https://scalar.vector.im/" matrix_client_element_integrations_rest_url: "https://scalar.vector.im/api" matrix_client_element_integrations_widgets_urls: ["https://scalar.vector.im/api"] matrix_client_element_integrations_jitsi_widget_url: "https://scalar.vector.im/api/widgets/jitsi.html" -matrix_client_element_permalinkPrefix: "https://matrix.to" +matrix_client_element_permalinkPrefix: "https://matrix.to" # noqa var-naming matrix_client_element_bug_report_endpoint_url: "https://element.io/bugreports/submit" -matrix_client_element_showLabsSettings: true +matrix_client_element_showLabsSettings: true # noqa var-naming # Element public room directory server(s) matrix_client_element_roomdir_servers: ['matrix.org'] matrix_client_element_welcome_user_id: ~ @@ -59,13 +59,13 @@ matrix_client_element_welcome_text: "_t('Decentralised, encrypted chat & col # Links, shown in footer of welcome page: # [{"text": "Link text", "url": "https://link.target"}, {"text": "Other link"}] -matrix_client_element_branding_authFooterLinks: ~ +matrix_client_element_branding_authFooterLinks: ~ # noqa var-naming # URL to image, shown during Login -matrix_client_element_branding_authHeaderLogoUrl: "{{ matrix_client_element_welcome_logo }}" +matrix_client_element_branding_authHeaderLogoUrl: "{{ matrix_client_element_welcome_logo }}" # noqa var-naming # URL to Wallpaper, shown in background of welcome page -matrix_client_element_branding_welcomeBackgroundUrl: ~ +matrix_client_element_branding_welcomeBackgroundUrl: ~ # noqa var-naming matrix_client_element_page_template_welcome_path: "{{ role_path }}/templates/welcome.html.j2" @@ -73,7 +73,7 @@ matrix_client_element_page_template_welcome_path: "{{ role_path }}/templates/wel # point this to a `home.html` template file on your local filesystem. matrix_client_element_embedded_pages_home_path: ~ -matrix_client_element_jitsi_preferredDomain: '' +matrix_client_element_jitsi_preferredDomain: '' # noqa var-naming # Controls whether the self-check feature should validate SSL certificates. matrix_client_element_self_check_validate_certificates: true @@ -101,7 +101,7 @@ matrix_client_element_default_theme: 'light' # If you define your own themes here and set `matrix_client_element_themes_enabled: true`, your themes will be preserved as well. # # Note that for a custom theme to work well, all Element instances that you use must have the same theme installed. -matrix_client_element_settingDefaults_custom_themes: [] +matrix_client_element_settingDefaults_custom_themes: [] # noqa var-naming # Default Element configuration template which covers the generic use case. # You can customize it by controlling the various variables inside it. diff --git a/roles/matrix-client-element/tasks/prepare_themes.yml b/roles/matrix-client-element/tasks/prepare_themes.yml index c8ab9388..8185122c 100644 --- a/roles/matrix-client-element/tasks/prepare_themes.yml +++ b/roles/matrix-client-element/tasks/prepare_themes.yml @@ -26,7 +26,7 @@ - name: Load Element theme ansible.builtin.set_fact: - matrix_client_element_settingDefaults_custom_themes: "{{ matrix_client_element_settingDefaults_custom_themes + [item['content'] | b64decode | from_json] }}" + matrix_client_element_settingDefaults_custom_themes: "{{ matrix_client_element_settingDefaults_custom_themes + [item['content'] | b64decode | from_json] }}" # noqa var-naming with_items: "{{ matrix_client_element_theme_file_contents.results }}" run_once: true diff --git a/roles/matrix-dimension/defaults/main.yml b/roles/matrix-dimension/defaults/main.yml index a330accb..ea1dde10 100644 --- a/roles/matrix-dimension/defaults/main.yml +++ b/roles/matrix-dimension/defaults/main.yml @@ -48,7 +48,7 @@ matrix_dimension_integrations_rest_url: "https://{{ matrix_server_fqn_dimension matrix_dimension_integrations_widgets_urls: ["https://{{ matrix_server_fqn_dimension }}/widgets"] matrix_dimension_integrations_jitsi_widget_url: "https://{{ matrix_server_fqn_dimension }}/widgets/jitsi" -matrix_dimension_homeserver_federationUrl: "" +matrix_dimension_homeserver_federationUrl: "" # noqa var-naming # Database-related configuration fields. diff --git a/roles/matrix-jitsi/defaults/main.yml b/roles/matrix-jitsi/defaults/main.yml index ef6a5735..5546d19c 100644 --- a/roles/matrix-jitsi/defaults/main.yml +++ b/roles/matrix-jitsi/defaults/main.yml @@ -132,7 +132,7 @@ matrix_jitsi_web_config_start_audio_muted_after_nth_participant: ~ # Controls after which participant video will be muted. If not specified, defaults to Jitsi's default value (likely 10) matrix_jitsi_web_config_start_video_muted_after_nth_participant: ~ -matrix_jitsi_web_config_defaultLanguage: 'en' +matrix_jitsi_web_config_defaultLanguage: 'en' # noqa var-naming # Ideal and also maximum resolution width. If not specified, defaults to Jitsi's default value (likely 1280) matrix_jitsi_web_config_resolution_width_ideal_and_max: ~ diff --git a/roles/matrix-ma1sd/defaults/main.yml b/roles/matrix-ma1sd/defaults/main.yml index 65768265..3755a46a 100644 --- a/roles/matrix-ma1sd/defaults/main.yml +++ b/roles/matrix-ma1sd/defaults/main.yml @@ -93,9 +93,9 @@ matrix_ma1sd_dns_overwrite_homeserver_client_value: "" # https://github.com/ma1uta/ma1sd/blob/master/docs/threepids/session/session-views.md matrix_ma1sd_view_session_custom_templates_enabled: false # Defaults to: https://github.com/ma1uta/ma1sd/blob/master/src/main/resources/templates/session/tokenSubmitSuccess.html -matrix_ma1sd_view_session_custom_onTokenSubmit_success_template: "" +matrix_ma1sd_view_session_custom_onTokenSubmit_success_template: "" # noqa var-naming # Defaults to: https://github.com/ma1uta/ma1sd/blob/master/src/main/resources/templates/session/tokenSubmitFailure.html -matrix_ma1sd_view_session_custom_onTokenSubmit_failure_template: "" +matrix_ma1sd_view_session_custom_onTokenSubmit_failure_template: "" # noqa var-naming # Override the default email templates # To use this, fill in the template variables with the full desired template as a multi-line YAML variable From 8ad1fa085e205b3aefbe4efc10428093a0bf0144 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Mon, 18 Jul 2022 16:48:25 +0300 Subject: [PATCH 15/16] Use full path when importing SSL setup tasks This is an attempt to make ansible-lint happy. --- roles/matrix-nginx-proxy/tasks/ssl/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/matrix-nginx-proxy/tasks/ssl/main.yml b/roles/matrix-nginx-proxy/tasks/ssl/main.yml index 0fa735b4..e9d270cf 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 -- ansible.builtin.import_tasks: tasks/ssl/setup_ssl_lets_encrypt.yml +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ssl/setup_ssl_lets_encrypt.yml" -- ansible.builtin.import_tasks: tasks/ssl/setup_ssl_self_signed.yml +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ssl/setup_ssl_self_signed.yml" -- ansible.builtin.import_tasks: tasks/ssl/setup_ssl_manually_managed.yml +- ansible.builtin.import_tasks: "{{ role_path }}/tasks/ssl/setup_ssl_manually_managed.yml" From 2dc418a416abe9e4792657ff65ab21a0245a030e Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Mon, 18 Jul 2022 16:51:33 +0300 Subject: [PATCH 16/16] Add Makefile and lint target --- Makefile | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..f0aeb397 --- /dev/null +++ b/Makefile @@ -0,0 +1,7 @@ +.PHONY: lint + +help: ## Show this help. + @fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' + +lint: ## Runs ansible-lint against all roles in the playbook + ansible-lint