Ansible: Re-organise deployment steps

This commit is contained in:
Oliver Davies 2020-06-17 01:23:31 +01:00
parent b83baa4c26
commit e874475c32
3 changed files with 21 additions and 18 deletions

View file

@ -9,26 +9,28 @@
include_role: include_role:
name: opdavies.drupal_settings_files 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 - name: Run database updates
command: '{{ release_drush_path }} updatedb -y' command: >
args: {{ release_drush_path }}
chdir: '{{ release_web_path }}' updatedb -y
chdir={{ release_web_path }}
register: update_database_result register: update_database_result
changed_when: "'No pending updates' not in update_database_result.stderr" changed_when: "'No pending updates' not in update_database_result.stderr"
- name: Import configuration - name: Import configuration
command: '{{ release_drush_path }} config-import -y' command: >
args: {{ release_drush_path }} config-import -y
chdir: '{{ release_web_path }}' chdir={{ release_web_path }}
register: config_import_result register: config_import_result
changed_when: "'There are no changes to import' not in config_import_result.stderr" 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 - name: Generate front-end assets
command: | command: |
{{ item.command }} {{ item.command }}
@ -51,9 +53,3 @@
with_items: with_items:
- body-field-values.txt - body-field-values.txt
- node_modules - node_modules
- name: Rebuild cache again
command: '{{ release_drush_path }} cache-rebuild'
args:
chdir: '{{ release_web_path }}'
changed_when: false

View file

@ -0,0 +1,6 @@
---
- name: Rebuild Drupal cache
command: >
{{ release_drush_path }} cache-rebuild
chdir={{ release_web_path }}
changed_when: false

View file

@ -11,6 +11,7 @@ ansistrano_shared_paths:
# Hooks # Hooks
ansistrano_after_symlink_shared_tasks_file: '{{ playbook_dir }}/deploy/after-symlink-shared.yml' 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_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 }}' app_hash_salt: '{{ vault_app_hash_salt }}'