From 79d3afccb7d6dadca09d502c58bc97de0d2f728c Mon Sep 17 00:00:00 2001 From: Gavrilov Alexy Date: Fri, 8 Apr 2016 15:03:33 +0500 Subject: [PATCH] fix run --check --- tasks/main.yml | 1 + templates/etc/dhcp/auto_options.j2 | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tasks/main.yml b/tasks/main.yml index 0263826..807ab0e 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -32,6 +32,7 @@ register: dhcpd_register_nameservers changed_when: False when: dhcpd_mode == 'server' + always_run: yes - name: Convert list of nameservers to Ansible list set_fact: diff --git a/templates/etc/dhcp/auto_options.j2 b/templates/etc/dhcp/auto_options.j2 index 7c0a656..d9f0a40 100644 --- a/templates/etc/dhcp/auto_options.j2 +++ b/templates/etc/dhcp/auto_options.j2 @@ -6,10 +6,10 @@ option domain-search "{{ dhcpd_tpl_domain_search | join('", "') }}"; option dhcp6.domain-search "{{ dhcpd_tpl_domain_search | join('", "') }}"; {% endif %} +{% set dhcpd_tpl_nameservers = [] %} {% 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) %}