From a4d0f051b6a753ae943b66ef6e6eadc83a805570 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoha=C3=AF-Eliel=20BERREBY?= Date: Fri, 8 May 2020 16:44:08 +0200 Subject: [PATCH] dhcp: restart server on config update --- roles/isc-dhcp-server/handlers/main.yml | 4 ++++ roles/isc-dhcp-server/tasks/main.yml | 4 ++++ roles/isc-dhcp-server/templates/dhcp/dhcpd.conf.j2 | 2 -- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 roles/isc-dhcp-server/handlers/main.yml diff --git a/roles/isc-dhcp-server/handlers/main.yml b/roles/isc-dhcp-server/handlers/main.yml new file mode 100644 index 0000000..2df3eac --- /dev/null +++ b/roles/isc-dhcp-server/handlers/main.yml @@ -0,0 +1,4 @@ +- name: restart dhcpd + systemd: + state: restarted + name: isc-dhcp-server diff --git a/roles/isc-dhcp-server/tasks/main.yml b/roles/isc-dhcp-server/tasks/main.yml index 4d6ef54..13ba3b7 100644 --- a/roles/isc-dhcp-server/tasks/main.yml +++ b/roles/isc-dhcp-server/tasks/main.yml @@ -7,6 +7,7 @@ register: apt_result retries: 3 until: apt_result is succeeded + notify: restart dhcpd - name: Ensure dhcp log directory exists file: @@ -50,6 +51,7 @@ src: default/isc-dhcp-server.j2 dest: /etc/default/isc-dhcp-server mode: 0644 + notify: restart dhcpd - name: Configure dhcp-failover.conf template: @@ -57,9 +59,11 @@ dest: /etc/dhcp/dhcp-failover.conf mode: 0600 when: dhcp_failover is defined + notify: restart dhcpd - name: Configure dhcpd.conf template: src: dhcp/dhcpd.conf.j2 dest: /etc/dhcp/dhcpd.conf mode: 0600 + notify: restart dhcpd diff --git a/roles/isc-dhcp-server/templates/dhcp/dhcpd.conf.j2 b/roles/isc-dhcp-server/templates/dhcp/dhcpd.conf.j2 index bad8558..f4150e7 100644 --- a/roles/isc-dhcp-server/templates/dhcp/dhcpd.conf.j2 +++ b/roles/isc-dhcp-server/templates/dhcp/dhcpd.conf.j2 @@ -1,5 +1,3 @@ -# {{ ansible_managed }} - default-lease-time 86400; max-lease-time 86400;