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
87
box/provisioning/roles/drupalvm.www/tasks/main.yml
Normal file
87
box/provisioning/roles/drupalvm.www/tasks/main.yml
Normal 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'
|
Loading…
Add table
Add a link
Reference in a new issue