diff --git a/roles/_init/tasks/drupal7.yml b/roles/_init/tasks/drupal7.yml index 3053c5c4..f6919125 100644 --- a/roles/_init/tasks/drupal7.yml +++ b/roles/_init/tasks/drupal7.yml @@ -11,7 +11,7 @@ import_role: name: cli/drush -- name: Ensure we have a cachetool binary. +- name: Ensure we have a cachetool binary and configuration. ansible.builtin.import_role: name: cli/cachetool when: install_php_cachetool diff --git a/roles/_init/tasks/drupal8.yml b/roles/_init/tasks/drupal8.yml index c254ffd6..afd1217b 100644 --- a/roles/_init/tasks/drupal8.yml +++ b/roles/_init/tasks/drupal8.yml @@ -11,9 +11,7 @@ ansible.builtin.set_fact: drush_live_bin: "{{ drush_live_bin | default('{{ live_symlink_dest }}/vendor/bin/drush') }}" -- name: Ensure we have a cachetool binary. +- name: Ensure we have a cachetool binary and configuration. ansible.builtin.import_role: name: cli/cachetool - when: - - install_php_cachetool - - deploy_operation == 'deploy' + when: install_php_cachetool diff --git a/roles/cli/cachetool/tasks/main.yml b/roles/cli/cachetool/tasks/main.yml index e7035c7c..d3a21cb2 100644 --- a/roles/cli/cachetool/tasks/main.yml +++ b/roles/cli/cachetool/tasks/main.yml @@ -1,17 +1,16 @@ --- -- name: Remove previous cachetool if exists. - ansible.builtin.file: - path: "{{ cachetool_bin }}" - state: absent - when: - - deploy_operation == 'deploy' +- name: Initial housekeeping tasks. + when: deploy_operation == 'deploy' + block: + - name: Remove previous cachetool if exists. + ansible.builtin.file: + path: "{{ cachetool_bin }}" + state: absent -- name: Ensure bin directory exists. - ansible.builtin.file: - path: "{{ cachetool_bin | dirname }}" - state: directory - when: - - deploy_operation == 'deploy' + - name: Ensure bin directory exists. + ansible.builtin.file: + path: "{{ cachetool_bin | dirname }}" + state: directory - name: Download cachetool depending on latest php version installed. # If not specified manually, according to https://github.com/gordalina/cachetool#compatibility when: @@ -84,7 +83,7 @@ - cachetool.version is defined - cachetool.version | length > 0 -# Set up cachetool adapter +# Set up cachetool adapter - needs to happen on every run so _cachetool_adapter is set. - name: Get latest PHP version installed. ansible.builtin.shell: cmd: 'set -o pipefail && ls -1 /etc/php/ | while read ver; do if [ -d "/etc/php/$ver/fpm" ]; then echo "$ver"; fi; done | tail -1'