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 - restart bind
when: ansible_distribution_release == "jessie" when: ansible_distribution_release == "jessie"
- name: touch /var/log/bind.log if non chroot - name: "touch {{ bind_log_file }} if non chroot"
file: file:
path: /var/log/bind.log path: "{{ bind_log_file }}"
owner: bind owner: bind
group: adm group: adm
mode: "0640" mode: "0640"
state: touch state: touch
when: not bind_chroot_set when: not bind_chroot_set
- name: touch /var/log/bind_queries.log if non chroot - name: "touch {{ bind_query_file }} if non chroot"
file: file:
path: /var/log/bind_queries.log path: "{{ bind_query_file }}"
owner: bind owner: bind
group: adm group: adm
mode: "0640" mode: "0640"
@ -95,7 +95,7 @@
notify: restart bind notify: restart bind
when: bind_chroot_set when: bind_chroot_set
- name: logrotate for non chroot bind - name: logrotate for bind
template: template:
src: logrotate_bind src: logrotate_bind
dest: /etc/logrotate.d/bind9 dest: /etc/logrotate.d/bind9
@ -104,17 +104,5 @@
mode: "0644" mode: "0644"
force: yes force: yes
notify: restart bind 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 - 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 weekly
missingok missingok
rotate 52 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*] [bind*]
user root user root
env.logfile {{ bind_query_file }}
env.logfile {% if bind_chroot_set %}{{ bind_chroot_path }}{% endif %}{{ bind_query_file }}
{% if bind_authoritative_server %} {% 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 %} {% endif %}
env.MUNIN_PLUGSTATE /var/lib/munin env.MUNIN_PLUGSTATE /var/lib/munin
timeout 120 timeout 120