diff --git a/roles/database_apply/database_apply-drupal7/tasks/ctools.yml b/roles/database_apply/database_apply-drupal7/tasks/ctools.yml index 194226fa..8102d3d6 100644 --- a/roles/database_apply/database_apply-drupal7/tasks/ctools.yml +++ b/roles/database_apply/database_apply-drupal7/tasks/ctools.yml @@ -1,4 +1,5 @@ --- +# For some reason D7 drush doesn't respect 'chdir' with command, using shell instead. - name: Check if Ctools module is enabled. ansible.builtin.shell: cmd: "{{ drush_bin }} pm-info ctools | grep ': enabled' | wc -l" @@ -6,7 +7,7 @@ register: ctools_enabled - name: Revert Drupal configuration from Ctools. - ansible.builtin.command: + ansible.builtin.shell: cmd: "{{ drush_bin }} -y ctools-export-revert --all" chdir: "{{ deploy_path }}/{{ webroot }}/sites/{{ site.folder }}" when: ctools_enabled.stdout == "1" diff --git a/roles/database_apply/database_apply-drupal7/tasks/features.yml b/roles/database_apply/database_apply-drupal7/tasks/features.yml index edba46bf..f55795dc 100644 --- a/roles/database_apply/database_apply-drupal7/tasks/features.yml +++ b/roles/database_apply/database_apply-drupal7/tasks/features.yml @@ -1,8 +1,9 @@ --- +# For some reason D7 drush doesn't respect 'chdir' with command, using shell instead. - name: Check if Features module is enabled. - shell: "cd {{ deploy_path }}/{{ webroot }}/sites/{{ site.folder }} && {{ drush_bin }} -l {{ site.folder }} pm-info features | grep ': enabled' | wc -l" + ansible.builtin.shell: "cd {{ deploy_path }}/{{ webroot }}/sites/{{ site.folder }} && {{ drush_bin }} -l {{ site.folder }} pm-info features | grep ': enabled' | wc -l" register: features_enabled - name: Revert Drupal configuration from Features. - shell: "cd {{ deploy_path }}/{{ webroot }}/sites/{{ site.folder }} && {{ drush_bin }} -l {{ site.folder }} -y {{ site.revert_features_command }}" + ansible.builtin.shell: "cd {{ deploy_path }}/{{ webroot }}/sites/{{ site.folder }} && {{ drush_bin }} -l {{ site.folder }} -y {{ site.revert_features_command }}" when: features_enabled.stdout == "1" diff --git a/roles/database_apply/database_apply-drupal7/tasks/main.yml b/roles/database_apply/database_apply-drupal7/tasks/main.yml index fe25bcaa..70b21947 100644 --- a/roles/database_apply/database_apply-drupal7/tasks/main.yml +++ b/roles/database_apply/database_apply-drupal7/tasks/main.yml @@ -1,7 +1,7 @@ --- - +# For some reason D7 drush doesn't respect 'chdir' with command, using shell instead. - name: Install Drupal. - shell: + ansible.builtin.shell: cmd: "{{ drush_bin }} -l {{ site.folder }} {{ site.install_command }}" chdir: "{{ deploy_path }}/{{ webroot }}/sites/{{ site.folder }}" become: "{{ 'no' if www_user == deploy_user else 'yes' }}" @@ -12,7 +12,7 @@ when: previous_build_number == 0 or (site.force_install is defined and site.force_install) - name: Fix permissions on Drupal directory. - shell: + ansible.builtin.shell: cmd: "chmod 755 {{ deploy_path }}/{{ webroot }}/sites/{{ site.folder }}" with_items: "{{ drupal.sites }}" loop_control: @@ -30,7 +30,7 @@ when: previous_build_number > 0 - name: Apply Drupal database updates. - shell: + ansible.builtin.shell: cmd: "{{ drush_bin }} -l {{ site.folder }} -y updb" chdir: "{{ deploy_path }}/{{ webroot }}/sites/{{ site.folder }}" with_items: "{{ drupal.sites }}" @@ -38,7 +38,7 @@ loop_var: site - name: Revert Drupal configuration with Features. - include_tasks: features.yml + ansible.builtin.include_tasks: features.yml with_items: "{{ drupal.sites }}" loop_control: loop_var: site @@ -47,7 +47,7 @@ - site.revert_features_command - name: Revert Drupal configuration with Ctools. - include_tasks: ctools.yml + ansible.builtin.include_tasks: ctools.yml with_items: "{{ drupal.sites }}" loop_control: loop_var: site diff --git a/roles/sanitize/admin_creds/admin_creds-drupal7/tasks/admin.yml b/roles/sanitize/admin_creds/admin_creds-drupal7/tasks/admin.yml index 22f9e55e..add864cf 100644 --- a/roles/sanitize/admin_creds/admin_creds-drupal7/tasks/admin.yml +++ b/roles/sanitize/admin_creds/admin_creds-drupal7/tasks/admin.yml @@ -4,11 +4,12 @@ - ansible.builtin.set_fact: _admin_pwd: "{{ lookup('password', '/tmp/{{ project_name }}-{{ site.folder }}-{{ build_type }}-{{ build_number }}-pwd chars=ascii_letters') }}" +# For some reason D7 drush doesn't respect 'chdir' with command, using shell instead. - name: Reset admin username. - ansible.builtin.command: + ansible.builtin.shell: cmd: "{{ drush_bin }} -l {{ site.folder }} sql-query \"UPDATE users SET name='{{ _admin_user }}' WHERE uid=1;\"" chdir: "{{ deploy_path }}/{{ webroot }}/sites/{{ site.folder }}" - name: Reset admin password. - ansible.builtin.command: + ansible.builtin.shell: cmd: "{{ drush_bin }} -l {{ site.folder }} upwd {{ _admin_user }} --password='{{ _admin_pwd }}'" chdir: "{{ deploy_path }}/{{ webroot }}/sites/{{ site.folder }}" diff --git a/roles/sync/drupal_sync_tasks/cache_clear/cache_clear-drupal7/tasks/main.yml b/roles/sync/drupal_sync_tasks/cache_clear/cache_clear-drupal7/tasks/main.yml index ab9342ba..fd22fbff 100644 --- a/roles/sync/drupal_sync_tasks/cache_clear/cache_clear-drupal7/tasks/main.yml +++ b/roles/sync/drupal_sync_tasks/cache_clear/cache_clear-drupal7/tasks/main.yml @@ -1,6 +1,7 @@ --- +# For some reason D7 drush doesn't respect 'chdir' with command, using shell instead. - name: Clear Drupal 7 cache. - ansible.builtin.command: + ansible.builtin.shell: cmd: "{{ drush_bin }} -l {{ site.folder }} -y cc all" chdir: "{{ live_symlink_dest }}/{{ webroot }}/sites/{{ site.folder }}" become: "{{ 'no' if www_user == deploy_user else 'yes' }}" diff --git a/roles/sync/drupal_sync_tasks/database_apply/database_apply-drupal7/tasks/main.yml b/roles/sync/drupal_sync_tasks/database_apply/database_apply-drupal7/tasks/main.yml index ea4c083b..eeaa2d73 100644 --- a/roles/sync/drupal_sync_tasks/database_apply/database_apply-drupal7/tasks/main.yml +++ b/roles/sync/drupal_sync_tasks/database_apply/database_apply-drupal7/tasks/main.yml @@ -1,6 +1,7 @@ --- +# For some reason D7 drush doesn't respect 'chdir' with command, using shell instead. - name: Apply Drupal database updates. - ansible.builtin.command: + ansible.builtin.shell: cmd: "{{ drush_bin }} -l {{ site.folder }} -y updb" chdir: "{{ live_symlink_dest }}/{{ webroot }}/sites/{{ site.folder }}" with_items: "{{ drupal.sites }}"