Add all files needed to bring up VM and run agaric.com locally

This commit is contained in:
benjamin melançon 2018-08-20 10:45:20 -04:00
parent 52c8b60bac
commit 4d2bc0ee24
742 changed files with 24037 additions and 0 deletions

View file

@ -0,0 +1,31 @@
# Drupal VM www Role
This role is a shim to configure miscellaneous settings prior to installing a Drupal site inside Drupal VM.
## Requirements
This role is meant to be run in Drupal VM. Use outside of Drupal VM will likely result in weird things happening.
## Role Variables
There are a few defaults defined, but you shouldn't really need to worry about this role's variables. It's a really simple role.
## Dependencies
- geerlingguy.nginx if `drupalvm_webserver` is set to `nginx`.
## Example Playbook
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: drupalvm
roles:
- drupalvm.www
## License
MIT / BSD
## Author Information
This role was created in 2017 by [Jeff Geerling](https://www.jeffgeerling.com/), author of [Ansible for DevOps](https://www.ansiblefordevops.com/).

View file

@ -0,0 +1,3 @@
---
drupalvm_webserver: apache
vagrant_user: vagrant

View file

@ -0,0 +1,31 @@
galaxy_info:
author: Jeff Geerling
description: A role to configure various odds and ends in Drupal VM prior to installing Drupal.
company: Midwestern Mac, LLC
issue_tracker_url: https://github.com/geerlingguy/drupal-vm/issues
license: MIT
min_ansible_version: 2.2
platforms:
- name: EL
versions:
- all
- name: Debian
versions:
- all
- name: Ubuntu
versions:
- precise
- raring
- saucy
- trusty
- xenial
galaxy_tags:
- nginx
- drupal
- vm
- vagrant
dependencies:
- { role: geerlingguy.nginx, when: drupalvm_webserver == 'nginx' }

View file

@ -0,0 +1,87 @@
---
- name: Define drupalvm_webserver_user (Debian).
set_fact:
drupalvm_webserver_user: www-data
when: ansible_os_family == 'Debian' and drupalvm_webserver_user is undefined
- name: Define drupalvm_webserver_user (RedHat).
set_fact:
drupalvm_webserver_user: "{{ (drupalvm_webserver == 'apache') | ternary('httpd', 'nginx') }}"
when: ansible_os_family == 'RedHat' and drupalvm_webserver_user is undefined
- name: Register information about the /vagrant directory.
stat:
path: /vagrant
register: vagrant_directory
# When using NFS the group id of a folder will be identical to that of the host
# machine, but the groupname will differ or not exist. For the latter case
# we create a group called `vagrant_group`.
#
# In Ansible 2.3+ the gr_name will be set if the GID is mapped to an existing
# group. If the GID doesn't exist, gr_name will be undefined.
- name: Ensure a group with the same GID as used to sync directories exist (Ansible 2.3+).
group:
gid: "{{ vagrant_directory.stat.gid }}"
name: vagrant_group
state: present
when: >
ansible_version.full | version_compare('2.3', '>=') and
vagrant_directory.stat.exists and
vagrant_directory.stat.gr_name is undefined
- name: Ensure the webserver user is in the same group as the owner of synced directories (Ansible 2.3+).
user:
name: "{{ drupalvm_webserver_user }}"
append: yes
groups: "{{ vagrant_directory.stat.gr_name|default('vagrant_group') }}"
when: >
ansible_version.full | version_compare('2.3', '>=') and
vagrant_directory.stat.exists and
not (vagrant_directory.stat.gr_name is defined and vagrant_directory.stat.gr_name == 'root')
# With Ansible 2.2 or lower, the existance of gr_name is dependant on the
# existance of UID as well, therefore we cannot rely on it.
# TODO: Remove the version compares and the 2.2 tasks once we require Ansible
# 2.3+
- name: Detect if group used to sync directories already exist (Ansible 2.2).
shell: "getent group {{ vagrant_directory.stat.gid }} | cut -d':' -f1"
register: vagrant_directory_groupname
changed_when: false
when: >
ansible_version.full | version_compare('2.3', '<') and
vagrant_directory.stat.exists
- name: Ensure a group with the same GID as used to sync directories exist (Ansible 2.2).
group:
gid: "{{ vagrant_directory.stat.gid }}"
name: vagrant_group
state: present
when: >
ansible_version.full | version_compare('2.3', '<') and
vagrant_directory.stat.exists and
vagrant_directory_groupname.stdout == ''
- name: Ensure the webserver user is in the same group as the owner of synced directories (Ansible 2.2).
user:
name: "{{ drupalvm_webserver_user }}"
append: yes
groups: "{{ vagrant_directory_groupname.stdout|default('vagrant_group') }}"
when: >
ansible_version.full | version_compare('2.3', '<') and
vagrant_directory.stat.exists and
vagrant_directory_groupname.stdout != 'root'
- name: Ensure admin group exist.
group: "name=admin state=present"
- name: Ensure vagrant user is in admin group.
user: "name={{ vagrant_user }} append=yes groups=admin"
- name: Set nicer permissions on Apache log directory.
file:
path: "/var/log/{{ apache_daemon }}"
state: directory
mode: 0755
recurse: true
when: drupalvm_webserver == 'apache'