diff --git a/bind/tasks/main.yml b/bind/tasks/main.yml index dd1ad18d..b7a0f6bd 100644 --- a/bind/tasks/main.yml +++ b/bind/tasks/main.yml @@ -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 diff --git a/bind/templates/logrotate_bind b/bind/templates/logrotate_bind.j2 similarity index 56% rename from bind/templates/logrotate_bind rename to bind/templates/logrotate_bind.j2 index ee53df95..3fe1589e 100644 --- a/bind/templates/logrotate_bind +++ b/bind/templates/logrotate_bind.j2 @@ -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 diff --git a/bind/templates/logrotate_bind_chroot.j2 b/bind/templates/logrotate_bind_chroot.j2 deleted file mode 100644 index 5db5d494..00000000 --- a/bind/templates/logrotate_bind_chroot.j2 +++ /dev/null @@ -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 -} diff --git a/bind/templates/munin-env_bind9.j2 b/bind/templates/munin-env_bind9.j2 index 5783f889..de88b27a 100644 --- a/bind/templates/munin-env_bind9.j2 +++ b/bind/templates/munin-env_bind9.j2 @@ -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