From 99af4543ac4587aeeb7d43e9b7ada035b6da5b5b Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Thu, 3 Jan 2019 15:24:08 +0200 Subject: [PATCH] Replace include usage with include_tasks and import_tasks The long-deprecated (since Ansible 2.4) use of include is no more. --- .../tasks/import/import_postgres.yml | 2 +- roles/matrix-server/tasks/main.yml | 16 +++++----- roles/matrix-server/tasks/self_check/main.yml | 14 ++++----- roles/matrix-server/tasks/setup/main.yml | 30 +++++++++---------- .../tasks/setup/setup_postgres.yml | 2 +- roles/matrix-server/tasks/setup/ssl/main.yml | 6 ++-- .../setup/ssl/setup_ssl_lets_encrypt.yml | 2 +- .../setup/ssl/setup_ssl_manually_managed.yml | 2 +- .../tasks/setup/ssl/setup_ssl_self_signed.yml | 2 +- .../tasks/setup/synapse/ext/main.yml | 10 +++---- .../tasks/setup/synapse/main.yml | 6 ++-- .../matrix-server/tasks/upgrade_postgres.yml | 4 +-- 12 files changed, 48 insertions(+), 48 deletions(-) diff --git a/roles/matrix-server/tasks/import/import_postgres.yml b/roles/matrix-server/tasks/import/import_postgres.yml index a96a7369..a8a426ff 100644 --- a/roles/matrix-server/tasks/import/import_postgres.yml +++ b/roles/matrix-server/tasks/import/import_postgres.yml @@ -14,7 +14,7 @@ fail: msg="File cannot be found on the server at {{ server_path_postgres_dump }}" when: not result_server_path_postgres_dump_stat.stat.exists -- include: tasks/util/detect_existing_postgres_version.yml +- import_tasks: tasks/util/detect_existing_postgres_version.yml - name: Abort, if no existing Postgres version detected fail: msg="Could not find existing Postgres installation" diff --git a/roles/matrix-server/tasks/main.yml b/roles/matrix-server/tasks/main.yml index 896efe82..a6ba542b 100644 --- a/roles/matrix-server/tasks/main.yml +++ b/roles/matrix-server/tasks/main.yml @@ -1,39 +1,39 @@ --- -- include: tasks/setup/main.yml +- import_tasks: tasks/setup/main.yml when: run_setup -- include: tasks/import/import_postgres.yml +- import_tasks: tasks/import/import_postgres.yml tags: - import-postgres when: run_import_postgres -- include: tasks/upgrade_postgres.yml +- import_tasks: tasks/upgrade_postgres.yml tags: - upgrade-postgres when: run_upgrade_postgres -- include: tasks/start.yml +- import_tasks: tasks/start.yml tags: - start when: run_start -- include: tasks/register_user.yml +- import_tasks: tasks/register_user.yml tags: - register-user when: run_register_user -- include: tasks/import/import_sqlite_db.yml +- import_tasks: tasks/import/import_sqlite_db.yml tags: - import-sqlite-db when: run_import_sqlite_db -- include: tasks/import/import_media_store.yml +- import_tasks: tasks/import/import_media_store.yml tags: - import-media-store when: run_import_media_store -- include: tasks/self_check/main.yml +- import_tasks: tasks/self_check/main.yml delegate_to: 127.0.0.1 become: false tags: diff --git a/roles/matrix-server/tasks/self_check/main.yml b/roles/matrix-server/tasks/self_check/main.yml index 001303bb..fdd73dd6 100644 --- a/roles/matrix-server/tasks/self_check/main.yml +++ b/roles/matrix-server/tasks/self_check/main.yml @@ -1,18 +1,18 @@ --- -- include: tasks/self_check/self_check_dns.yml +- import_tasks: tasks/self_check/self_check_dns.yml -- include: tasks/self_check/self_check_client_api.yml +- import_tasks: tasks/self_check/self_check_client_api.yml -- include: tasks/self_check/self_check_federation_api.yml +- import_tasks: tasks/self_check/self_check_federation_api.yml -- include: tasks/self_check/self_check_riot_web.yml +- import_tasks: tasks/self_check/self_check_riot_web.yml when: "matrix_riot_web_enabled" -- include: tasks/self_check/self_check_mxisd.yml +- import_tasks: tasks/self_check/self_check_mxisd.yml when: "matrix_mxisd_enabled" -- include: tasks/self_check/self_check_well_known.yml +- import_tasks: tasks/self_check/self_check_well_known.yml -- include: tasks/self_check/self_check_corporal.yml +- import_tasks: tasks/self_check/self_check_corporal.yml when: "matrix_corporal_enabled" \ No newline at end of file diff --git a/roles/matrix-server/tasks/setup/main.yml b/roles/matrix-server/tasks/setup/main.yml index 92b5b5ff..34876faa 100644 --- a/roles/matrix-server/tasks/setup/main.yml +++ b/roles/matrix-server/tasks/setup/main.yml @@ -1,68 +1,68 @@ --- -- include: tasks/setup/setup_sanity_check.yml +- import_tasks: tasks/setup/setup_sanity_check.yml tags: - always -- include: tasks/setup/setup_base.yml +- import_tasks: tasks/setup/setup_base.yml tags: - setup-all -- include: tasks/setup/setup_main.yml +- import_tasks: tasks/setup/setup_main.yml tags: - setup-all -- include: tasks/setup/ssl/main.yml +- import_tasks: tasks/setup/ssl/main.yml tags: - setup-all - setup-ssl -- include: tasks/setup/setup_postgres.yml +- import_tasks: tasks/setup/setup_postgres.yml tags: - setup-all - setup-postgres -- include: tasks/setup/setup_goofys.yml +- import_tasks: tasks/setup/setup_goofys.yml tags: - setup-all - setup-goofys -- include: tasks/setup/setup_coturn.yml +- import_tasks: tasks/setup/setup_coturn.yml tags: - setup-all - setup-coturn -- include: tasks/setup/setup_mailer.yml +- import_tasks: tasks/setup/setup_mailer.yml tags: - setup-all - setup-mailer -- include: tasks/setup/setup_mxisd.yml +- import_tasks: tasks/setup/setup_mxisd.yml tags: - setup-all - setup-mxisd -- include: tasks/setup/setup_corporal_overrides.yml +- import_tasks: tasks/setup/setup_corporal_overrides.yml tags: - always -- include: tasks/setup/setup_corporal.yml +- import_tasks: tasks/setup/setup_corporal.yml tags: - setup-all - setup-corporal -- include: tasks/setup/synapse/main.yml +- import_tasks: tasks/setup/synapse/main.yml tags: - setup-all - setup-synapse - setup-coturn -- include: tasks/setup/setup_riot_web.yml +- import_tasks: tasks/setup/setup_riot_web.yml tags: - setup-all - setup-riot-web -- include: tasks/setup/setup_well_known.yml +- import_tasks: tasks/setup/setup_well_known.yml tags: - setup-all - setup-mxisd @@ -70,7 +70,7 @@ - setup-nginx-proxy - setup-well-known -- include: tasks/setup/setup_nginx_proxy.yml +- import_tasks: tasks/setup/setup_nginx_proxy.yml tags: - setup-all - setup-nginx-proxy diff --git a/roles/matrix-server/tasks/setup/setup_postgres.yml b/roles/matrix-server/tasks/setup/setup_postgres.yml index 53491b55..aaadec90 100644 --- a/roles/matrix-server/tasks/setup/setup_postgres.yml +++ b/roles/matrix-server/tasks/setup/setup_postgres.yml @@ -4,7 +4,7 @@ # Generic tasks, no matter what kind of server we're using (internal/external) # -- include: tasks/util/detect_existing_postgres_version.yml +- import_tasks: tasks/util/detect_existing_postgres_version.yml # If we have found an existing version (installed from before), we use its corresponding Docker image. # If not, we install using the latest Postgres. diff --git a/roles/matrix-server/tasks/setup/ssl/main.yml b/roles/matrix-server/tasks/setup/ssl/main.yml index d8593d78..d81c8f34 100644 --- a/roles/matrix-server/tasks/setup/ssl/main.yml +++ b/roles/matrix-server/tasks/setup/ssl/main.yml @@ -31,8 +31,8 @@ # Method specific tasks follow -- include: tasks/setup/ssl/setup_ssl_lets_encrypt.yml +- import_tasks: tasks/setup/ssl/setup_ssl_lets_encrypt.yml -- include: tasks/setup/ssl/setup_ssl_self_signed.yml +- import_tasks: tasks/setup/ssl/setup_ssl_self_signed.yml -- include: tasks/setup/ssl/setup_ssl_manually_managed.yml +- import_tasks: tasks/setup/ssl/setup_ssl_manually_managed.yml diff --git a/roles/matrix-server/tasks/setup/ssl/setup_ssl_lets_encrypt.yml b/roles/matrix-server/tasks/setup/ssl/setup_ssl_lets_encrypt.yml index 205e648c..0063242b 100644 --- a/roles/matrix-server/tasks/setup/ssl/setup_ssl_lets_encrypt.yml +++ b/roles/matrix-server/tasks/setup/ssl/setup_ssl_lets_encrypt.yml @@ -26,7 +26,7 @@ when: "matrix_ssl_retrieval_method == 'lets-encrypt'" - name: Obtain Let's Encrypt certificates - include_tasks: "tasks/setup/ssl/setup_ssl_lets_encrypt_obtain_for_domain.yml" + include_tasks: "{{ role_path }}/tasks/setup/ssl/setup_ssl_lets_encrypt_obtain_for_domain.yml" with_items: "{{ domains_requiring_certificates }}" loop_control: loop_var: domain_name diff --git a/roles/matrix-server/tasks/setup/ssl/setup_ssl_manually_managed.yml b/roles/matrix-server/tasks/setup/ssl/setup_ssl_manually_managed.yml index 78766381..10cd0765 100644 --- a/roles/matrix-server/tasks/setup/ssl/setup_ssl_manually_managed.yml +++ b/roles/matrix-server/tasks/setup/ssl/setup_ssl_manually_managed.yml @@ -1,7 +1,7 @@ --- - name: Verify certificates - include_tasks: "tasks/setup/ssl/setup_ssl_manually_managed_verify_for_domain.yml" + include_tasks: "{{ role_path }}/tasks/setup/ssl/setup_ssl_manually_managed_verify_for_domain.yml" with_items: "{{ domains_requiring_certificates }}" loop_control: loop_var: domain_name diff --git a/roles/matrix-server/tasks/setup/ssl/setup_ssl_self_signed.yml b/roles/matrix-server/tasks/setup/ssl/setup_ssl_self_signed.yml index 8e97a612..69ca0659 100644 --- a/roles/matrix-server/tasks/setup/ssl/setup_ssl_self_signed.yml +++ b/roles/matrix-server/tasks/setup/ssl/setup_ssl_self_signed.yml @@ -17,7 +17,7 @@ when: "matrix_ssl_retrieval_method == 'self-signed' and ansible_os_family == 'Debian'" - name: Generate self-signed certificates - include_tasks: "tasks/setup/ssl/setup_ssl_self_signed_obtain_for_domain.yml" + include_tasks: "{{ role_path }}/tasks/setup/ssl/setup_ssl_self_signed_obtain_for_domain.yml" with_items: "{{ domains_requiring_certificates }}" loop_control: loop_var: domain_name diff --git a/roles/matrix-server/tasks/setup/synapse/ext/main.yml b/roles/matrix-server/tasks/setup/synapse/ext/main.yml index 507d4d72..a53cc9aa 100644 --- a/roles/matrix-server/tasks/setup/synapse/ext/main.yml +++ b/roles/matrix-server/tasks/setup/synapse/ext/main.yml @@ -1,11 +1,11 @@ --- -- include: tasks/setup/synapse/ext/setup_synapse_ext_rest_auth.yml +- import_tasks: tasks/setup/synapse/ext/setup_synapse_ext_rest_auth.yml -- include: tasks/setup/synapse/ext/setup_synapse_ext_shared_secret_auth.yml +- import_tasks: tasks/setup/synapse/ext/setup_synapse_ext_shared_secret_auth.yml -- include: tasks/setup/synapse/ext/setup_synapse_ext_ldap_auth.yml +- import_tasks: tasks/setup/synapse/ext/setup_synapse_ext_ldap_auth.yml -- include: tasks/setup/synapse/ext/setup_synapse_ext_mautrix_telegram.yml +- import_tasks: tasks/setup/synapse/ext/setup_synapse_ext_mautrix_telegram.yml -- include: tasks/setup/synapse/ext/setup_synapse_ext_mautrix_whatsapp.yml +- import_tasks: tasks/setup/synapse/ext/setup_synapse_ext_mautrix_whatsapp.yml diff --git a/roles/matrix-server/tasks/setup/synapse/main.yml b/roles/matrix-server/tasks/setup/synapse/main.yml index a2df4df4..86e7087c 100644 --- a/roles/matrix-server/tasks/setup/synapse/main.yml +++ b/roles/matrix-server/tasks/setup/synapse/main.yml @@ -1,7 +1,7 @@ --- -- include: tasks/setup/synapse/setup_synapse_pre.yml +- import_tasks: tasks/setup/synapse/setup_synapse_pre.yml -- include: tasks/setup/synapse/ext/main.yml +- import_tasks: tasks/setup/synapse/ext/main.yml -- include: tasks/setup/synapse/setup_synapse_main.yml +- import_tasks: tasks/setup/synapse/setup_synapse_main.yml diff --git a/roles/matrix-server/tasks/upgrade_postgres.yml b/roles/matrix-server/tasks/upgrade_postgres.yml index 7c60df3e..6572d1e3 100644 --- a/roles/matrix-server/tasks/upgrade_postgres.yml +++ b/roles/matrix-server/tasks/upgrade_postgres.yml @@ -35,7 +35,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" -- include: tasks/util/detect_existing_postgres_version.yml +- import_tasks: tasks/util/detect_existing_postgres_version.yml - name: Abort, if no existing Postgres version detected fail: msg="Could not find existing Postgres installation" @@ -77,7 +77,7 @@ - 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." -- include: tasks/setup/setup_postgres.yml +- import_tasks: tasks/setup/setup_postgres.yml - name: Ensure matrix-postgres autoruns and is restarted service: name=matrix-postgres enabled=yes state=restarted daemon_reload=yes