diff --git a/roles/cache_clear/cache_clear-drupal8/tasks/main.yml b/roles/cache_clear/cache_clear-drupal8/tasks/main.yml index 1fc9d2f2..c95c0087 100644 --- a/roles/cache_clear/cache_clear-drupal8/tasks/main.yml +++ b/roles/cache_clear/cache_clear-drupal8/tasks/main.yml @@ -4,9 +4,30 @@ - name: Override path to drush binary. set_fact: drush_bin: "{{ drush_live_bin }}" + - name: Override deploy_path. set_fact: deploy_path: "{{ live_symlink_dest }}" + + - name: Truncate table cache_container. + ansible.builtin.command: + cmd: "{{ drush_bin }} sql-query 'TRUNCATE TABLE cache_container'" + 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 }}" + loop_control: + loop_var: site_drupal + run_once: true + register: _drush_output + when: + - drupal.truncate_cache_container_table is defined + - drupal.truncate_cache_container_table + + - name: Show drush output. + ansible.builtin.debug: + msg: "{{ _drush_output }}" + when: drupal.drush_verbose_output when: - deploy_code.mount_type is defined - deploy_code.mount_type == "squashfs"