---
- name: Check out Drupal Core to the Apache docroot.
  git:
    repo: http://git.drupal.org/project/drupal.git
    version: "{{ drupal_core_version }}"
    dest: "{{ drupal_core_path }}"

- name: Install Drupal dependencies with Composer.
  shell: >
    /usr/local/bin/composer install
    chdir={{ drupal_core_path }}
    creates={{ drupal_core_path }}/vendor/autoload.php

- name: Install Drupal.
  command: >
    drush si -y --site-name="{{ drupal_site_name }}"
    --account-name=admin
    --account-pass=admin
    --db-url=mysql://{{ domain }}:1234@localhost/{{ domain }}
    --root={{ drupal_core_path }}
    creates={{ drupal_core_path }}/sites/default/settings.php
  notify: restart apache

# SEE: https://drupal.org/node/2121849#comment-8413637
- name: Set permissions properly on settings.php.
  file:
    path: "{{ drupal_core_path }}/sites/default/settings.php"
    mode: 0744

- name: Set permissions properly on files directory.
  file:
    path: "{{ drupal_core_path }}/sites/default/files"
    mode: 0777
    state: directory
    recurse: yes

---
- name: Check out Drupal Core to the Apache docroot.
  git:
    repo: https://git.drupal.org/project/drupal.git
    version: "{{ drupal_core_version }}"
    dest: "{{ drupal_core_path }}"

- name: Install Drupal dependencies with Composer.
  shell: >
    /usr/local/bin/composer install
    chdir={{ drupal_core_path }}
    creates={{ drupal_core_path }}/vendor/autoload.php

- name: Install Drupal.
  command: >
    drush si -y --site-name="{{ drupal_site_name }}"
    --account-name=admin
    --account-pass=admin
    --db-url=mysql://{{ domain }}:1234@localhost/{{ domain }}
    --root={{ drupal_core_path }}
    creates={{ drupal_core_path }}/sites/default/settings.php
  notify: restart apache

# SEE: https://drupal.org/node/2121849#comment-8413637
- name: Set permissions properly on settings.php.
  file:
    path: "{{ drupal_core_path }}/sites/default/settings.php"
    mode: 0744

- name: Set permissions properly on files directory.
  file:
    path: "{{ drupal_core_path }}/sites/default/files"
    mode: 0777
    state: directory
    recurse: yes

Use secured HTTP connection for Drupal download
Use secured HTTP connection for Drupal download