From e874475c32787def3d242e676ca78d06b2937dc0 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 17 Jun 2020 01:23:31 +0100 Subject: [PATCH] Ansible: Re-organise deployment steps --- tools/ansible/deploy/after-update-code.yml | 32 ++++++++++------------ tools/ansible/deploy/before-symlink.yml | 6 ++++ tools/ansible/vars/deploy_vars.yml | 1 + 3 files changed, 21 insertions(+), 18 deletions(-) create mode 100644 tools/ansible/deploy/before-symlink.yml diff --git a/tools/ansible/deploy/after-update-code.yml b/tools/ansible/deploy/after-update-code.yml index 69dcfdf..fb83f5a 100644 --- a/tools/ansible/deploy/after-update-code.yml +++ b/tools/ansible/deploy/after-update-code.yml @@ -9,26 +9,28 @@ include_role: name: opdavies.drupal_settings_files +- name: Clear Drush cache + command: > + {{ release_drush_path }} + cache-clear drush + chdir={{ release_web_path }} + changed_when: false + - name: Run database updates - command: '{{ release_drush_path }} updatedb -y' - args: - chdir: '{{ release_web_path }}' + command: > + {{ release_drush_path }} + updatedb -y + chdir={{ release_web_path }} register: update_database_result changed_when: "'No pending updates' not in update_database_result.stderr" - name: Import configuration - command: '{{ release_drush_path }} config-import -y' - args: - chdir: '{{ release_web_path }}' + command: > + {{ release_drush_path }} config-import -y + chdir={{ release_web_path }} register: config_import_result changed_when: "'There are no changes to import' not in config_import_result.stderr" -- name: Rebuild cache - command: '{{ release_drush_path }} cache-rebuild' - args: - chdir: '{{ release_web_path }}' - changed_when: false - - name: Generate front-end assets command: | {{ item.command }} @@ -51,9 +53,3 @@ with_items: - body-field-values.txt - node_modules - -- name: Rebuild cache again - command: '{{ release_drush_path }} cache-rebuild' - args: - chdir: '{{ release_web_path }}' - changed_when: false diff --git a/tools/ansible/deploy/before-symlink.yml b/tools/ansible/deploy/before-symlink.yml new file mode 100644 index 0000000..48fbdc3 --- /dev/null +++ b/tools/ansible/deploy/before-symlink.yml @@ -0,0 +1,6 @@ +--- +- name: Rebuild Drupal cache + command: > + {{ release_drush_path }} cache-rebuild + chdir={{ release_web_path }} + changed_when: false diff --git a/tools/ansible/vars/deploy_vars.yml b/tools/ansible/vars/deploy_vars.yml index 9bc1751..96f75b9 100644 --- a/tools/ansible/vars/deploy_vars.yml +++ b/tools/ansible/vars/deploy_vars.yml @@ -11,6 +11,7 @@ ansistrano_shared_paths: # Hooks ansistrano_after_symlink_shared_tasks_file: '{{ playbook_dir }}/deploy/after-symlink-shared.yml' ansistrano_after_update_code_tasks_file: '{{ playbook_dir }}/deploy/after-update-code.yml' +ansistrano_before_symlink_tasks_file: '{{ playbook_dir }}/deploy/before-symlink.yml' app_hash_salt: '{{ vault_app_hash_salt }}'