Fix updating resolvconf

Move updating resolvconf to the network restart handler to
ensure changes applied to the /etc/resolv.conf.

Signed-off-by: Bogdan Dobrelya <bdobrelia@mirantis.com>
This commit is contained in:
Bogdan Dobrelya 2016-08-29 16:39:55 +02:00
parent 69f09e0f18
commit d240073f65
2 changed files with 13 additions and 8 deletions

View file

@ -1,4 +1,11 @@
- name: Dnsmasq | restart network - name: Dnsmasq | restart network
command: /bin/true
notify:
- Dnsmasq | reload network
- Dnsmasq | update resolvconf
when: ansible_os_family != "CoreOS"
- name: Dnsmasq | reload network
service: service:
name: >- name: >-
{% if ansible_os_family == "RedHat" -%} {% if ansible_os_family == "RedHat" -%}
@ -7,4 +14,8 @@
networking networking
{%- endif %} {%- endif %}
state: restarted state: restarted
when: ansible_os_family != "CoreOS" when: ansible_os_family != "RedHat" and ansible_os_family != "CoreOS"
- name: Dnsmasq | update resolvconf
command: /sbin/resolvconf -u
ignore_errors: true

View file

@ -127,11 +127,5 @@
- name: disable resolv.conf modification by dhclient - name: disable resolv.conf modification by dhclient
copy: src=dhclient_nodnsupdate dest=/etc/dhcp/dhclient.d/nodnsupdate mode=u+x copy: src=dhclient_nodnsupdate dest=/etc/dhcp/dhclient.d/nodnsupdate mode=u+x
notify: Dnsmasq | restart network
when: ansible_os_family == "RedHat" when: ansible_os_family == "RedHat"
- name: update resolvconf
command: resolvconf -u
changed_when: False
when: resolvconf.rc == 0
- meta: flush_handlers