-
Notifications
You must be signed in to change notification settings - Fork 1
/
apache.yml
77 lines (62 loc) · 1.83 KB
/
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
- name: oel 7.5 apache build
remote_user: ulsprovision
hosts: webservers
become: yes
tasks:
# every time we install/update httpd, reset file system permissions to trust users other than root to read apache logs
- name: install yum-utils
yum:
name: yum-utils
state: latest
- name: install yum-plugin-post-transaction-actions
yum:
name: yum-plugin-post-transaction-actions
state: latest
- name: Trust users other than root to read apache logs
copy:
src: resources/httpd.action
dest: "/etc/yum/post-actions/"
- name: user can execute httpd.action
file:
path: /etc/yum/post-actions/httpd.action
mode: "u+x"
- name: install mod_ssl
yum:
name: mod_ssl
state: latest
- name: install certbot
yum:
name:
- certbot
- python2-certbot-apache
state: latest
- name: certbot auto renewal
cron:
name: certbot renewals
user: root
job: 'PATH=$PATH:/usr/sbin/;/usr/local/bin/cronic /usr/bin/certbot --quiet renew --deploy-hook "/usr/sbin/apachectl graceful"'
hour: 9
minute: "{{ 29 | random }}"
state: present
- import_tasks: clamav.tasks.yml
- name: selinux allow apache to execute external programs (clamscan)
seboolean:
name: httpd_execmem
state: yes
persistent: yes
- name: apache is a member of virusgroup
user:
name: apache
groups: virusgroup
- name: ensure httpd is running
service:
name: httpd
enabled: yes
state: started
- import_tasks: open-web-ports.tasks.yml
- name: preserve 10 years of logs
lineinfile:
path: /etc/logrotate.d/httpd
state: present
insertafter: '^/var/log/httpd/\*log \{'
line: ' rotate 520'