Browse Source

[2.18] Run 0100-dhclient-hooks if dhcpclient is enabled (#8658) (#8661)

* Run 0100-dhclient-hooks if dhcpclient is enabled (#8658)

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.

* Remove centos7 molecule while opensuse mirror is flaky

Co-authored-by: Florian Ruynat <16313165+floryut@users.noreply.github.com>
pull/8681/head
Kenichi Omichi 3 years ago
committed by GitHub
parent
commit
f091b1cfd7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 2 additions and 9 deletions
  1. 6
      roles/container-engine/cri-o/molecule/default/molecule.yml
  2. 1
      roles/kubernetes/preinstall/tasks/0100-dhclient-hooks.yml
  3. 2
      roles/kubernetes/preinstall/tasks/0110-dhclient-hooks-undo.yml
  4. 2
      roles/kubernetes/preinstall/tasks/main.yml

6
roles/container-engine/cri-o/molecule/default/molecule.yml

@ -13,12 +13,6 @@ platforms:
memory: 1024
groups:
- kube_control_plane
- name: centos7
box: centos/7
cpus: 2
memory: 1024
groups:
- kube_control_plane
- name: almalinux8
box: almalinux/8
cpus: 2

1
roles/kubernetes/preinstall/tasks/0100-dhclient-hooks.yml

@ -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:

2
roles/kubernetes/preinstall/tasks/0110-dhclient-hooks-undo.yml

@ -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
roles/kubernetes/preinstall/tasks/main.yml

@ -75,6 +75,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
@ -84,6 +85,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

Loading…
Cancel
Save