Add settings(local)php generation to provision

This commit is contained in:
Chris Thompson 2018-08-22 16:27:51 -04:00
parent 15ebd22051
commit dbc00a269d
2 changed files with 90 additions and 5 deletions

View file

@ -4,10 +4,30 @@
args: args:
chdir: "{{ drupal_composer_install_dir }}" 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"
- 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. - name: Check if site is already installed.
command: "{{ drupal_composer_install_dir }}/vendor/bin/drush --root={{ drupal_composer_install_dir }}/web/ status bootstrap" command: "{{ drupal_composer_install_dir }}/vendor/bin/drush --root={{ drupal_core_path}}/ status bootstrap"
args: args:
chdir: "{{ drupal_composer_install_dir }}/web" chdir: "{{ drupal_core_path }}"
register: drupal_site_installed register: drupal_site_installed
failed_when: "drupal_site_installed.stdout is undefined" failed_when: "drupal_site_installed.stdout is undefined"
changed_when: false changed_when: false
@ -42,20 +62,20 @@
- name: Install Drupal with drush. - name: Install Drupal with drush.
command: > command: >
{{ drupal_composer_install_dir }}/vendor/bin/drush site-install -y {{ drupal_composer_install_dir }}/vendor/bin/drush site-install -y
--root={{ drupal_composer_install_dir }}/web --root={{ drupal_core_path }}
--site-name={{ drupal_site_name }} --site-name={{ drupal_site_name }}
--account-name={{ drupal_account_name }} --account-name={{ drupal_account_name }}
--account-pass={{ drupal_account_pass }} --account-pass={{ drupal_account_pass }}
--site-mail={{ drupal_account_email }} --site-mail={{ drupal_account_email }}
args: args:
chdir: "{{ drupal_composer_install_dir }}/web" chdir: "{{ drupal_core_path }}"
become: no become: no
when: "force_reinstall|default(false) or 'Drupal bootstrap' not in drupal_site_installed.stdout" when: "force_reinstall|default(false) or 'Drupal bootstrap' not in drupal_site_installed.stdout"
- name: Run sass - name: Run sass
command: sassc sass/styles.scss css/styles.css command: sassc sass/styles.scss css/styles.css
args: args:
chdir: "{{ drupal_composer_install_dir }}/web/themes/{{ theme }}/" chdir: "{{ drupal_core_path }}/themes/{{ theme }}/"
when: theme != "" when: theme != ""
# - name: Ensure ansible is installed # - name: Ensure ansible is installed

View file

@ -0,0 +1,65 @@
<?php
/**
* @file
* Settings for the hosted environment.
*/
$databases['default']['default'] = array(
'driver' => 'mysql',
'database' => '{{ drupal_db_name }}',
'username' => '{{ drupal_db_user }}',
'password' => '{{ db_pwd }}',
'host' => '{{ drupal_db_host|default(localhost) }}',
'prefix' => '',
);
$settings['trusted_host_patterns'] = array(
'^(.*\.)*{{ vagrant_hostname|default("*")|replace(".", "\.") }}$'
);
$settings['hash_salt'] = '{{ hash_salt }}';
$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 }}";
# Disable all functionality related to authorized file operations:
// $settings['allow_authorize_operations'] = FALSE;
//
// $settings['file_chmod_directory'] = 0770;
// $settings['file_chmod_file'] = 0660;
# $settings['file_public_base_url'] = 'http://downloads.example.com/files';
# $settings['file_public_path'] = 'sites/default/files';
# The template file should be copied into the theme. It is located inside
# 'core/modules/system/templates/maintenance-page.html.twig'.
# $settings['maintenance_theme'] = 'bartik';
# $settings['install_profile'] = '';
# Invalidate dependency injection container
# $settings['deployment_identifier'] = \Drupal::VERSION;
# Ensure this is always false:
# $settings['update_free_access'] = FALSE;
# Outbound proxy access settings:
# $settings['http_client_config']['proxy']['http'] = 'http://proxy_user:proxy_pass@example.com:8080';
# $settings['http_client_config']['proxy']['https'] = 'http://proxy_user:proxy_pass@example.com:8080';
# $settings['http_client_config']['proxy']['no'] = ['127.0.0.1', 'localhost'];
# Reverse proxy settings:
# $settings['reverse_proxy'] = TRUE;
# $settings['reverse_proxy_addresses'] = array('a.b.c.d', ...);
# $settings['reverse_proxy_header'] = 'X_FORWARDED_FOR';
# $settings['reverse_proxy_proto_header'] = 'X_FORWARDED_PROTO';
# $settings['reverse_proxy_host_header'] = 'X_FORWARDED_HOST';
# $settings['reverse_proxy_port_header'] = 'X_FORWARDED_PORT';
# $settings['reverse_proxy_forwarded_header'] = 'FORWARDED';
# If a direct path is provided for authenticated users, set to false:
# $settings['omit_vary_cookie'] = TRUE;
{% if php_settings_code %}
{{ php_settings_code }}
{% endif %}