From d240073f65583ff894b046a23200471ee4269c07 Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya Date: Mon, 29 Aug 2016 16:39:55 +0200 Subject: [PATCH] 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 --- roles/dnsmasq/handlers/main.yml | 13 ++++++++++++- roles/dnsmasq/tasks/main.yml | 8 +------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/roles/dnsmasq/handlers/main.yml b/roles/dnsmasq/handlers/main.yml index 95cd80cfc..5e24890e7 100644 --- a/roles/dnsmasq/handlers/main.yml +++ b/roles/dnsmasq/handlers/main.yml @@ -1,4 +1,11 @@ - name: Dnsmasq | restart network + command: /bin/true + notify: + - Dnsmasq | reload network + - Dnsmasq | update resolvconf + when: ansible_os_family != "CoreOS" + +- name: Dnsmasq | reload network service: name: >- {% if ansible_os_family == "RedHat" -%} @@ -7,4 +14,8 @@ networking {%- endif %} 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 diff --git a/roles/dnsmasq/tasks/main.yml b/roles/dnsmasq/tasks/main.yml index 194214684..f98afd6bd 100644 --- a/roles/dnsmasq/tasks/main.yml +++ b/roles/dnsmasq/tasks/main.yml @@ -127,11 +127,5 @@ - name: disable resolv.conf modification by dhclient copy: src=dhclient_nodnsupdate dest=/etc/dhcp/dhclient.d/nodnsupdate mode=u+x + notify: Dnsmasq | restart network when: ansible_os_family == "RedHat" - -- name: update resolvconf - command: resolvconf -u - changed_when: False - when: resolvconf.rc == 0 - -- meta: flush_handlers