agaric-coop/provisioning/box/post-tasks/10-drupal.yml

85 lines
2.5 KiB
YAML
Raw Permalink Normal View History

---
- name: determine status of settings directory and files
find:
paths: "{{ drupal_core_path }}/sites/default/"
recurse: no
register: find_result
2018-08-24 03:12:32 +00:00
- name: ensure settings directory is writable
file:
path: "{{ drupal_core_path }}/sites/default"
mode: 0775
state: directory
when: find_result.failed == false
become: yes
- name: ensure setting files are writable
file:
path: "{{ setting_file.path }}"
mode: 0664
state: file
when: find_result.failed == false
loop: "{{ find_result.files }}"
loop_control:
loop_var: setting_file
become: yes
- name: Run composer install.
command: "composer install"
args:
chdir: "{{ drupal_composer_install_dir }}"
- name: install default settings.php
copy:
src: "{{ drupal_core_path }}/sites/default/default.settings.php"
dest: "{{ drupal_core_path }}/sites/default/settings.php"
remote_src: true
- name: enable settings.local.php include_tasks
blockinfile:
path: "{{ drupal_core_path }}/sites/default/settings.php"
marker: "/* {mark} ANSIBLE MANAGED BLOCK: LOCAL INCLUDE */"
insertafter: EOF
content: |1+
if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) {
include $app_root . '/' . $site_path . '/settings.local.php';
}
- name: create settings.local.php
template:
src: "settings.local.php.j2"
dest: "{{ drupal_core_path }}/sites/default/settings.local.php"
- name: Check if site is already installed.
command: "{{ drupal_composer_install_dir }}/vendor/bin/drush --root={{ drupal_core_path}}/ status bootstrap"
args:
chdir: "{{ drupal_core_path }}"
register: drupal_site_installed
failed_when: "drupal_site_installed.stdout is undefined"
changed_when: false
become: no
- name: Install Drupal with drush.
command: >
{{ drupal_composer_install_dir }}/vendor/bin/drush site-install -y
--root={{ drupal_core_path }}
--site-name={{ drupal_site_name }}
--account-name={{ drupal_account_name }}
--account-pass={{ drupal_account_pass }}
--site-mail={{ drupal_account_email }}
args:
chdir: "{{ drupal_core_path }}"
become: no
when: "force_reinstall|default(false) or 'Drupal bootstrap' not in drupal_site_installed.stdout"
2018-08-22 20:59:39 +00:00
- name: Install theme build dependencies
npm:
2018-08-22 21:21:03 +00:00
path: "{{ drupal_core_path }}/themes/custom/agarica/patternlibrary"
2018-08-22 20:59:39 +00:00
state: present
- name: Build theme artifacts
command: grunt kss
2018-08-22 21:21:03 +00:00
args:
chdir: "{{ drupal_core_path }}/themes/custom/agarica/patternlibrary"
2018-08-24 02:57:06 +00:00
ignore_errors: yes