From 67e2bf285d44c0cb392ba1e28e615053b748c03c Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Tue, 30 Oct 2018 20:43:28 +0000 Subject: [PATCH] A simple idea to allow playbooks to control which bit of the role to run --- roles/matrix-server/defaults/main.yml | 9 ++++++ roles/matrix-server/tasks/main.yml | 41 ++++++++++++++---------- roles/matrix-server/tasks/setup/main.yml | 10 +++--- 3 files changed, 38 insertions(+), 22 deletions(-) diff --git a/roles/matrix-server/defaults/main.yml b/roles/matrix-server/defaults/main.yml index a45d6b95..3c0a2d2c 100644 --- a/roles/matrix-server/defaults/main.yml +++ b/roles/matrix-server/defaults/main.yml @@ -284,3 +284,12 @@ matrix_ssl_use_staging: false # Specifies when to attempt to retrieve new SSL certificates from Let's Encrypt. matrix_ssl_renew_cron_time_definition: "15 4 */5 * *" + +# Variables to Control which parts of the role run. +run_setup: true +run_upgrade_postgres: true +run_start: true +run_register_user: true +run_import_sqlite_db: true +run_import_media_store: true +run_self_check: true diff --git a/roles/matrix-server/tasks/main.yml b/roles/matrix-server/tasks/main.yml index 7b6d5d3b..c76c2070 100644 --- a/roles/matrix-server/tasks/main.yml +++ b/roles/matrix-server/tasks/main.yml @@ -1,29 +1,36 @@ --- - include: tasks/setup/main.yml + when: run_setup -# - include: tasks/upgrade_postgres.yml -# tags: -# - upgrade-postgres +- include: tasks/upgrade_postgres.yml + tags: + - upgrade-postgres + when: run_upgrade_postgres - include: tasks/start.yml tags: - start + when: run_start -# - include: tasks/register_user.yml -# tags: -# - register-user +- include: tasks/register_user.yml + tags: + - register-user + when: run_register_user -# - include: tasks/import_sqlite_db.yml -# tags: -# - import-sqlite-db +- include: tasks/import_sqlite_db.yml + tags: + - import-sqlite-db + when: run_import_sqlite_db -# - include: tasks/import_media_store.yml -# tags: -# - import-media-store +- include: tasks/import_media_store.yml + tags: + - import-media-store + when: run_import_media_store -# - include: tasks/self_check/main.yml -# delegate_to: 127.0.0.1 -# become: false -# tags: -# - self-check +- include: tasks/self_check/main.yml + delegate_to: 127.0.0.1 + become: false + tags: + - self-check + when: run_self_check diff --git a/roles/matrix-server/tasks/setup/main.yml b/roles/matrix-server/tasks/setup/main.yml index 55d77476..ac6cb782 100644 --- a/roles/matrix-server/tasks/setup/main.yml +++ b/roles/matrix-server/tasks/setup/main.yml @@ -8,10 +8,10 @@ tags: - setup-all -# - include: tasks/setup/setup_ssl.yml -# tags: -# - setup-all -# - setup-ssl +- include: tasks/setup/setup_ssl.yml + tags: + - setup-all + - setup-ssl - include: tasks/setup/setup_postgres.yml tags: @@ -70,4 +70,4 @@ tags: - setup-all - setup-nginx-proxy - - setup-well-known + - setup-well-known \ No newline at end of file