Reorganize provisioning files
This commit is contained in:
parent
98bb404ed4
commit
e0d288a095
5 changed files with 2 additions and 2 deletions
|
@ -271,5 +271,5 @@ hostname_configure: true
|
|||
hostname_fqdn: "{{ vagrant_hostname }}"
|
||||
ssh_home: "{{ drupal_core_path }}"
|
||||
|
||||
post_provision_tasks_dir: ../../provisioning/post-tasks/*.yml
|
||||
pre_provision_tasks_dir: ../../provisioning/pre-tasks/*.yml
|
||||
post_provision_tasks_dir: ../../provisioning/box/post-tasks/*.yml
|
||||
pre_provision_tasks_dir: ../../provisioning/box/pre-tasks/*.yml
|
||||
|
|
7
provisioning/box/post-tasks/00-vagrant.yml
Normal file
7
provisioning/box/post-tasks/00-vagrant.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
- name: Grant vagrant access to logs
|
||||
user:
|
||||
name: vagrant
|
||||
groups: adm
|
||||
append: True
|
||||
become: yes
|
76
provisioning/box/post-tasks/10-drupal.yml
Normal file
76
provisioning/box/post-tasks/10-drupal.yml
Normal file
|
@ -0,0 +1,76 @@
|
|||
---
|
||||
- name: ensure settings location is still writable
|
||||
file:
|
||||
path: "{{ drupal_core_path }}/sites/default"
|
||||
mode: 0775
|
||||
state: directory
|
||||
|
||||
- name: ensure settings file is still writable
|
||||
file:
|
||||
path: "{{ drupal_core_path }}/sites/default/settings.php"
|
||||
mode: 0664
|
||||
state: file
|
||||
|
||||
- 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"
|
||||
|
||||
- name: Install theme build dependencies
|
||||
npm:
|
||||
path: "{{ drupal_core_path }}/themes/custom/agarica/patternlibrary"
|
||||
state: present
|
||||
|
||||
- name: Build theme artifacts
|
||||
command: grunt kss
|
||||
args:
|
||||
chdir: "{{ drupal_core_path }}/themes/custom/agarica/patternlibrary"
|
||||
|
||||
# - name: Ensure ansible is installed
|
||||
# apt:
|
||||
# name: ansible
|
||||
# state: latest
|
||||
# become: yes
|
28
provisioning/box/post-tasks/templates/settings.local.php.j2
Normal file
28
provisioning/box/post-tasks/templates/settings.local.php.j2
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Settings for the hosted environment.
|
||||
*/
|
||||
|
||||
$databases['default']['default'] = array(
|
||||
'driver' => 'mysql',
|
||||
'database' => '{{ drupal_db_name }}',
|
||||
'username' => '{{ drupal_db_user }}',
|
||||
'password' => '{{ drupal_db_password }}',
|
||||
'host' => '{{ drupal_db_host|default(localhost) }}',
|
||||
'prefix' => '',
|
||||
);
|
||||
|
||||
$settings['trusted_host_patterns'] = array(
|
||||
'^(.*\.)*{{ vagrant_hostname|default("*")|replace(".", "\.") }}$'
|
||||
);
|
||||
|
||||
$config['system.performance']['css']['preprocess'] = FALSE;
|
||||
$config['system.performance']['js']['preprocess'] = FALSE;
|
||||
|
||||
$config_directories = array(
|
||||
CONFIG_SYNC_DIRECTORY => '../custom/config/sync',
|
||||
);
|
||||
|
||||
$config['system.site']['name'] = "{{ drupal_site_name }}";
|
19
provisioning/box/pre-tasks/00-name_by_path.yml
Normal file
19
provisioning/box/pre-tasks/00-name_by_path.yml
Normal file
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
- name: get root folder of project
|
||||
shell: pwd
|
||||
register: proj_root
|
||||
args:
|
||||
chdir: "{{ playbook_dir }}/../../"
|
||||
delegate_to: localhost
|
||||
become: false
|
||||
|
||||
- name: remove underscores from folder name
|
||||
set_fact:
|
||||
proj_root_safe: "{{ proj_root.stdout|basename|replace('_','-') }}"
|
||||
|
||||
# These values are NOT honored by Vagrant, but are still necessary for DrupalVM
|
||||
# See also provisioning/box/config
|
||||
- name: set vagrant hostname according to the project folder
|
||||
set_fact:
|
||||
vagrant_hostname: "{{ proj_root_safe }}.local"
|
||||
vagrant_machine_name: "{{ proj_root_safe }}-coop-vm"
|
Loading…
Add table
Add a link
Reference in a new issue