diff --git a/roles/_init/tasks/main.yml b/roles/_init/tasks/main.yml index 21b48dc3..225e9b60 100644 --- a/roles/_init/tasks/main.yml +++ b/roles/_init/tasks/main.yml @@ -71,18 +71,6 @@ - deploy_code.mount_type is defined - deploy_code.mount_type == "squashfs" -- name: Define path to clear cache for the deploy step. - ansible.builtin.set_fact: - cache_clear_base_path: "{{ deploy_path }}" - when: - - deploy_operation != 'cleanup' - -- name: Define path to clear cache for the cleanup step. - ansible.builtin.set_fact: - cache_clear_base_path: "{{ cache_clear_base_path | default('{{ deploy_path_prefix }}{{ build_number }}') }}" - when: - - deploy_operation == 'cleanup' - # Gather last known good build directly from symlink. # This can happen: # - when the first builds failed, diff --git a/roles/cache_clear/cache_clear-drupal8/tasks/main.yml b/roles/cache_clear/cache_clear-drupal8/tasks/main.yml index a4a4203a..1fc9d2f2 100644 --- a/roles/cache_clear/cache_clear-drupal8/tasks/main.yml +++ b/roles/cache_clear/cache_clear-drupal8/tasks/main.yml @@ -1,14 +1,21 @@ --- -- name: Override path to drush_bin on the cleanup step. - set_fact: - drush_bin: "{{ drush_live_bin }}" +- name: Override paths for squashfs build cleanup step. + block: + - name: Override path to drush binary. + set_fact: + drush_bin: "{{ drush_live_bin }}" + - name: Override deploy_path. + set_fact: + deploy_path: "{{ live_symlink_dest }}" when: + - deploy_code.mount_type is defined + - deploy_code.mount_type == "squashfs" - deploy_operation == 'cleanup' - name: Clear Drupal cache. ansible.builtin.command: cmd: "{{ drush_bin }} -l {{ site_drupal.folder }} -y cr" - chdir: "{{ cache_clear_base_path }}/{{ webroot }}/sites/{{ site_drupal.folder }}" + chdir: "{{ deploy_path }}/{{ webroot }}/sites/{{ site_drupal.folder }}" become: "{{ 'no' if www_user == deploy_user else 'yes' }}" become_user: "{{ www_user }}" with_items: "{{ drupal.sites }}"