Made sure munin and logrotate use the proper path for bind logs

Not all code paths made sure that the chroot was taken into account.
This commit is contained in:
Patrick Marchand 2019-11-26 14:02:28 -05:00
parent b7a223dbdd
commit 7728f5f0c5
4 changed files with 13 additions and 30 deletions

View File

@ -49,18 +49,18 @@
- restart bind
when: ansible_distribution_release == "jessie"
- name: touch /var/log/bind.log if non chroot
- name: "touch {{ bind_log_file }} if non chroot"
file:
path: /var/log/bind.log
path: "{{ bind_log_file }}"
owner: bind
group: adm
mode: "0640"
state: touch
when: not bind_chroot_set
- name: touch /var/log/bind_queries.log if non chroot
- name: "touch {{ bind_query_file }} if non chroot"
file:
path: /var/log/bind_queries.log
path: "{{ bind_query_file }}"
owner: bind
group: adm
mode: "0640"
@ -95,7 +95,7 @@
notify: restart bind
when: bind_chroot_set
- name: logrotate for non chroot bind
- name: logrotate for bind
template:
src: logrotate_bind
dest: /etc/logrotate.d/bind9
@ -104,17 +104,5 @@
mode: "0644"
force: yes
notify: restart bind
when: not bind_chroot_set
- name: logrotate for chroot bind
template:
src: logrotate_bind_chroot.j2
dest: /etc/logrotate.d/bind9
owner: root
group: root
mode: "0644"
force: yes
notify: restart bind
when: bind_chroot_set
- include: munin.yml

View File

@ -1,4 +1,8 @@
/var/log/bind.log {
{% if bind_chroot_set %}
{{ bind_chroot_path }}{{bind_log_file}} {
{% else %}
{{bind_log_file}} {
{% endif %}
weekly
missingok
rotate 52

View File

@ -1,10 +0,0 @@
{{ bind_chroot_path }}/var/log/bind.log {
weekly
missingok
rotate 52
create 640 bind bind
sharedscripts
postrotate
rndc reload > /dev/null
endscript
}

View File

@ -1,8 +1,9 @@
[bind*]
user root
env.logfile {{ bind_query_file }}
env.logfile {% if bind_chroot_set %}{{ bind_chroot_path }}{% endif %}{{ bind_query_file }}
{% if bind_authoritative_server %}
env.querystats {{ bind_chroot_path }}{{ bind_statistics_file }}
env.querystats {% if bind_chroot_set %}{{ bind_chroot_path }}{% endif %}{{ bind_statistics_file }}
{% endif %}
env.MUNIN_PLUGSTATE /var/lib/munin
timeout 120