-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsetup-apache.yml
88 lines (74 loc) · 2 KB
/
setup-apache.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
- name: Configure firewall and install Apache2
hosts: "{{ var_hosts | default('webheads') }}"
vars_files:
- vars/conf.yml
- vars/apache.yml
pre_tasks:
- name: install epel
become: yes
yum:
name: epel-release
state: latest
- name: install mod_security and firewalld
yum:
name:
- mod_security
- firewalld
state: latest
- name: Enable firewalld
service: name=firewalld state=started enabled=yes
- name: Make Document Root
file: path="{{ live_doc_root }}" state=directory
- name: Make httpd dir
file: path="/etc/httpd/conf/" state=directory
- name: Make autoconfig log dir
file: path="/var/log/httpd/autoconfig" state=directory
- name: Copy SSL certs.
copy:
src: "{{ item }}"
dest: /etc/httpd/conf
mode: 0600
with_items:
- "files/privkey.pem"
- "files/chain.pem"
- "files/cert.pem"
- name: install mod_wsgi
yum:
name: mod_wsgi
state: latest
- name: Set MPM to event by copying config file,
copy:
src: "{{ item }}"
dest: /etc/httpd/conf.modules.d
mode: 0644
with_items:
- "files/00-mpm.conf"
roles:
- { role: geerlingguy.apache }
post_tasks:
- name: Make sure http and https ports are open.
firewalld:
service: "{{ item }}"
zone: public
permanent: yes
immediate: yes
state: enabled
with_items:
- http
- https
- name: Comment out CustomLog.
replace:
path: /etc/httpd/conf/httpd.conf
regexp: '^[ ]+CustomLog \"logs\/access_log\" combined'
replace: ''
backup: no
- name: Comment out LogFormat.
replace:
path: /etc/httpd/conf/httpd.conf
regexp: '^[ ]+LogFormat.*$'
replace: ''
backup: no
- name: Reload service httpd, in all cases.
systemd:
name: httpd
state: reloaded