From 1dce56e2f87eee56d39a335637d337cd88caaa6a Mon Sep 17 00:00:00 2001 From: Matthew Mosesohn Date: Mon, 9 Jan 2017 15:46:05 +0300 Subject: [PATCH] Fix docker dns host scenario with no search domains Fixes scenario where docker-dns.conf tries to create an empty search entry --- roles/docker/tasks/set_facts_dns.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/docker/tasks/set_facts_dns.yml b/roles/docker/tasks/set_facts_dns.yml index 647d29829..03cd987d7 100644 --- a/roles/docker/tasks/set_facts_dns.yml +++ b/roles/docker/tasks/set_facts_dns.yml @@ -40,13 +40,13 @@ - name: add system nameservers to docker options set_fact: - docker_dns_servers: "{{ docker_dns_servers + [item] }}" - with_items: "{{ system_nameservers.stdout_lines|default([]) }}" + docker_dns_servers: "{{ docker_dns_servers | union(system_nameservers.stdout_lines) | unique }}" + when: system_nameservers.stdout != "" - name: add system search domains to docker options set_fact: - docker_dns_search_domains: "{{ docker_dns_search_domains + [item] }}" - with_items: "{{ system_search_domains.stdout.split(' ') }}" + docker_dns_search_domains: "{{ docker_dns_search_domains | union(system_search_domains.stdout.split(' ')|default([])) | unique }}" + when: system_search_domains.stdout != "" - name: check number of nameservers fail: msg="Too many nameservers"