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.pull/410/head
parent
cf502735e9
commit
0fa90ec9e8
|
@ -59,13 +59,14 @@
|
||||||
|
|
||||||
|
|
||||||
- name: check resolvconf
|
- name: check resolvconf
|
||||||
stat: path=/etc/resolvconf/resolv.conf.d/head
|
shell: which resolvconf
|
||||||
register: resolvconf
|
register: resolvconf
|
||||||
|
ignore_errors: yes
|
||||||
|
|
||||||
- name: target resolv.conf file
|
- name: target resolv.conf file
|
||||||
set_fact:
|
set_fact:
|
||||||
resolvconffile: >-
|
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
|
- name: Add search resolv.conf
|
||||||
lineinfile:
|
lineinfile:
|
||||||
|
@ -109,6 +110,6 @@
|
||||||
- name: update resolvconf
|
- name: update resolvconf
|
||||||
command: resolvconf -u
|
command: resolvconf -u
|
||||||
changed_when: False
|
changed_when: False
|
||||||
when: resolvconf.stat.exists == True
|
when: resolvconf.rc == 0
|
||||||
|
|
||||||
- meta: flush_handlers
|
- meta: flush_handlers
|
||||||
|
|
Loading…
Reference in New Issue