Fix getting nameserver and search for /etc/resolv.conf with comments (#5197)

This commit is contained in:
Erwan Miran 2019-10-16 13:27:40 +02:00 committed by Kubernetes Prow Robot
parent d1b1add176
commit 9d8fc8caad

View file

@ -29,13 +29,13 @@
docker_dns_search_domains: "{{ docker_dns_search_domains + searchdomains|default([]) }}" docker_dns_search_domains: "{{ docker_dns_search_domains + searchdomains|default([]) }}"
- name: check system nameservers - 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 changed_when: False
register: system_nameservers register: system_nameservers
check_mode: no check_mode: no
- name: check system search domains - 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 changed_when: False
register: system_search_domains register: system_search_domains
check_mode: no check_mode: no