From bf703354936a1570555c6b2f4de72b9893d720fa Mon Sep 17 00:00:00 2001 From: Ekko <92532497+0ekk@users.noreply.github.com> Date: Thu, 19 Dec 2024 18:32:09 +0800 Subject: [PATCH] Add iproute(2) package checking (#11816) Signed-off-by: ekko --- roles/bootstrap-os/tasks/amzn.yml | 11 +++++++++++ roles/bootstrap-os/tasks/centos.yml | 11 +++++++++++ roles/bootstrap-os/tasks/clear-linux-os.yml | 11 +++++++++++ roles/bootstrap-os/tasks/debian.yml | 11 +++++++++++ roles/bootstrap-os/tasks/fedora.yml | 11 +++++++++++ roles/bootstrap-os/tasks/opensuse.yml | 12 ++++++++++++ roles/bootstrap-os/tasks/rhel.yml | 11 +++++++++++ 7 files changed, 78 insertions(+) diff --git a/roles/bootstrap-os/tasks/amzn.yml b/roles/bootstrap-os/tasks/amzn.yml index 8a473a07f..27121214a 100644 --- a/roles/bootstrap-os/tasks/amzn.yml +++ b/roles/bootstrap-os/tasks/amzn.yml @@ -14,3 +14,14 @@ enabled: true repo_gpgcheck: false when: epel_enabled + +# iproute is required for networking related facts gathering +# See https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_vars_facts.html#package-requirements-for-fact-gathering +# Note: It is not recommended way, but since the tasks execution order, put it here is the simplest way so far. We can move it to a proper place later. +# TODO: move this to roles/kubernetes/preinstall/vars/main.yml -> pkgs variables +# Currently not possible because the collect the network facts before that step, needs reordering of the exec flow. +- name: Ensure iproute is installed + package: + name: iproute + state: present + become: true diff --git a/roles/bootstrap-os/tasks/centos.yml b/roles/bootstrap-os/tasks/centos.yml index 93816ff2f..cab18da4a 100644 --- a/roles/bootstrap-os/tasks/centos.yml +++ b/roles/bootstrap-os/tasks/centos.yml @@ -116,3 +116,14 @@ name: "{{ ((ansible_distribution_major_version | int) < 8) | ternary('libselinux-python', 'python3-libselinux') }}" state: present become: true + +# iproute is required for networking related facts gathering +# See https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_vars_facts.html#package-requirements-for-fact-gathering +# Note: It is not recommended way, but since the tasks execution order, put it here is the simplest way so far. We can move it to a proper place later. +# TODO: move this to roles/kubernetes/preinstall/vars/main.yml -> pkgs variables +# Currently not possible because the collect the network facts before that step, needs reordering of the exec flow. +- name: Ensure iproute is installed + package: + name: iproute + state: present + become: true diff --git a/roles/bootstrap-os/tasks/clear-linux-os.yml b/roles/bootstrap-os/tasks/clear-linux-os.yml index 2e41eaa01..ec87bb2f4 100644 --- a/roles/bootstrap-os/tasks/clear-linux-os.yml +++ b/roles/bootstrap-os/tasks/clear-linux-os.yml @@ -14,3 +14,14 @@ daemon_reload: true state: started become: true + +# iproute2 is required for networking related facts gathering +# See https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_vars_facts.html#package-requirements-for-fact-gathering +# Note: It is not recommended way, but since the tasks execution order, put it here is the simplest way so far. We can move it to a proper place later. +# TODO: move this to roles/kubernetes/preinstall/vars/main.yml -> pkgs variables +# Currently not possible because the collect the network facts before that step, needs reordering of the exec flow. +- name: Ensure iproute2 is installed + package: + name: iproute2 + state: present + become: true diff --git a/roles/bootstrap-os/tasks/debian.yml b/roles/bootstrap-os/tasks/debian.yml index 9b18baa06..fb3202a95 100644 --- a/roles/bootstrap-os/tasks/debian.yml +++ b/roles/bootstrap-os/tasks/debian.yml @@ -62,3 +62,14 @@ - '"changed its" in bootstrap_update_apt_result.stdout' - '"value from" in bootstrap_update_apt_result.stdout' ignore_errors: true + +# iproute2 is required for networking related facts gathering +# See https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_vars_facts.html#package-requirements-for-fact-gathering +# Note: It is not recommended way, but since the tasks execution order, put it here is the simplest way so far. We can move it to a proper place later. +# TODO: move this to roles/kubernetes/preinstall/vars/main.yml -> pkgs variables +# Currently not possible because the collect the network facts before that step, needs reordering of the exec flow. +- name: Ensure iproute2 is installed + package: + name: iproute2 + state: present + become: true diff --git a/roles/bootstrap-os/tasks/fedora.yml b/roles/bootstrap-os/tasks/fedora.yml index d4a43c314..a26280077 100644 --- a/roles/bootstrap-os/tasks/fedora.yml +++ b/roles/bootstrap-os/tasks/fedora.yml @@ -28,3 +28,14 @@ become: true when: - need_bootstrap.rc != 0 + +# iproute is required for networking related facts gathering +# See https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_vars_facts.html#package-requirements-for-fact-gathering +# Note: It is not recommended way, but since the tasks execution order, put it here is the simplest way so far. We can move it to a proper place later. +# TODO: move this to roles/kubernetes/preinstall/vars/main.yml -> pkgs variables +# Currently not possible because the collect the network facts before that step, needs reordering of the exec flow. +- name: Ensure iproute is installed + package: + name: iproute + state: present + become: true diff --git a/roles/bootstrap-os/tasks/opensuse.yml b/roles/bootstrap-os/tasks/opensuse.yml index 5a4f9dead..f0de009e8 100644 --- a/roles/bootstrap-os/tasks/opensuse.yml +++ b/roles/bootstrap-os/tasks/opensuse.yml @@ -83,3 +83,15 @@ - apparmor-parser state: present become: true + +# iproute2 is required for networking related facts gathering +# See https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_vars_facts.html#package-requirements-for-fact-gathering +# Note: It is not recommended way, but since the tasks execution order, put it here is the simplest way so far. We can move it to a proper place later. +# TODO: move this to roles/kubernetes/preinstall/vars/main.yml -> pkgs variables +# Currently not possible because the collect the network facts before that step, needs reordering of the exec flow. +- name: Ensure iproute2 is installed + community.general.zypper: + name: iproute2 + state: present + update_cache: true + become: true diff --git a/roles/bootstrap-os/tasks/rhel.yml b/roles/bootstrap-os/tasks/rhel.yml index 2bf508d9b..2c8bef62e 100644 --- a/roles/bootstrap-os/tasks/rhel.yml +++ b/roles/bootstrap-os/tasks/rhel.yml @@ -100,3 +100,14 @@ name: "{{ ((ansible_distribution_major_version | int) < 8) | ternary('libselinux-python', 'python3-libselinux') }}" state: present become: true + +# iproute is required for networking related facts gathering +# See https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_vars_facts.html#package-requirements-for-fact-gathering +# Note: It is not recommended way, but since the tasks execution order, put it here is the simplest way so far. We can move it to a proper place later. +# TODO: move this to roles/kubernetes/preinstall/vars/main.yml -> pkgs variables +# Currently not possible because the collect the network facts before that step, needs reordering of the exec flow. +- name: Ensure iproute is installed + package: + name: iproute + state: present + become: true