From 67360affffd97b47a341c185f422413830fd671e Mon Sep 17 00:00:00 2001 From: dis Date: Wed, 10 Aug 2016 17:22:33 +0300 Subject: [PATCH] Fix resolvconf executable discovery If resolvconf was installed and then removed, the file /etc/resolvconf/resolv.conf.d/head remains in the filesystem - change discovery of 'resolvconf' executable to check if it can be located with 'which resolvconf' command or not. --- roles/dnsmasq/tasks/main.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/roles/dnsmasq/tasks/main.yml b/roles/dnsmasq/tasks/main.yml index 62fe084af..526e162ae 100644 --- a/roles/dnsmasq/tasks/main.yml +++ b/roles/dnsmasq/tasks/main.yml @@ -59,13 +59,14 @@ - name: check resolvconf - stat: path=/etc/resolvconf/resolv.conf.d/head + shell: which resolvconf register: resolvconf + ignore_errors: yes - name: target resolv.conf file set_fact: resolvconffile: >- - {%- if resolvconf.stat.exists == True -%}/etc/resolvconf/resolv.conf.d/head{%- else -%}/etc/resolv.conf{%- endif -%} + {%- if resolvconf.rc == 0 -%}/etc/resolvconf/resolv.conf.d/head{%- else -%}/etc/resolv.conf{%- endif -%} - name: Add search resolv.conf lineinfile: @@ -109,6 +110,6 @@ - name: update resolvconf command: resolvconf -u changed_when: False - when: resolvconf.stat.exists == True + when: resolvconf.rc == 0 - meta: flush_handlers