From 13993ef45e21eee7be9361f97e07dacb806dc6a7 Mon Sep 17 00:00:00 2001 From: "Andreas B. Mundt" Date: Sat, 10 Apr 2021 20:59:41 +0200 Subject: [PATCH] Minor fixes for the DHCP and DNS setup. --- roles/dns-dhcp-tftp/handlers/main.yml | 4 ++++ roles/dns-dhcp-tftp/tasks/main.yml | 2 ++ roles/dns-dhcp-tftp/templates/resolv.conf.j2 | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/roles/dns-dhcp-tftp/handlers/main.yml b/roles/dns-dhcp-tftp/handlers/main.yml index 8dec007..1f48f0f 100644 --- a/roles/dns-dhcp-tftp/handlers/main.yml +++ b/roles/dns-dhcp-tftp/handlers/main.yml @@ -9,3 +9,7 @@ - name: restart tftpd-hpa systemd: name=tftpd-hpa state=restarted enabled=yes listen: restart tftpd-hpa + +- name: restart dhcp-client + systemd: name=ifup@{{ if_wan }} state=restarted enabled=yes + listen: restart dhcp-client diff --git a/roles/dns-dhcp-tftp/tasks/main.yml b/roles/dns-dhcp-tftp/tasks/main.yml index 521f8b6..1d4d741 100644 --- a/roles/dns-dhcp-tftp/tasks/main.yml +++ b/roles/dns-dhcp-tftp/tasks/main.yml @@ -66,6 +66,7 @@ template: src: resolv.conf.j2 dest: /etc/resolv.conf + notify: restart isc-dhcp-server ## stop dhclient from overwriting /etc/resolv.conf: - name: supersede dhcp client data @@ -75,6 +76,7 @@ supersede domain-search "{{ ansible_domain }}"; supersede domain-name-servers 127.0.0.1; insertbefore: "#send dhcp-client-identifier.*" + notify: restart dhcp-client - name: generate rndc key command: diff --git a/roles/dns-dhcp-tftp/templates/resolv.conf.j2 b/roles/dns-dhcp-tftp/templates/resolv.conf.j2 index 7118830..36d45af 100644 --- a/roles/dns-dhcp-tftp/templates/resolv.conf.j2 +++ b/roles/dns-dhcp-tftp/templates/resolv.conf.j2 @@ -1,2 +1,2 @@ -search {{ ansible_domain }} +search {{ ansible_domain }}. nameserver 127.0.0.1