I'm working on Kubespray 2.16
At roles/kubernetes/preinstall/tasks/0070-system-packages.yml
, there is a task "Install packages requirements"
- name: Install packages requirements
package:
name: "{{ required_pkgs | default([]) | union(common_required_pkgs|default([])) }}"
state: present
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 Container Linux by Kinvolk", "ClearLinux"] or is_fedora_coreos)
tags:
- bootstrap-os
According to the code, the package {{ required_pkgs | default([]) | union(common_required_pkgs|default([])) }}
will be installed.
And I found the required_pkgs in roles/kubernetes/preinstall/vars/*.yml
In redhat.yml
,
required_pkgs:
- "{{ ( (ansible_distribution_major_version | int) < 8) | ternary('libselinux-python','python3-libselinux') }}"
- device-mapper-libs
- nss
- conntrack
In centos.yml
,
required_pkgs:
- "{{ ( (ansible_distribution_major_version | int) < 8) | ternary('libselinux-python','python3-libselinux') }}"
- device-mapper-libs
- nss
- conntrack
I think there is no process for Ansible to check my OS in "this task". Then how the Ansible set required_pkgs
among a lot of YML files?
p.s. My OS is RedHat.