From 7347829494ee0e4d1d80dd09db3321fbb9928ee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoha=C3=AF-Eliel=20BERREBY?= Date: Mon, 6 Apr 2020 17:42:54 +0200 Subject: [PATCH] tackle logs --- roles/isc-dhcp-server/tasks/main.yml | 14 +++++++++++++- roles/isc-dhcp-server/templates/dhcp/dhcpd.conf.j2 | 5 +---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/roles/isc-dhcp-server/tasks/main.yml b/roles/isc-dhcp-server/tasks/main.yml index 171d782..269843e 100644 --- a/roles/isc-dhcp-server/tasks/main.yml +++ b/roles/isc-dhcp-server/tasks/main.yml @@ -8,6 +8,19 @@ retries: 3 until: apt_result is succeeded +- name: Ensure dhcp log directory exists + file: + path: /var/log/dhcp + owner: root + group: root + mode: u=rwx,g=rx,a=rx + state: directory + +- name: Ensute rsyslog knows where to send dhcp logs + lineinfile: + path: /etc/rsyslog.conf + regexp: '^local7[.][*]' + line: "local7.* /var/log/dhcp/dhcpd.log" - name: Configure /etc/default/isc-dhcp-server template: @@ -15,7 +28,6 @@ dest: /etc/default/isc-dhcp-server mode: 0644 - - name: Configure dhcp-failover.conf template: src: dhcp/dhcp-failover.conf.j2 diff --git a/roles/isc-dhcp-server/templates/dhcp/dhcpd.conf.j2 b/roles/isc-dhcp-server/templates/dhcp/dhcpd.conf.j2 index 01b0a8d..9b166c2 100644 --- a/roles/isc-dhcp-server/templates/dhcp/dhcpd.conf.j2 +++ b/roles/isc-dhcp-server/templates/dhcp/dhcpd.conf.j2 @@ -22,10 +22,7 @@ ddns-update-style none; # network, the authoritative directive should be uncommented. authoritative; -# Use this to send dhcp log messages to a different log file (you also -# have to hack syslog.conf to complete the redirection). -# XXX: This was enabled in one building and disabled in another. -#log-facility local7; +log-facility local7; # TODO: move this failover peer declaration to a separate file and include it.