Skip to content

Commit

Permalink
Run 0100-dhclient-hooks if dhcpclient is enabled (kubernetes-sigs#8658)
Browse files Browse the repository at this point in the history
If running Kubespray on static IP environments, a task was failed like:

  TASK [kubernetes/preinstall : Configure dhclient hooks for resolv.conf (RH-only)]
  fatal: [ak8s2]: FAILED! => {
    "changed": false, "checksum": "..",
    "msg": "Destination directory /etc/dhcp/dhclient.d does not exist"}

This adds a check for dhclientconffile for running 0100-dhclient-hooks to
run the task only if dhcpclient is enabled.
  • Loading branch information
oomichi authored and LuckySB committed Jun 29, 2023
1 parent 2b2465e commit aba1f5f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion roles/kubernetes/preinstall/tasks/0100-dhclient-hooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
marker: "# Ansible entries {mark}"
mode: 0644
notify: Preinstall | propagate resolvconf to k8s components
when: dhclientconffile is defined

- name: Configure dhclient hooks for resolv.conf (non-RH)
template:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@
state: absent
backup: yes
marker: "# Ansible entries {mark}"
when: dhclientconffile is defined
notify: Preinstall | propagate resolvconf to k8s components

- name: Remove kubespray specific dhclient hook
file:
path: "{{ dhclienthookfile }}"
state: absent
when: dhclienthookfile is defined
notify: Preinstall | propagate resolvconf to k8s components
2 changes: 2 additions & 0 deletions roles/kubernetes/preinstall/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
when:
- dns_mode != 'none'
- resolvconf_mode == 'host_resolvconf'
- dhclientconffile is defined
- not ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"]
tags:
- bootstrap-os
Expand All @@ -90,6 +91,7 @@
when:
- dns_mode != 'none'
- resolvconf_mode != 'host_resolvconf'
- dhclientconffile is defined
- not ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"]
tags:
- bootstrap-os
Expand Down

0 comments on commit aba1f5f

Please sign in to comment.