Skip to content

Commit d210ddb

Browse files
authored
Update module to synchronize features from other repos (#3)
1 parent cf4eac5 commit d210ddb

4 files changed

Lines changed: 37 additions & 7 deletions

File tree

defaults/main.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ apache_allowed_methods:
1313
- POST
1414
- HEAD
1515

16+
apache_allow_server_status_addresses:
17+
- 127.0.0.1
18+
1619
# etags almost always cause more trouble than they're worth, unless
1720
# you're hosting a large repository of filesystem content.
1821
apache_allow_etags: False
@@ -54,3 +57,7 @@ apache_default_tls_lists:
5457
veryhigh:
5558
sslprotocol: '+ALL -sslv3 -sslv2 -TLSv1 -TLSv1.1'
5659
sslciphersuite: 'EECDH+AES:@STRENGTH'
60+
61+
apache_enable_logrotate: True
62+
apache_logrotate_compress: False
63+
apache_logrotate_days: 7

tasks/main.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,13 @@
7272
state: started
7373
enabled: true
7474
tags: ['apache']
75+
76+
- name: ensure the logrotate config is in place
77+
template:
78+
src: "etc.logrotate.d.httpd.j2"
79+
dest: "/etc/logrotate.d/httpd"
80+
owner: root
81+
group: root
82+
mode: 0640
83+
when: apache_enable_logrotate
84+
tags: ['logrotate', 'apache']

templates/etc.httpd.conf.httpd.conf.j2

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,9 @@ ExtendedStatus on
122122
SetHandler server-status
123123
Order Deny,Allow
124124
Deny from all
125-
Allow from 127.0.0.1
126-
Allow from 10.0.0.0/8
127-
Allow from 70.184.247.66
128-
Allow from 70.39.246.214
129-
Allow from 70.39.246.66
125+
{% for address in apache_allow_server_status_addresses %}
126+
Allow from {{ address }}
127+
{% endfor %}
130128
</Location>
131129

132130

@@ -168,8 +166,8 @@ LogFormat "{ \
168166
}" json-proxy
169167

170168

171-
{% if ansible_distribution_major_version < '7' %}
169+
{% if ansible_distribution_major_version == '6' %}
172170
NameVirtualHost *:{{ apache_server_listen_port }}
173171
{% endif %}
174172

175-
Include conf.d/*.conf
173+
IncludeOptional conf.d/*.conf

templates/etc.logrotate.d.httpd.j2

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# {{ ansible_managed }}
2+
/var/log/httpd/*log {
3+
missingok
4+
notifempty
5+
sharedscripts
6+
delaycompress
7+
{% if apache_logrotate_compress | default(false) %}
8+
compress
9+
{% endif %}
10+
daily
11+
rotate {{ apache_logrotate_days }}
12+
postrotate
13+
/sbin/service httpd reload > /dev/null 2>/dev/null || true
14+
endscript
15+
}

0 commit comments

Comments
 (0)