Skip to content

Instantly share code, notes, and snippets.

@johnny5th
Created June 10, 2016 15:08
Show Gist options
  • Save johnny5th/b3ea91a8d29aa1ae533e9b628859b14d to your computer and use it in GitHub Desktop.
Save johnny5th/b3ea91a8d29aa1ae533e9b628859b14d to your computer and use it in GitHub Desktop.
---
- name: Check if site is already installed.
command: >
{{ drush_path }} status bootstrap
chdir={{ drupal_core_path }}
register: drupal_site_installed
failed_when: "drupal_site_installed.stdout is undefined"
changed_when: false
become: no
- name: Import Drupal site with Git.
git:
repo: "{{ drupal_import_git_url }}"
dest: "/tmp/gittemp"
when: "'Successful' not in drupal_site_installed.stdout"
become: no
- name: Copy imported site into Drupal dir
command: >
cp -a /tmp/gittemp/. {{ drupal_core_path }}/
when: "'Successful' not in drupal_site_installed.stdout"
become: no
- name: Delete temporary git file
file:
path: "/tmp/gittemp/"
state: absent
force: yes
when: "'Successful' not in drupal_site_installed.stdout"
become: no
- name: Copy settings.php template file.
template:
src: ../templates/settings.php.j2
dest: "{{ drupal_core_path }}/sites/default/settings.php"
mode: 0644
when: "'Successful' not in drupal_site_installed.stdout"
become: no
- name: Import git sql with drush.
command: >
{{ drush_path }} sql-cli < {{ drupal_core_path }}/{{ drupal_import_git_path }}
args:
chdir: "{{ drupal_core_path }}"
when: "'Successful' not in drupal_site_installed.stdout and {{ drupal_import_git_sql }} == true"
- name: Create Drupal Symlink
file:
src: /var/www/drupal
dest: /drupal
when: "'Successful' not in drupal_site_installed.stdout"
notify: restart webserver
become: no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment