Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Commit

Permalink
Fix check for whether drupal is installed when the directory doesnt e…
Browse files Browse the repository at this point in the history
…xist
  • Loading branch information
oxyc committed Jun 3, 2016
1 parent 973d25d commit 0a13a2c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions provisioning/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions provisioning/tasks/build-composer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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.
Expand All @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions provisioning/tasks/build-makefile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

0 comments on commit 0a13a2c

Please sign in to comment.