Files
kubespray/roles/system_packages/tasks/main.yml
ChengHao Yang 6965d8ded9 Support Fedora 41 (#12138)
* Add Fedora 41 CI support

Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>

* Docs: add fedora41 support

Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>

* Add Fedora 41 local vagrant test

Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>

* Fix: Fedora 41+ need python3-libdnf5 for package management

Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>

---------

Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>
2026-02-11 08:26:01 +05:30

66 lines
2.0 KiB
YAML

---
- name: Gather OS information
setup:
gather_subset:
- distribution
- pkg_mgr
- name: Update package management cache (zypper) - SUSE
command: zypper -n --gpg-auto-import-keys ref
register: make_cache_output
until: make_cache_output is succeeded
retries: 4
delay: "{{ retry_stagger | random + 3 }}"
when:
- ansible_pkg_mgr == 'zypper'
tags: bootstrap_os
- name: Remove legacy docker repo file
file:
path: "{{ yum_repo_dir }}/docker.repo"
state: absent
when:
- ansible_os_family == "RedHat"
- not is_fedora_coreos
- name: Install epel-release on RHEL derivatives
package:
name: epel-release
state: present
when:
- ansible_os_family == "RedHat"
- not is_fedora_coreos
- epel_enabled | bool
tags:
- bootstrap_os
# Remove this after ansible-core >= 2.19.0
# See https://github.com/kubernetes-sigs/kubespray/pull/12138#issuecomment-3019304574
- name: Install python3-libdnf5 on Fedora >= 41
raw: >
dnf install --assumeyes python3-libdnf5
become: true
retries: "{{ pkg_install_retries }}"
when:
- ansible_distribution == "Fedora"
- ansible_distribution_major_version | int >= 41
- name: Manage packages
package:
name: "{{ item.packages | dict2items | selectattr('value', 'ansible.builtin.all') | map(attribute='key') }}"
state: "{{ item.state }}"
update_cache: "{{ true if ansible_pkg_mgr in ['zypper', 'apt', 'dnf'] else omit }}"
cache_valid_time: "{{ 86400 if ansible_pkg_mgr == 'apt' else omit }}" # 24h
register: pkgs_task_result
until: pkgs_task_result is succeeded
retries: "{{ pkg_install_retries }}"
delay: "{{ retry_stagger | random + 3 }}"
when: not (ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"] or is_fedora_coreos)
loop:
- { packages: "{{ pkgs_to_remove }}", state: "absent", action_label: "remove" }
- { packages: "{{ pkgs }}", state: "present", action_label: "install" }
loop_control:
label: "{{ item.action_label }}"
tags:
- bootstrap_os