make sure dhclient does not give us another DNS server
authorRalf Jung <post@ralfj.de>
Mon, 16 Apr 2018 17:39:54 +0000 (19:39 +0200)
committerRalf Jung <post@ralfj.de>
Mon, 16 Apr 2018 17:39:54 +0000 (19:39 +0200)
roles/postfix/files/unbound/dhclient.conf [new file with mode: 0644]
roles/postfix/tasks/unbound.yml

diff --git a/roles/postfix/files/unbound/dhclient.conf b/roles/postfix/files/unbound/dhclient.conf
new file mode 100644 (file)
index 0000000..c1ecef0
--- /dev/null
@@ -0,0 +1,34 @@
+# Configuration file for /sbin/dhclient.
+#
+# This is a sample configuration file for dhclient. See dhclient.conf's
+#      man page for more information about the syntax of this file
+#      and a more comprehensive list of the parameters understood by
+#      dhclient.
+#
+# Normally, if the DHCP server provides reasonable information and does
+#      not leave anything out (like the domain name, for example), then
+#      few changes must be made to this file, if any.
+#
+
+option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
+
+send host-name = gethostname();
+request subnet-mask, broadcast-address, time-offset, routers,
+#      domain-name, domain-name-servers, domain-search, host-name,
+       dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn, dhcp6.sntp-servers,
+       netbios-name-servers, netbios-scope, interface-mtu,
+       rfc3442-classless-static-routes, ntp-servers;
+
+#send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
+#send dhcp-lease-time 3600;
+#supersede domain-name "fugue.com home.vix.com";
+#prepend domain-name-servers 127.0.0.1;
+#require subnet-mask, domain-name-servers;
+#timeout 60;
+#retry 60;
+#reboot 10;
+#select-timeout 5;
+#initial-interval 2;
+#script "/sbin/dhclient-script";
+#media "-link0 -link1 -link2", "link0 link1";
+#reject 192.33.137.209;
index 2a91a80186a3e0887c9d8a238ffe3d7e7f2a7567..34fbe81241d5fa813ea45c8394ee2b16fd1f7f34 100644 (file)
   # not a handler to make sure it succeeds before we go touch system DNS
   when: unbound_config.changed
   service: name=unbound state=restarted enabled=yes
   # not a handler to make sure it succeeds before we go touch system DNS
   when: unbound_config.changed
   service: name=unbound state=restarted enabled=yes
+# use as system DNS
+- name: detect DHCP client
+  stat: path=/etc/dhcp/dhclient.conf
+  register: dhclient
+- name: configure DHCP
+  when: dhclient.stat.exists == True
+  copy:
+    dest: /etc/dhcp/dhclient.conf
+    src: files/unbound/dhclient.conf
 - name: configure system DNS
   copy:
     dest: /etc/resolv.conf
 - name: configure system DNS
   copy:
     dest: /etc/resolv.conf