Add all files needed to bring up VM and run agaric.com locally
This commit is contained in:
parent
52c8b60bac
commit
4d2bc0ee24
742 changed files with 24037 additions and 0 deletions
2
box/provisioning/roles/geerlingguy.drupal/.gitignore
vendored
Normal file
2
box/provisioning/roles/geerlingguy.drupal/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
*.retry
|
||||
tests/test.sh
|
34
box/provisioning/roles/geerlingguy.drupal/.travis.yml
Normal file
34
box/provisioning/roles/geerlingguy.drupal/.travis.yml
Normal file
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
services: docker
|
||||
|
||||
env:
|
||||
# Composer-project-based Drupal 8 site setup.
|
||||
- distro: centos7
|
||||
playbook: test.yml
|
||||
- distro: debian8
|
||||
playbook: test.yml
|
||||
- distro: ubuntu1604
|
||||
playbook: test.yml
|
||||
- distro: ubuntu1404
|
||||
playbook: test.yml
|
||||
# Git-based Drupal 8 site setup.
|
||||
- distro: centos7
|
||||
playbook: test-deploy.yml
|
||||
|
||||
script:
|
||||
# Configure test script so we can run extra tests after playbook is run.
|
||||
- export container_id=$(date +%s)
|
||||
- export cleanup=false
|
||||
|
||||
# Download test shim.
|
||||
- wget -O ${PWD}/tests/test.sh https://gist.githubusercontent.com/geerlingguy/73ef1e5ee45d8694570f334be385e181/raw/
|
||||
- chmod +x ${PWD}/tests/test.sh
|
||||
|
||||
# Run tests.
|
||||
- ${PWD}/tests/test.sh
|
||||
|
||||
# Make sure Drupal is running.
|
||||
- 'docker exec --tty ${container_id} env TERM=xterm curl http://drupaltest.dev/ | grep "Welcome to Drupal"'
|
||||
|
||||
notifications:
|
||||
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
20
box/provisioning/roles/geerlingguy.drupal/LICENSE
Normal file
20
box/provisioning/roles/geerlingguy.drupal/LICENSE
Normal file
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 Jeff Geerling
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
132
box/provisioning/roles/geerlingguy.drupal/README.md
Normal file
132
box/provisioning/roles/geerlingguy.drupal/README.md
Normal file
|
@ -0,0 +1,132 @@
|
|||
# Ansible Role: Drupal
|
||||
|
||||
[](https://travis-ci.org/geerlingguy/ansible-role-drupal)
|
||||
|
||||
Builds and installs [Drupal](https://drupal.org/), an open source content management platform.
|
||||
|
||||
## Requirements
|
||||
|
||||
Drupal is a PHP-based application that is meant to run behind a typical LAMP/LEMP/LEPP/etc. stack, so you'll need at least the following:
|
||||
|
||||
- Apache or Nginx (Recommended: `geerlingguy.apache` or `geerlingguy.nginx`)
|
||||
- MySQL or similar Database server (Recommended: `geerlingguy.mysql` or `geerlingguy.postgresql`)
|
||||
- PHP (Recommended: `geerlingguy.php` along with other PHP-related roles like `php-mysql`).
|
||||
|
||||
Drush is not an absolute requirement, but it's handy to have, and also required if you use this role to Install a Drupal site (`drupal_install_site: true`). You can use `geerlingguy.drush` to install Drush.
|
||||
|
||||
Git is not an absolute requirement, but is required if you're deploying from a Git repository (e.g. `drupal_deploy: true`). You can use `geerlingguy.git` to install Git.
|
||||
|
||||
## Role Variables
|
||||
|
||||
Available variables are listed below, along with default values (see `defaults/main.yml`):
|
||||
|
||||
### Deploy an existing project with Git
|
||||
|
||||
drupal_deploy: false
|
||||
drupal_deploy_repo: ""
|
||||
drupal_deploy_version: master
|
||||
drupal_deploy_update: true
|
||||
drupal_deploy_dir: "/var/www/drupal"
|
||||
drupal_deploy_accept_hostkey: no
|
||||
|
||||
Set `drupal_deploy` to `true` and `drupal_build_composer*` to `false` if you would like to deploy Drupal to your server from an existing Git repository. The other options all apply to the Git checkout operation:
|
||||
|
||||
- `repo`: Git repository address
|
||||
- `version`: can be a branch, tag, or commit hash
|
||||
- `update`: whether the repository should be updated to the latest commit, if `version` is a branch
|
||||
- `dir`: The directory into which the repository will be checked out
|
||||
- `accept_hostkey`: Whether to automatically accept the Git server's hostkey on the first connection.
|
||||
|
||||
You can also control whether a `composer install` is run after the git clone is finished using the following variable:
|
||||
|
||||
drupal_deploy_composer_install: yes
|
||||
|
||||
### Build a project from a Drush Make file
|
||||
|
||||
drupal_build_makefile: false
|
||||
drush_makefile_path: "/path/to/drupal.make.yml"
|
||||
drush_make_options: "--no-gitinfofile"
|
||||
|
||||
Set this to `true` and `drupal_build_composer*` to `false` if you would like to build a Drupal make file with Drush.
|
||||
|
||||
### Build a project from a Composer file
|
||||
|
||||
drupal_build_composer: false
|
||||
drupal_composer_path: "/path/to/drupal.composer.json"
|
||||
drupal_composer_install_dir: "/var/www/drupal"
|
||||
drupal_composer_dependencies:
|
||||
- "drupal/devel:1.x-dev"
|
||||
|
||||
Set `drupal_build_makefile` to `false` and this to `true` if you are using a Composer-based site deployment strategy.
|
||||
|
||||
### Create a new project using `drupal-project` (Composer)
|
||||
|
||||
drupal_build_composer_project: true
|
||||
drupal_composer_project_package: "drupal-composer/drupal-project:8.x-dev"
|
||||
drupal_composer_project_options: "--prefer-dist --stability dev --no-interaction"
|
||||
|
||||
Set this to `true` and `drupal_build_makefile`, `drupal_build_composer` to `false` if you are using Composer's `create-project` as a site deployment strategy.
|
||||
|
||||
### Required Drupal site settings
|
||||
|
||||
drupal_core_path: "{{ drupal_deploy_dir }}/web"
|
||||
drupal_core_owner: "{{ ansible_ssh_user | default(ansible_env.SUDO_USER, true) | default(ansible_env.USER, true) | default(ansible_user_id) }}"
|
||||
drupal_db_user: drupal
|
||||
drupal_db_password: drupal
|
||||
drupal_db_name: drupal
|
||||
drupal_db_backend: mysql
|
||||
drupal_db_host: "127.0.0.1"
|
||||
|
||||
Required Drupal settings. When used in a production or shared environment, you should update at least the `drupal_db_password` and use a secure password.
|
||||
|
||||
### Drupal site installation options
|
||||
|
||||
drupal_install_site: true
|
||||
|
||||
Set this to `false` if you don't need to install Drupal (using the `drupal_*` settings below), but instead copy down a database (e.g. using `drush sql-sync`).
|
||||
|
||||
drupal_domain: "drupaltest.dev"
|
||||
drupal_site_name: "Drupal"
|
||||
drupal_install_profile: standard
|
||||
drupal_site_install_extra_args: []
|
||||
drupal_enable_modules: []
|
||||
drupal_account_name: admin
|
||||
drupal_account_pass: admin
|
||||
|
||||
Settings for installing a Drupal site if `drupal_install_site` is `true`. If you need to pass additional arguments to the `drush site-install` command, you can pass them in as a list to the `drupal_site_install_extra_args` variable.
|
||||
|
||||
## Dependencies
|
||||
|
||||
N/A
|
||||
|
||||
## Example Playbook
|
||||
|
||||
See the example playbooks used for Travis CI tests (`tests/test.yml` and `tests/test-deploy.yml`) for simple examples. See also: [Drupal VM](https://www.drupalvm.com), which uses this role to set up Drupal.
|
||||
|
||||
- hosts: webserver
|
||||
vars_files:
|
||||
- vars/main.yml
|
||||
roles:
|
||||
- geerlingguy.apache
|
||||
- geerlingguy.mysql
|
||||
- geerlingguy.php
|
||||
- geerlingguy.php-mysql
|
||||
- geerlingguy.composer
|
||||
- geerlingguy.drush
|
||||
- geerlingguy.drupal
|
||||
|
||||
*Inside `vars/main.yml`*:
|
||||
|
||||
drupal_install_site: true
|
||||
drupal_build_composer_project: true
|
||||
drupal_composer_install_dir: "/var/www/drupal"
|
||||
drupal_core_path: "{{ drupal_composer_install_dir }}/web"
|
||||
drupal_domain: "example.com"
|
||||
|
||||
## License
|
||||
|
||||
MIT / BSD
|
||||
|
||||
## Author Information
|
||||
|
||||
This role was created in 2014 by [Jeff Geerling](https://www.jeffgeerling.com/), author of [Ansible for DevOps](https://www.ansiblefordevops.com/).
|
53
box/provisioning/roles/geerlingguy.drupal/defaults/main.yml
Normal file
53
box/provisioning/roles/geerlingguy.drupal/defaults/main.yml
Normal file
|
@ -0,0 +1,53 @@
|
|||
---
|
||||
# Set this to 'true' and specify a Git repository if you want to deploy Drupal
|
||||
# to your server from an existing repository.
|
||||
drupal_deploy: false
|
||||
drupal_deploy_repo: ""
|
||||
drupal_deploy_version: master
|
||||
drupal_deploy_update: true
|
||||
drupal_deploy_dir: "/var/www/drupal"
|
||||
drupal_deploy_accept_hostkey: no
|
||||
drupal_deploy_composer_install: yes
|
||||
|
||||
# Set this to 'true' and 'drupal_build_composer*' to 'false' if you would like
|
||||
# to build a Drupal make file with Drush.
|
||||
drupal_build_makefile: false
|
||||
drush_makefile_path: "/path/to/drupal.make.yml"
|
||||
drush_make_options: "--no-gitinfofile"
|
||||
|
||||
# Set 'drupal_build_makefile' to 'false' and this to 'true' if you are using a
|
||||
# Composer-based site deployment strategy.
|
||||
drupal_build_composer: false
|
||||
drupal_composer_path: "/path/to/drupal.composer.json"
|
||||
drupal_composer_install_dir: "{{ drupal_deploy_dir }}"
|
||||
drupal_composer_dependencies:
|
||||
- "drupal/devel:1.x-dev"
|
||||
|
||||
# Set this to 'true' and 'drupal_build_makefile', 'drupal_build_composer' to
|
||||
# 'false' if you are using Composer's create-project as a site deployment
|
||||
# strategy.
|
||||
drupal_build_composer_project: true
|
||||
drupal_composer_project_package: "drupal-composer/drupal-project:8.x-dev"
|
||||
drupal_composer_project_options: "--prefer-dist --stability dev --no-interaction"
|
||||
|
||||
# Required Drupal settings.
|
||||
drupal_core_path: "{{ drupal_deploy_dir }}/web"
|
||||
drupal_core_owner: "{{ ansible_ssh_user | default(ansible_env.SUDO_USER, true) | default(ansible_env.USER, true) | default(ansible_user_id) }}"
|
||||
drupal_db_user: drupal
|
||||
drupal_db_password: drupal
|
||||
drupal_db_name: drupal
|
||||
drupal_db_backend: mysql
|
||||
drupal_db_host: "127.0.0.1"
|
||||
|
||||
# Set this to 'false' if you don't need to install Drupal (using the drupal_*
|
||||
# settings below), but instead copy down a database (e.g. using drush sql-sync).
|
||||
drupal_install_site: true
|
||||
|
||||
# Settings for installing a Drupal site if 'drupal_install_site:' is 'true'.
|
||||
drupal_domain: "drupaltest.dev"
|
||||
drupal_site_name: "Drupal"
|
||||
drupal_install_profile: standard
|
||||
drupal_site_install_extra_args: []
|
||||
drupal_enable_modules: []
|
||||
drupal_account_name: admin
|
||||
drupal_account_pass: admin
|
12
box/provisioning/roles/geerlingguy.drupal/handlers/main.yml
Normal file
12
box/provisioning/roles/geerlingguy.drupal/handlers/main.yml
Normal file
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
- name: clear opcache
|
||||
command: >
|
||||
{{ drush_path }} eval
|
||||
"if (function_exists('apc_clear_cache')) {
|
||||
apc_clear_cache();
|
||||
}
|
||||
if (function_exists('opcache_reset')) {
|
||||
opcache_reset();
|
||||
}"
|
||||
args:
|
||||
chdir: "{{ drupal_core_path }}"
|
25
box/provisioning/roles/geerlingguy.drupal/meta/main.yml
Normal file
25
box/provisioning/roles/geerlingguy.drupal/meta/main.yml
Normal file
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
dependencies: []
|
||||
|
||||
galaxy_info:
|
||||
author: geerlingguy
|
||||
description: Deploy or install Drupal on your servers.
|
||||
company: "Midwestern Mac, LLC"
|
||||
license: "license (BSD, MIT)"
|
||||
min_ansible_version: 2.0
|
||||
platforms:
|
||||
- name: EL
|
||||
versions:
|
||||
- all
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- all
|
||||
- name: Debian
|
||||
versions:
|
||||
- all
|
||||
galaxy_tags:
|
||||
- development
|
||||
- web
|
||||
- drupal
|
||||
- cms
|
||||
- php
|
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
# Shims for Drupal VM backwards compatibility. To be removed by 2018.
|
||||
- name: build_makefile shim
|
||||
set_fact:
|
||||
drupal_build_makefile: "{{ build_makefile }}"
|
||||
when: build_makefile|default('')
|
||||
|
||||
- name: build_composer shim
|
||||
set_fact:
|
||||
drupal_build_composer: "{{ build_composer }}"
|
||||
when: build_composer|default('')
|
||||
|
||||
- name: build_composer_project shim
|
||||
set_fact:
|
||||
drupal_build_composer_project: "{{ build_composer_project }}"
|
||||
when: build_composer_project|default('')
|
||||
|
||||
- name: install_site shim
|
||||
set_fact:
|
||||
drupal_install_site: "{{ install_site }}"
|
||||
when: install_site|default('')
|
||||
|
||||
- name: drupalvm_database shim
|
||||
set_fact:
|
||||
drupal_db_backend: "{{ drupalvm_database }}"
|
||||
when: drupalvm_database|default('')
|
|
@ -0,0 +1,41 @@
|
|||
---
|
||||
- name: Delete old /tmp/composer-project
|
||||
file:
|
||||
path: "/tmp/composer-project"
|
||||
state: absent
|
||||
when: not drupal_site_exists
|
||||
|
||||
- name: Generate Drupal project with composer package in /tmp/composer-project (this may take a while).
|
||||
command: >
|
||||
{{ composer_path }} create-project
|
||||
{{ drupal_composer_project_package }} /tmp/composer-project
|
||||
{{ drupal_composer_project_options|default('--prefer-dist --no-interaction') }}
|
||||
when: not drupal_site_exists
|
||||
become: no
|
||||
environment:
|
||||
COMPOSER_PROCESS_TIMEOUT: 1200
|
||||
|
||||
- name: Ensure drupal_composer_install_dir directory has proper permissions.
|
||||
file:
|
||||
path: "{{ drupal_composer_install_dir }}"
|
||||
state: directory
|
||||
owner: "{{ drupal_core_owner }}"
|
||||
group: "{{ drupal_core_owner }}"
|
||||
mode: 0775
|
||||
when: not drupal_site_exists
|
||||
failed_when: false
|
||||
|
||||
- name: Move Drupal project files to drupal_composer_install_dir (this may take a while).
|
||||
command: >
|
||||
cp -r /tmp/composer-project/. {{ drupal_composer_install_dir }}/
|
||||
creates={{ drupal_core_path }}/index.php
|
||||
become: no
|
||||
when: not drupal_site_exists
|
||||
|
||||
- name: Install dependencies with composer require (this may take a while).
|
||||
composer:
|
||||
command: require
|
||||
arguments: "{{ item }}"
|
||||
working_dir: "{{ drupal_composer_install_dir }}"
|
||||
with_items: "{{ drupal_composer_dependencies|default([]) }}"
|
||||
become: no
|
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
- name: Ensure drupal_composer_install_dir directory exists.
|
||||
file:
|
||||
path: "{{ drupal_composer_install_dir }}"
|
||||
state: directory
|
||||
mode: 0775
|
||||
become: no
|
||||
when: drupal_composer_path and not drupal_site_exists
|
||||
|
||||
# Use copy-and-move to prevent issues in Windows with VirtualBox. See:
|
||||
# https://github.com/ansible/ansible/issues/9526#issuecomment-62336962
|
||||
- name: Copy composer.json into temporary location.
|
||||
copy:
|
||||
src: "{{ drupal_composer_path }}"
|
||||
dest: "/tmp/drupalvm-composer.json"
|
||||
when: drupal_composer_path and not drupal_site_exists
|
||||
become: no
|
||||
|
||||
- name: Move composer.json into place.
|
||||
command: "mv /tmp/drupalvm-composer.json {{ drupal_composer_install_dir }}/composer.json"
|
||||
when: drupal_composer_path and not drupal_site_exists
|
||||
become: no
|
||||
|
||||
- name: Run composer install (this may take a while).
|
||||
composer:
|
||||
command: install
|
||||
working_dir: "{{ drupal_composer_install_dir }}"
|
||||
when: not drupal_site_exists
|
||||
become: no
|
||||
|
||||
- name: Install dependencies with composer require (this may take a while).
|
||||
composer:
|
||||
command: require
|
||||
arguments: "{{ item }}"
|
||||
working_dir: "{{ drupal_composer_install_dir }}"
|
||||
with_items: "{{ drupal_composer_dependencies|default([]) }}"
|
||||
become: no
|
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
- name: Copy drush makefile into place.
|
||||
copy:
|
||||
src: "{{ drush_makefile_path }}"
|
||||
dest: /tmp/drupal.make.yml
|
||||
when: not drupal_site_exists
|
||||
|
||||
- name: Ensure drupal_core_path directory exists.
|
||||
file:
|
||||
path: "{{ drupal_core_path }}"
|
||||
state: directory
|
||||
recurse: yes
|
||||
mode: 0775
|
||||
become: no
|
||||
when: not drupal_site_exists
|
||||
|
||||
- name: Generate Drupal site with drush makefile.
|
||||
command: >
|
||||
{{ drush_path }} make -y /tmp/drupal.make.yml {{ drush_make_options }}
|
||||
chdir={{ drupal_core_path }}
|
||||
when: not drupal_site_exists
|
||||
become: no
|
||||
|
||||
- name: Check if a composer.json file is present.
|
||||
stat: "path={{ drupal_core_path }}/composer.json"
|
||||
register: drupal_core_composer_file
|
||||
when: not drupal_site_exists
|
||||
|
||||
- name: Run composer install if composer.json is present.
|
||||
command: >
|
||||
composer install
|
||||
chdir={{ drupal_core_path }}
|
||||
when: not drupal_site_exists and drupal_core_composer_file.stat.exists
|
||||
become: no
|
34
box/provisioning/roles/geerlingguy.drupal/tasks/deploy.yml
Normal file
34
box/provisioning/roles/geerlingguy.drupal/tasks/deploy.yml
Normal file
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
- name: Ensure drupal_deploy_dir directory exists.
|
||||
file:
|
||||
path: "{{ drupal_deploy_dir }}"
|
||||
state: directory
|
||||
mode: 0775
|
||||
owner: "{{ drupal_core_owner }}"
|
||||
group: "{{ drupal_core_owner }}"
|
||||
when: drupal_composer_path and not drupal_site_exists
|
||||
|
||||
- name: Check out Drupal to the docroot.
|
||||
git:
|
||||
repo: "{{ drupal_deploy_repo }}"
|
||||
version: "{{ drupal_deploy_version }}"
|
||||
update: "{{ drupal_deploy_update }}"
|
||||
force: yes
|
||||
dest: "{{ drupal_deploy_dir }}"
|
||||
accept_hostkey: "{{ drupal_deploy_accept_hostkey }}"
|
||||
register: drupal_deploy_repo_updated
|
||||
notify: clear opcache
|
||||
become: no
|
||||
|
||||
- name: Check if a composer.json file is present.
|
||||
stat: "path={{ drupal_deploy_dir }}/composer.json"
|
||||
register: drupal_deploy_composer_file
|
||||
|
||||
- name: Run composer install if composer.json is present.
|
||||
composer:
|
||||
command: install
|
||||
working_dir: "{{ drupal_deploy_dir }}"
|
||||
when:
|
||||
- drupal_deploy_composer_file.stat.exists == true
|
||||
- drupal_deploy_composer_install == true
|
||||
become: no
|
|
@ -0,0 +1,43 @@
|
|||
---
|
||||
- name: Check if site is already installed.
|
||||
command: "{{ drush_path }} --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
|
||||
|
||||
# See: https://www.drupal.org/node/2569365#comment-11680807
|
||||
- name: Configure database correctly if using PostgreSQL.
|
||||
command: psql -c "ALTER DATABASE {{ drupal_db_name }} SET bytea_output = 'escape';"
|
||||
when: "('Drupal bootstrap' not in drupal_site_installed.stdout) and (drupal_db_backend == 'pgsql')"
|
||||
become: yes
|
||||
become_user: "{{ postgresql_user }}"
|
||||
# See: https://github.com/ansible/ansible/issues/16048#issuecomment-229012509
|
||||
vars:
|
||||
ansible_ssh_pipelining: true
|
||||
|
||||
- name: Install Drupal with drush.
|
||||
command: >
|
||||
{{ drush_path }} site-install {{ drupal_install_profile | default('standard') }} -y
|
||||
--root={{ drupal_core_path }}
|
||||
--site-name="{{ drupal_site_name }}"
|
||||
--account-name={{ drupal_account_name }}
|
||||
--account-pass={{ drupal_account_pass }}
|
||||
--db-url={{ drupal_db_backend }}://{{ drupal_db_user }}:{{ drupal_db_password }}@{{ drupal_db_host }}/{{ drupal_db_name }}
|
||||
{{ drupal_site_install_extra_args | join(" ") }}
|
||||
args:
|
||||
chdir: "{{ drupal_core_path }}"
|
||||
notify: clear opcache
|
||||
when: "'Drupal bootstrap' not in drupal_site_installed.stdout"
|
||||
become: no
|
||||
|
||||
- name: Install configured modules with drush.
|
||||
command: >
|
||||
{{ drush_path }} pm-enable -y {{ drupal_enable_modules | join(" ") }}
|
||||
--root={{ drupal_core_path }}
|
||||
args:
|
||||
chdir: "{{ drupal_core_path }}"
|
||||
when: ('Drupal bootstrap' not in drupal_site_installed.stdout) and drupal_enable_modules
|
||||
become: no
|
62
box/provisioning/roles/geerlingguy.drupal/tasks/main.yml
Normal file
62
box/provisioning/roles/geerlingguy.drupal/tasks/main.yml
Normal file
|
@ -0,0 +1,62 @@
|
|||
---
|
||||
- name: Add backwards-compatibility shims.
|
||||
include: backwards-compatibility.yml
|
||||
static: no
|
||||
|
||||
- name: Check if Drupal is already set up.
|
||||
stat: "path={{ drupal_core_path }}/index.php"
|
||||
register: drupal_site
|
||||
ignore_errors: true
|
||||
|
||||
- name: Define drush_path if it's not already defined.
|
||||
set_fact:
|
||||
drush_path: drush
|
||||
when: drush_path is not defined
|
||||
|
||||
- name: Define drupal_site_exists.
|
||||
set_fact:
|
||||
drupal_site_exists: "{{ drupal_site.stat.exists|default(false) }}"
|
||||
|
||||
# Deploy Drupal if configured.
|
||||
- include: tasks/deploy.yml
|
||||
when: drupal_deploy
|
||||
|
||||
- name: Define drupal_deploy_updated
|
||||
set_fact:
|
||||
drupal_deploy_updated: "{{ drupal_deploy_repo_updated.changed|default(false) }}"
|
||||
|
||||
# Run update tasks if Drupal was updated.
|
||||
- include: tasks/update.yml
|
||||
when: drupal_deploy_updated and drupal_site_exists
|
||||
static: no
|
||||
|
||||
# Build makefile if configured.
|
||||
- include: tasks/build-makefile.yml
|
||||
when: drupal_build_makefile
|
||||
static: no
|
||||
|
||||
# Build with composer if configured.
|
||||
- include: tasks/build-composer.yml
|
||||
when: drupal_build_composer
|
||||
static: no
|
||||
|
||||
# Build a composer project if configured.
|
||||
- include: tasks/build-composer-project.yml
|
||||
when: drupal_build_composer_project
|
||||
static: no
|
||||
|
||||
# Set Drush variables.
|
||||
- name: Check if a project specific Drush binary exists.
|
||||
stat: "path={{ drupal_composer_install_dir }}/vendor/drush/drush/drush"
|
||||
register: drush_vendor_bin
|
||||
ignore_errors: true
|
||||
|
||||
- name: Use project specific Drush if available.
|
||||
set_fact:
|
||||
drush_path: "{{ drupal_composer_install_dir }}/vendor/drush/drush/drush"
|
||||
when: drush_vendor_bin.stat.exists
|
||||
|
||||
# Install site if configured.
|
||||
- include: tasks/install-site.yml
|
||||
when: drupal_install_site
|
||||
static: no
|
13
box/provisioning/roles/geerlingguy.drupal/tasks/update.yml
Normal file
13
box/provisioning/roles/geerlingguy.drupal/tasks/update.yml
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
- name: Run database updates.
|
||||
command: "{{ drush_path }} updatedb -y"
|
||||
args:
|
||||
chdir: "{{ drupal_core_path }}"
|
||||
|
||||
# TODO: Import configuration if configured?
|
||||
# TODO: Other commands if configured?
|
||||
|
||||
- name: Rebuild Drupal caches.
|
||||
command: "{{ drush_path }} cache-rebuild --quiet"
|
||||
args:
|
||||
chdir: "{{ drupal_core_path }}"
|
11
box/provisioning/roles/geerlingguy.drupal/tests/README.md
Normal file
11
box/provisioning/roles/geerlingguy.drupal/tests/README.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Ansible Role tests
|
||||
|
||||
To run the test playbook(s) in this directory:
|
||||
|
||||
1. Install and start Docker.
|
||||
1. Download the test shim (see .travis.yml file for the URL) into `tests/test.sh`:
|
||||
- `wget -O tests/test.sh https://gist.githubusercontent.com/geerlingguy/73ef1e5ee45d8694570f334be385e181/raw/`
|
||||
1. Make the test shim executable: `chmod +x tests/test.sh`.
|
||||
1. Run (from the role root directory) `distro=[distro] playbook=[playbook] ./tests/test.sh`
|
||||
|
||||
If you don't want the container to be automatically deleted after the test playbook is run, add the following environment variables: `cleanup=false container_id=$(date +%s)`
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/sh
|
||||
ALIAS_CMD="$(echo ""$0"" | sed -e 's?/sbin/??')"
|
||||
|
||||
case "$ALIAS_CMD" in
|
||||
start|stop|restart|reload|status)
|
||||
exec service $1 $ALIAS_CMD
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$1" in
|
||||
list )
|
||||
exec service --status-all
|
||||
;;
|
||||
reload-configuration )
|
||||
exec service $2 restart
|
||||
;;
|
||||
start|stop|restart|reload|status)
|
||||
exec service $2 $1
|
||||
;;
|
||||
\?)
|
||||
exit 0
|
||||
;;
|
||||
esac
|
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
- src: geerlingguy.repo-remi
|
||||
- src: geerlingguy.repo-dotdeb
|
||||
- src: geerlingguy.apache
|
||||
- src: geerlingguy.apache-php-fpm
|
||||
- src: geerlingguy.nginx
|
||||
- src: geerlingguy.mysql
|
||||
- src: geerlingguy.postgresql
|
||||
- src: geerlingguy.php
|
||||
- src: geerlingguy.php-mysql
|
||||
- src: geerlingguy.php-pgsql
|
||||
- src: geerlingguy.git
|
||||
- src: geerlingguy.composer
|
||||
- src: geerlingguy.drush
|
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
- hosts: all
|
||||
|
||||
vars_files:
|
||||
- test-vars.yml
|
||||
|
||||
vars:
|
||||
# Deploy from the Drupal VM Prod example project.
|
||||
drupal_deploy: true
|
||||
drupal_deploy_repo: "https://github.com/geerlingguy/drupalvm-live.git"
|
||||
drupal_deploy_dir: /var/www/drupal
|
||||
drupal_domain: "prod.drupalvm.com"
|
||||
|
||||
# Disable Composer-based codebase setup.
|
||||
drupal_build_composer_project: false
|
||||
drupal_build_composer: false
|
||||
drupal_composer_dependencies: []
|
||||
|
||||
pre_tasks:
|
||||
- include: test-setup.yml
|
||||
|
||||
roles:
|
||||
- name: geerlingguy.repo-remi
|
||||
when: ansible_os_family == "RedHat"
|
||||
- role: geerlingguy.repo-dotdeb
|
||||
when: ansible_distribution == 'Debian'
|
||||
- geerlingguy.apache
|
||||
- geerlingguy.mysql
|
||||
- geerlingguy.php
|
||||
- geerlingguy.php-mysql
|
||||
- geerlingguy.git
|
||||
- geerlingguy.composer
|
||||
- geerlingguy.drush
|
||||
- role_under_test
|
|
@ -0,0 +1,45 @@
|
|||
---
|
||||
- name: Update apt cache.
|
||||
apt: update_cache=yes cache_valid_time=86400
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: Install dependencies.
|
||||
package: name={{ item }}
|
||||
with_items:
|
||||
- curl
|
||||
- unzip
|
||||
- sendmail
|
||||
|
||||
- name: Add repository for Apache 2.4.9+ (Ubuntu 14).
|
||||
apt_repository: repo='ppa:ondrej/apache2'
|
||||
when: ansible_distribution == "Ubuntu" and ansible_distribution_release == "trusty"
|
||||
|
||||
- name: Add repository for PHP 7.0 (Ubuntu).
|
||||
apt_repository: repo='ppa:ondrej/php'
|
||||
when: ansible_distribution == "Ubuntu" and ansible_distribution_version != "16.04"
|
||||
|
||||
- name: Set php_packages for PHP 7.0 Debian 8 install.
|
||||
set_fact:
|
||||
php_packages:
|
||||
- php7.0-common
|
||||
- php7.0-cli
|
||||
- php7.0-dev
|
||||
- php7.0-fpm
|
||||
- libpcre3-dev
|
||||
- php7.0-opcache
|
||||
- php7.0-apcu
|
||||
- php7.0-xml
|
||||
- php7.0-zip
|
||||
- php7.0-mbstring
|
||||
- php7.0-json
|
||||
- php7.0-gd
|
||||
when: ansible_distribution == 'Debian'
|
||||
|
||||
- name: Copy initctl_faker into place for Ubuntu 14.04.
|
||||
copy:
|
||||
src: initctl_faker
|
||||
dest: /sbin/initctl
|
||||
mode: 0755
|
||||
force: yes
|
||||
when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '14.04'
|
||||
changed_when: false
|
|
@ -0,0 +1,32 @@
|
|||
---
|
||||
php_enable_webserver: false
|
||||
php_enablerepo: "remi,remi-php71"
|
||||
php_enable_php_fpm: true
|
||||
php_fpm_listen: "127.0.0.1:9000"
|
||||
|
||||
apache_mods_enabled:
|
||||
- expires.load
|
||||
- ssl.load
|
||||
- rewrite.load
|
||||
- proxy.load
|
||||
- proxy_fcgi.load
|
||||
apache_remove_default_vhost: true
|
||||
apache_vhosts:
|
||||
- servername: "{{ drupal_domain }}"
|
||||
serveralias: "www.{{ drupal_domain }}"
|
||||
documentroot: "{{ drupal_core_path }}"
|
||||
extra_parameters: |
|
||||
<FilesMatch \.php$>
|
||||
SetHandler "proxy:fcgi://{{ php_fpm_listen }}"
|
||||
</FilesMatch>
|
||||
|
||||
mysql_enablerepo: "remi"
|
||||
mysql_databases:
|
||||
- name: "{{ drupal_db_name }}"
|
||||
encoding: utf8mb4
|
||||
collation: utf8mb4_general_ci
|
||||
mysql_users:
|
||||
- name: "{{ drupal_db_user }}"
|
||||
host: "%"
|
||||
password: "{{ drupal_db_password }}"
|
||||
priv: "{{ drupal_db_name }}.*:ALL"
|
21
box/provisioning/roles/geerlingguy.drupal/tests/test.yml
Normal file
21
box/provisioning/roles/geerlingguy.drupal/tests/test.yml
Normal file
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
- hosts: all
|
||||
|
||||
vars_files:
|
||||
- test-vars.yml
|
||||
|
||||
pre_tasks:
|
||||
- include: test-setup.yml
|
||||
|
||||
roles:
|
||||
- name: geerlingguy.repo-remi
|
||||
when: ansible_os_family == "RedHat"
|
||||
- role: geerlingguy.repo-dotdeb
|
||||
when: ansible_distribution == 'Debian'
|
||||
- geerlingguy.apache
|
||||
- geerlingguy.mysql
|
||||
- geerlingguy.php
|
||||
- geerlingguy.php-mysql
|
||||
- geerlingguy.git
|
||||
- geerlingguy.composer
|
||||
- role_under_test
|
Loading…
Add table
Add a link
Reference in a new issue