From 9d8fc8caad61cf1fb1a5ce4570dd8b05f51f56d7 Mon Sep 17 00:00:00 2001 From: Erwan Miran Date: Wed, 16 Oct 2019 13:27:40 +0200 Subject: [PATCH] Fix getting nameserver and search for /etc/resolv.conf with comments (#5197) --- roles/container-engine/docker/tasks/set_facts_dns.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/container-engine/docker/tasks/set_facts_dns.yml b/roles/container-engine/docker/tasks/set_facts_dns.yml index 99b9f0e26..23464dabb 100644 --- a/roles/container-engine/docker/tasks/set_facts_dns.yml +++ b/roles/container-engine/docker/tasks/set_facts_dns.yml @@ -29,13 +29,13 @@ docker_dns_search_domains: "{{ docker_dns_search_domains + searchdomains|default([]) }}" - name: check system nameservers - shell: grep "^nameserver" /etc/resolv.conf | sed 's/^nameserver\s*//' + shell: grep "^nameserver" /etc/resolv.conf | sed -r 's/^nameserver\s*([^#\s]+)\s*(#.*)?/\1/' changed_when: False register: system_nameservers check_mode: no - name: check system search domains - shell: grep "^search" /etc/resolv.conf | sed 's/^search\s*//' + shell: grep "^search" /etc/resolv.conf | sed -r 's/^search\s*([^#]+)\s*(#.*)?/\1/' changed_when: False register: system_search_domains check_mode: no