forked from Islandora-Devops/islandora-playbook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.yml
95 lines (80 loc) · 2.95 KB
/
bootstrap.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
---
- name: bootstrap
hosts: all
become: yes
gather_facts: false
tasks:
- name: include prod vars
include_vars:
dir: inventory/prod/group_vars
when: env|default('') is match("prod")
- name: include landing vars
include_vars:
dir: inventory/landing/group_vars
when: env|default('') is match("landing")
# python isn't installed by default on ubuntu so we need
# to do that with the raw command before
- name: install python
raw: test -e /usr/bin/python || (apt-get update; apt-get install -y python3;)
register: output
changed_when:
- output.stdout != ""
- output.stdout != "\r\n"
when: islandora_distro|default('') is match("ubuntu/")
# Manually gather facts once python is installed
- name: gather facts
setup:
# Include OS specific variables (like PHP stuff)
- name: include OS specific variables
include_vars: "vars/{{ ansible_os_family }}.yml"
# also need to make sure aptitude is installed for the apt
# commands in ansible.
- name: install aptitude
apt:
name: aptitude
state: present
update_cache: yes
when: ansible_os_family == "Debian"
# install some packages we would like on every server
- name: install extra packages ubuntu
package:
name: "{{ item }}"
state: present
with_items: "{{ islandora_extra_ubuntu_packages }}"
when: ansible_os_family == "Debian"
# install some packages we would like on every server
- name: install extra packages centos
package:
name: "{{ item }}"
state: present
with_items: "{{ islandora_extra_centos_packages }}"
when: ansible_os_family == "RedHat"
# Check Selinux
- name: check selinux status
raw: sestatus
register: sestatus_out
when: ansible_os_family == "RedHat"
# Parse sestatus down to one of two options.
- name: Set selinux permissive fact
set_fact:
selinux_permissive: "{{ sestatus_out.stdout|regex_search('Current mode.*(permissive|enforcing)')|regex_search('(permissive|enforcing)') }}"
when: ansible_os_family == "RedHat"
# Change Selinux to permissive
- name: change selinux enforcement to permissive
command: setenforce permissive
when: ansible_os_family == "RedHat" and disable_selinux and selinux_permissive == "enforcing"
# Check if we may be re-running
- name: Check for possible re-run
stat:
path: "{{ drupal_composer_install_dir }}/web/sites/default/"
register: defaultdir_exists
# if we are re-running, change the perms on the default dir so composer
# doesn't error out.
- name: Set writable perms on the default/ directory
file:
path: "{{ drupal_composer_install_dir }}/web/sites/default/"
mode: u+rw
recurse: yes
owner: "{{ ansible_user }}"
when: defaultdir_exists.stat.exists == true
become: yes