diff --git a/provisioning/playbook.yml b/provisioning/playbook.yml index d7881e590..05bab9fa0 100644 --- a/provisioning/playbook.yml +++ b/provisioning/playbook.yml @@ -80,6 +80,11 @@ - name: Check if Drupal is already set up. stat: "path={{ drupal_core_path }}/index.php" register: drupal_site + ignore_errors: true + + - name: Define drupal_site_exists + set_fact: + drupal_site_exists: "{{ drupal_site.stat.exists|default(false) }}" - include: tasks/sshd.yml - include: tasks/extras.yml diff --git a/provisioning/tasks/build-composer.yml b/provisioning/tasks/build-composer.yml index cafc99333..d5e61bcad 100644 --- a/provisioning/tasks/build-composer.yml +++ b/provisioning/tasks/build-composer.yml @@ -3,7 +3,7 @@ copy: src: "{{ drupal_composer_json }}" dest: "{{ drupal_composer_install_dir }}/composer.json" - when: drupal_composer_json is defined and not drupal_site.stat.exists + when: drupal_composer_json is defined and not drupal_site_exists - name: Check if composer.json exists. stat: "path={{ drupal_composer_install_dir }}/composer.json" @@ -13,7 +13,7 @@ command: > composer install chdir={{ drupal_composer_install_dir }} - when: drupal_composer_file.stat.exists and not drupal_site.stat.exists + when: drupal_composer_file.stat.exists and not drupal_site_exists become: no - name: Generate Drupal project with composer package. @@ -24,7 +24,7 @@ --stability dev --no-dev --no-interaction - when: not drupal_composer_file.stat.exists and not drupal_site.stat.exists + when: not drupal_composer_file.stat.exists and not drupal_site_exists become: no - name: Install dependencies with composer require. diff --git a/provisioning/tasks/build-makefile.yml b/provisioning/tasks/build-makefile.yml index 62db4cb82..862cb5acc 100644 --- a/provisioning/tasks/build-makefile.yml +++ b/provisioning/tasks/build-makefile.yml @@ -3,7 +3,7 @@ copy: src: "{{ drush_makefile_path }}" dest: /tmp/drupal.make.yml - when: not drupal_site.stat.exists + when: not drupal_site_exists - name: Ensure drupal_core_path directory exists. file: @@ -12,23 +12,23 @@ recurse: yes mode: 0775 become: no - when: not drupal_site.stat.exists + when: not drupal_site_exists - name: Generate Drupal site with drush makefile. command: > {{ drush_path }} make -y /tmp/drupal.make.yml --no-gitinfofile chdir={{ drupal_core_path }} - when: not drupal_site.stat.exists + when: not drupal_site_exists become: no - name: Check if a composer.json file is present. stat: "path={{ drupal_core_path }}/composer.json" register: drupal_core_composer_file - when: not drupal_site.stat.exists + when: not drupal_site_exists - name: Run composer install if composer.json is present. command: > composer install chdir={{ drupal_core_path }} - when: not drupal_site.stat.exists and drupal_core_composer_file.stat.exists + when: not drupal_site_exists and drupal_core_composer_file.stat.exists become: no