From 2e1bbea8d5cfc92d9a621f3ca4e22efdfd5f7ea5 Mon Sep 17 00:00:00 2001 From: Emlyn Kinzett Date: Mon, 27 Jun 2022 11:57:34 +0100 Subject: [PATCH 1/3] Use a different variable for config imports during a sync so they can be optional. --- .../database_apply/database_apply-drupal8/tasks/main.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/roles/sync/drupal_sync_tasks/database_apply/database_apply-drupal8/tasks/main.yml b/roles/sync/drupal_sync_tasks/database_apply/database_apply-drupal8/tasks/main.yml index bb9cc73c..22935eeb 100644 --- a/roles/sync/drupal_sync_tasks/database_apply/database_apply-drupal8/tasks/main.yml +++ b/roles/sync/drupal_sync_tasks/database_apply/database_apply-drupal8/tasks/main.yml @@ -11,7 +11,7 @@ - name: Import configuration. ansible.builtin.command: - cmd: "{{ drush_bin }} -l {{ site.folder }} -y {{ site.config_import_command }}" + cmd: "{{ drush_bin }} -l {{ site.folder }} -y {{ site.sync_config_import_command }}" chdir: "{{ live_symlink_dest }}/{{ webroot }}/sites/{{ site.folder }}" become: "{{ 'no' if www_user == deploy_user else 'yes' }}" become_user: "{{ www_user }}" @@ -19,7 +19,8 @@ loop_control: loop_var: site when: - - site.config_import_command + - site.sync_config_import_command is defined + - site.sync_config_import_command - name: Clear the cache. ansible.builtin.include_role: From 07d0cb8145800c737d88fad5e2de7f899aab08ec Mon Sep 17 00:00:00 2001 From: Emlyn Kinzett Date: Mon, 27 Jun 2022 12:08:33 +0100 Subject: [PATCH 2/3] Actually, no. Use a variable to determine if config should be imported during a sync. --- .../database_apply/database_apply-drupal8/tasks/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/sync/drupal_sync_tasks/database_apply/database_apply-drupal8/tasks/main.yml b/roles/sync/drupal_sync_tasks/database_apply/database_apply-drupal8/tasks/main.yml index 22935eeb..203d4ba5 100644 --- a/roles/sync/drupal_sync_tasks/database_apply/database_apply-drupal8/tasks/main.yml +++ b/roles/sync/drupal_sync_tasks/database_apply/database_apply-drupal8/tasks/main.yml @@ -11,7 +11,7 @@ - name: Import configuration. ansible.builtin.command: - cmd: "{{ drush_bin }} -l {{ site.folder }} -y {{ site.sync_config_import_command }}" + cmd: "{{ drush_bin }} -l {{ site.folder }} -y {{ site.config_import_command }}" chdir: "{{ live_symlink_dest }}/{{ webroot }}/sites/{{ site.folder }}" become: "{{ 'no' if www_user == deploy_user else 'yes' }}" become_user: "{{ www_user }}" @@ -19,8 +19,8 @@ loop_control: loop_var: site when: - - site.sync_config_import_command is defined - - site.sync_config_import_command + - site.config_import_command + - site.sync_config_import is not defined or not site.sync_config_import - name: Clear the cache. ansible.builtin.include_role: From 6b480987e1d95833037bf6fc4739524e484e0fb5 Mon Sep 17 00:00:00 2001 From: Emlyn Kinzett Date: Mon, 27 Jun 2022 12:21:39 +0100 Subject: [PATCH 3/3] Fix some logic with config import during syncs and add a comment to explain when the task runs. --- .../database_apply/database_apply-drupal8/tasks/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/sync/drupal_sync_tasks/database_apply/database_apply-drupal8/tasks/main.yml b/roles/sync/drupal_sync_tasks/database_apply/database_apply-drupal8/tasks/main.yml index 203d4ba5..e050af3f 100644 --- a/roles/sync/drupal_sync_tasks/database_apply/database_apply-drupal8/tasks/main.yml +++ b/roles/sync/drupal_sync_tasks/database_apply/database_apply-drupal8/tasks/main.yml @@ -9,6 +9,7 @@ loop_control: loop_var: site +# This only runs if the sync_config_import variable is not defined or it is defined and is true. If it's defined and false, this won't run. - name: Import configuration. ansible.builtin.command: cmd: "{{ drush_bin }} -l {{ site.folder }} -y {{ site.config_import_command }}" @@ -20,7 +21,7 @@ loop_var: site when: - site.config_import_command - - site.sync_config_import is not defined or not site.sync_config_import + - site.sync_config_import is not defined or site.sync_config_import - name: Clear the cache. ansible.builtin.include_role: