Squid: replace logrotate file if default
This commit is contained in:
parent
432a89fe40
commit
c1169f86f1
|
@ -1,6 +0,0 @@
|
||||||
---
|
|
||||||
- name: logrotate configuration
|
|
||||||
template:
|
|
||||||
src: logrotate.j2
|
|
||||||
dest: /etc/logrotate.d/{{ squid_daemon_name }}
|
|
||||||
force: no
|
|
29
squid/tasks/logrotate_jessie.yml
Normal file
29
squid/tasks/logrotate_jessie.yml
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
# md5sum for squid logrotate file :
|
||||||
|
#
|
||||||
|
# --check reads stdin for a list of files and md5 sums
|
||||||
|
# the list contains the checksum for the file provided by Jessie
|
||||||
|
#
|
||||||
|
# We don't use --status so we can debug if needed
|
||||||
|
#
|
||||||
|
# With that command we can check if the logrotate file for squid
|
||||||
|
# is the one provided by the package.
|
||||||
|
|
||||||
|
- name: check if logrotate file is default
|
||||||
|
shell: 'printf "43994674706b672ae5018f592beccf2e /etc/logrotate.d/{{ squid_daemon_name }}" | md5sum --check'
|
||||||
|
changed_when: False
|
||||||
|
failed_when: False
|
||||||
|
check_mode: no
|
||||||
|
register: squid_logrotate_md5
|
||||||
|
tags:
|
||||||
|
- squid
|
||||||
|
|
||||||
|
- name: logrotate configuration
|
||||||
|
template:
|
||||||
|
src: logrotate.j2
|
||||||
|
dest: /etc/logrotate.d/{{ squid_daemon_name }}
|
||||||
|
force: yes
|
||||||
|
when: squid_logrotate_md5.rc == 0
|
||||||
|
tags:
|
||||||
|
- squid
|
29
squid/tasks/logrotate_stretch.yml
Normal file
29
squid/tasks/logrotate_stretch.yml
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
# md5sum for squid logrotate file :
|
||||||
|
#
|
||||||
|
# --check reads stdin for a list of files and md5 sums
|
||||||
|
# the list contains the checksum for the file provided by Stretch
|
||||||
|
#
|
||||||
|
# We don't use --status so we can debug if needed
|
||||||
|
#
|
||||||
|
# With that command we can check if the logrotate file for squid
|
||||||
|
# is the one provided by the package.
|
||||||
|
|
||||||
|
- name: check if logrotate file is default
|
||||||
|
shell: 'printf "c210feea019412adac8a5d5dcba427af /etc/logrotate.d/{{ squid_daemon_name }}" | md5sum --check'
|
||||||
|
changed_when: False
|
||||||
|
failed_when: False
|
||||||
|
check_mode: no
|
||||||
|
register: squid_logrotate_md5
|
||||||
|
tags:
|
||||||
|
- squid
|
||||||
|
|
||||||
|
- name: logrotate configuration
|
||||||
|
template:
|
||||||
|
src: logrotate_stretch.j2
|
||||||
|
dest: /etc/logrotate.d/{{ squid_daemon_name }}
|
||||||
|
force: yes
|
||||||
|
when: squid_logrotate_md5.rc == 0
|
||||||
|
tags:
|
||||||
|
- squid
|
|
@ -134,7 +134,11 @@
|
||||||
notify: "reload squid"
|
notify: "reload squid"
|
||||||
when: ansible_distribution_major_version | version_compare('9', '>=')
|
when: ansible_distribution_major_version | version_compare('9', '>=')
|
||||||
|
|
||||||
- include: logrotate.yml
|
- include: logrotate_jessie.yml
|
||||||
|
when: ansible_distribution_release == "jessie"
|
||||||
|
|
||||||
|
- include: logrotate_stretch.yml
|
||||||
|
when: ansible_distribution_major_version | version_compare('9', '>=')
|
||||||
|
|
||||||
- include: minifirewall.yml
|
- include: minifirewall.yml
|
||||||
|
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
/var/log/{{ squid_daemon_name }}/*.log {
|
|
||||||
monthly
|
|
||||||
compress
|
|
||||||
rotate 12
|
|
||||||
missingok
|
|
||||||
create 640 proxy adm
|
|
||||||
sharedscripts
|
|
||||||
postrotate
|
|
||||||
test ! -e /var/run/{{ squid_daemon_name }}.pid || /usr/sbin/{{ squid_daemon_name }} -k rotate
|
|
||||||
endscript
|
|
||||||
}
|
|
14
squid/templates/logrotate_jessie.j2
Normal file
14
squid/templates/logrotate_jessie.j2
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#
|
||||||
|
# Logrotate fragment for squid3.
|
||||||
|
#
|
||||||
|
/var/log/squid3/*.log {
|
||||||
|
monthly
|
||||||
|
compress
|
||||||
|
rotate 12
|
||||||
|
missingok
|
||||||
|
create 640 proxy adm
|
||||||
|
sharedscripts
|
||||||
|
postrotate
|
||||||
|
test ! -e /var/run/squid3.pid || test ! -x /usr/sbin/squid3 || /usr/sbin/squid3 -k rotate
|
||||||
|
endscript
|
||||||
|
}
|
18
squid/templates/logrotate_stretch.j2
Normal file
18
squid/templates/logrotate_stretch.j2
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#
|
||||||
|
# Logrotate fragment for squid.
|
||||||
|
#
|
||||||
|
/var/log/squid/*.log {
|
||||||
|
monthly
|
||||||
|
compress
|
||||||
|
delaycompress
|
||||||
|
rotate 12
|
||||||
|
missingok
|
||||||
|
create 640 proxy adm
|
||||||
|
sharedscripts
|
||||||
|
prerotate
|
||||||
|
test ! -x /usr/sbin/sarg-reports || /usr/sbin/sarg-reports monthly
|
||||||
|
endscript
|
||||||
|
postrotate
|
||||||
|
test ! -e /var/run/squid.pid || test ! -x /usr/sbin/squid || /usr/sbin/squid -k rotate
|
||||||
|
endscript
|
||||||
|
}
|
Loading…
Reference in a new issue