Configure /etc/network/interfaces and /etc/resolv.conf using Ansible #98
2 changed files with 20 additions and 0 deletions
9
roles/resolvconf/tasks/main.yml
Normal file
9
roles/resolvconf/tasks/main.yml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
- name: Install resolv.conf
|
||||||
|
template:
|
||||||
|
src: resolv.conf.j2
|
||||||
|
dest: /etc/resolv.conf
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: u=rw,g=r,o=r
|
||||||
|
...
|
11
roles/resolvconf/templates/resolv.conf.j2
Normal file
11
roles/resolvconf/templates/resolv.conf.j2
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{{ ansible_managed | comment }}
|
||||||
|
|
||||||
|
{% for nameserver in resolvconf__nameservers %}
|
||||||
|
nameserver {{ nameserver | ipaddr }}
|
||||||
|
{% endfor %}
|
||||||
|
{% if resolvconf__domain is defined %}
|
||||||
|
domain {{ resolvconf__domain }}
|
||||||
|
{% endif %}
|
||||||
|
{% if resolvconf__search is defined %}
|
||||||
|
search {{ resolvconf__search | join(" ") }}
|
||||||
|
{% endif %}
|
Loading…
Reference in a new issue