]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
dhcp-server: Support defining nameservers by host or group var 402/head
authorDavid Galloway <dgallowa@redhat.com>
Mon, 23 Jul 2018 13:47:25 +0000 (09:47 -0400)
committerDavid Galloway <dgallowa@redhat.com>
Mon, 23 Jul 2018 13:47:25 +0000 (09:47 -0400)
Signed-off-by: David Galloway <dgallowa@redhat.com>
roles/dhcp-server/README.rst
roles/dhcp-server/templates/dhcpd.subnet.conf.j2

index 251dfbe0c3d8c9f9fb1ee01eb5edd74a4e4258b8..4335502b4b951a7113e9ad146ef863b0f1adf3ff 100644 (file)
@@ -87,6 +87,13 @@ This role basically has two required and two optional variables:
 +---------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
 | ``dhcp_filename: "/pxelinux.0"``                                    | Same rules as above.  This is the TFTP filename the DHCP server should instruct DHCP clients to download.                                                                                                                                                        |
 +---------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+|::                                                                   | This can be set at a ``host_var`` or ``group_var`` level in the Ansible inventory.  It will **override** the subnet's ``domain_name_servers`` defined in the ``dhcp_subnets`` dictionary.                                                                        |
+|                                                                     |                                                                                                                                                                                                                                                                  |
+|  domain_name_servers:                                               |                                                                                                                                                                                                                                                                  |
+|    - 1.2.3.4                                                        |                                                                                                                                                                                                                                                                  |
+|    - 5.6.7.8                                                        |                                                                                                                                                                                                                                                                  |
+|                                                                     |                                                                                                                                                                                                                                                                  |
++---------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
 
 .. _docs: https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable
 .. _dhcpd: https://linux.die.net/man/8/dhcpd
index 89816ffd5ca54222a723e882b4cc00b5a66f6a62..f96828c3bbfa0526a0c99a32107b0d3c16d6c46f 100644 (file)
@@ -60,6 +60,9 @@ subnet {{ subnet_item.cidr | ipaddr('network') }} netmask {{ subnet_item.cidr |
     next-server {{ hostvars[host]['dhcp_next_server'] }};
     filename "{{ hostvars[host]['dhcp_filename'] }}";
     {% endif -%}
+    {% if hostvars[host]['domain_name_servers'] is defined -%}
+    option domain-name-servers {{ hostvars[host]['domain_name_servers']|join(', ') }};
+    {% endif -%}
     hardware ethernet {{ hostvars[host][subnet_item.macvar] }};
     fixed-address {{ hostvars[host][subnet_item.ipvar] }};
   }