This continues the DHCP hook checks. Also protect the create side
if the system doesn't have any config files at all.
This commit is contained in:
parent
82619b99ba
commit
0037d0e6b2
3 changed files with 7 additions and 6 deletions
|
@ -3,10 +3,6 @@
|
||||||
# These tasks will undo changes done by kargo in the past if needed (e.g. when upgrading from kargo 2.0.x
|
# These tasks will undo changes done by kargo in the past if needed (e.g. when upgrading from kargo 2.0.x
|
||||||
# or when changing resolvconf_mode)
|
# or when changing resolvconf_mode)
|
||||||
|
|
||||||
- name: Check if dhclient conf file exists
|
|
||||||
stat: path={{dhclientconffile}}
|
|
||||||
register: dhclientconf_check
|
|
||||||
|
|
||||||
- name: Remove kargo specific config from dhclient config
|
- name: Remove kargo specific config from dhclient config
|
||||||
blockinfile:
|
blockinfile:
|
||||||
dest: "{{dhclientconffile}}"
|
dest: "{{dhclientconffile}}"
|
||||||
|
@ -14,7 +10,7 @@
|
||||||
backup: yes
|
backup: yes
|
||||||
follow: yes
|
follow: yes
|
||||||
marker: "# Ansible entries {mark}"
|
marker: "# Ansible entries {mark}"
|
||||||
when: dhclientconf_check.stat.exists
|
when: dhclientconffile is defined
|
||||||
notify: Preinstall | restart network
|
notify: Preinstall | restart network
|
||||||
|
|
||||||
- name: Remove kargo specific dhclient hook
|
- name: Remove kargo specific dhclient hook
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
follow: yes
|
follow: yes
|
||||||
marker: "# Ansible entries {mark}"
|
marker: "# Ansible entries {mark}"
|
||||||
notify: Preinstall | restart network
|
notify: Preinstall | restart network
|
||||||
|
when: dhclientconffile is defined
|
||||||
|
|
||||||
- name: Configue dhclient hooks for resolv.conf (non-RH)
|
- name: Configue dhclient hooks for resolv.conf (non-RH)
|
||||||
template:
|
template:
|
||||||
|
|
|
@ -50,10 +50,14 @@
|
||||||
dhclientconffile: /etc/dhclient.conf
|
dhclientconffile: /etc/dhclient.conf
|
||||||
when: dhclient_stat.stat.exists
|
when: dhclient_stat.stat.exists
|
||||||
|
|
||||||
|
- name: check if /etc/dhcp/dhclient.conf exists
|
||||||
|
stat: path=/etc/dhcp/dhclient.conf
|
||||||
|
register: dhcp_dhclient_stat
|
||||||
|
|
||||||
- name: target dhclient conf file for /etc/dhcp/dhclient.conf
|
- name: target dhclient conf file for /etc/dhcp/dhclient.conf
|
||||||
set_fact:
|
set_fact:
|
||||||
dhclientconffile: /etc/dhcp/dhclient.conf
|
dhclientconffile: /etc/dhcp/dhclient.conf
|
||||||
when: not dhclient_stat.stat.exists
|
when: dhcp_dhclient_stat.stat.exists
|
||||||
|
|
||||||
- name: target dhclient hook file for Red Hat family
|
- name: target dhclient hook file for Red Hat family
|
||||||
set_fact:
|
set_fact:
|
||||||
|
|
Loading…
Reference in a new issue