ansible-dhcpd/templates/etc/dhcp/auto_options.j2

31 lines
1.0 KiB
Plaintext
Raw Normal View History

{% if dhcpd_domain_name|d() and dhcpd_domain_name %}
2015-03-29 21:36:16 +00:00
{% set dhcpd_tpl_domain_search = [ dhcpd_domain_name ] + dhcpd_domain_search|d([]) %}
option domain-name "{{ dhcpd_domain_name }}";
2015-03-29 21:36:16 +00:00
option domain-search "{{ dhcpd_tpl_domain_search | join('", "') }}";
option dhcp6.domain-search "{{ dhcpd_tpl_domain_search | join('", "') }}";
{% endif %}
{% if dhcpd_nameservers|d() and dhcpd_nameservers %}
{% set dhcpd_tpl_nameservers = dhcpd_nameservers %}
{% elif dhcpd_runtime_nameservers|d() and dhcpd_runtime_nameservers %}
{% set dhcpd_tpl_nameservers = [] %}
{% for server in dhcpd_runtime_nameservers %}
{% if server not in [ '127.0.0.1', '::1' ] %}
{% set _ = dhcpd_tpl_nameservers.append(server) %}
{% endif %}
{% endfor %}
{% endif %}
{% if dhcpd_tpl_nameservers %}
{% if dhcpd_tpl_nameservers | ipv4 %}
option domain-name-servers {{ dhcpd_tpl_nameservers | ipv4 | join(", ") }};
{% endif %}
{% if dhcpd_tpl_nameservers | ipv6 %}
option dhcp6.name-servers {{ dhcpd_tpl_nameservers | ipv6 | join(", ") }};
{% endif %}
{% endif %}
{#
vim: ft=dhcpd
#}