getting rid of resolvconf and managing /etc/resolv.conf directly
This commit is contained in:
@@ -16,6 +16,7 @@ common_locales_default:
|
|||||||
common_ntp: True
|
common_ntp: True
|
||||||
|
|
||||||
common_resolvconf: True
|
common_resolvconf: True
|
||||||
|
common_resolvconf_remove_resolvconf: True
|
||||||
common_resolvconf_hnfqdn: true
|
common_resolvconf_hnfqdn: true
|
||||||
common_resolvconf_nameservers: []
|
common_resolvconf_nameservers: []
|
||||||
common_resolvconf_domain: ""
|
common_resolvconf_domain: ""
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
---
|
---
|
||||||
|
- name: resolvconf - remove
|
||||||
|
apt: name=resolvconf state=absent
|
||||||
|
when: common_resolvconf_remove_resolvconf
|
||||||
|
|
||||||
- name: resolvconf - install
|
- name: /etc/resolv.conf
|
||||||
apt: name=resolvconf state=present
|
template:
|
||||||
|
dest: /etc/resolv.conf
|
||||||
- name: resolvconf - tail file
|
src: resolv.conf.j2
|
||||||
template: dest=/etc/resolvconf/resolv.conf.d/tail src=resolvconf_tail.j2 owner=root group=root mode=0644
|
owner: root
|
||||||
when: common_resolvconf_nameservers
|
group: root
|
||||||
notify: restart resolvconf
|
mode: 0644
|
||||||
|
when: common_resolvconf_remove_resolvconf
|
||||||
- name: resolvconf - start and enable
|
|
||||||
service: name=resolvconf state=started enabled=yes
|
|
||||||
|
|||||||
14
templates/resolv.conf.j2
Normal file
14
templates/resolv.conf.j2
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
|
{% if common_resolvconf_domain -%}
|
||||||
|
domain {{ common_resolvconf_domain }}
|
||||||
|
{% endif %}
|
||||||
|
{% if ansible_local is defined and ansible_local.hardwarenode.hnfqdn and common_resolvconf_hnfqdn -%}
|
||||||
|
nameserver {{ lookup('dig', ansible_local.hardwarenode.hnfqdn ) }}
|
||||||
|
{% endif %}
|
||||||
|
{% for nameserver in common_resolvconf_nameservers -%}
|
||||||
|
nameserver {{ nameserver }}
|
||||||
|
{% endfor %}
|
||||||
|
{% if common_resolvconf_search -%}
|
||||||
|
search {% for name in common_resolvconf_search %}{{ name }} {% endfor %}
|
||||||
|
{% endif %}
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
# {{ ansible_managed }}
|
|
||||||
|
|
||||||
{% if common_resolvconf_domain %}
|
|
||||||
domain {{ common_resolvconf_domain }}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if ansible_local is defined and ansible_local.hardwarenode.hnfqdn and common_resolvconf_hnfqdn %}
|
|
||||||
nameserver {{ lookup('dig', ansible_local.hardwarenode.hnfqdn ) }}
|
|
||||||
{% else %}
|
|
||||||
{% for n in common_resolvconf_nameservers %}
|
|
||||||
nameserver {{ n }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if common_resolvconf_search %}
|
|
||||||
search {% for s in common_resolvconf_search %}{{ s }} {% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
Reference in New Issue
Block a user