Improve management of nameservers in resolv.conf
Changing nameservers now will clean up previous entries
This commit is contained in:
parent
1909f98350
commit
abb56c21a7
1 changed files with 7 additions and 4 deletions
|
@ -86,14 +86,17 @@
|
|||
follow: yes
|
||||
|
||||
- name: Add local dnsmasq to resolv.conf
|
||||
lineinfile:
|
||||
line: "nameserver {{item}}"
|
||||
blockinfile:
|
||||
dest: "{{resolvconffile}}"
|
||||
block: |-
|
||||
{% for item in nameserverentries -%}
|
||||
nameserver {{ item }}
|
||||
{% endfor %}
|
||||
state: present
|
||||
insertafter: "^search.*$"
|
||||
create: yes
|
||||
backup: yes
|
||||
follow: yes
|
||||
with_items: "{{nameserverentries}}"
|
||||
marker: "# Ansible nameservers {mark}"
|
||||
|
||||
- name: Add options to resolv.conf
|
||||
lineinfile:
|
||||
|
|
Loading…
Reference in a new issue