Replace injected Ansible fact variables with ansible_facts in preinstall role (#13232)

This commit is contained in:
Nikhil Kumar
2026-05-14 16:08:30 +05:30
committed by GitHub
parent 22ce2f799f
commit 2ed677ce86
9 changed files with 41 additions and 38 deletions

View File

@@ -15,25 +15,25 @@
- not ignore_assert_errors
- name: Stop if non systemd OS type
assert:
that: ansible_service_mgr == "systemd"
that: ansible_facts['service_mgr'] == "systemd"
when: not ignore_assert_errors
- name: Stop if the os does not support
assert:
that: (allow_unsupported_distribution_setup | default(false)) or ansible_distribution in supported_os_distributions
msg: "{{ ansible_distribution }} is not a known OS"
that: (allow_unsupported_distribution_setup | default(false)) or ansible_facts['distribution'] in supported_os_distributions
msg: "{{ ansible_facts['distribution'] }} is not a known OS"
when: not ignore_assert_errors
- name: Stop if memory is too small for control plane nodes
assert:
that: ansible_memtotal_mb >= minimal_master_memory_mb
that: ansible_facts['memtotal_mb'] >= minimal_master_memory_mb
when:
- not ignore_assert_errors
- ('kube_control_plane' in group_names)
- name: Stop if memory is too small for nodes
assert:
that: ansible_memtotal_mb >= minimal_node_memory_mb
that: ansible_facts['memtotal_mb'] >= minimal_node_memory_mb
when:
- not ignore_assert_errors
- ('kube_node' in group_names)
@@ -47,8 +47,8 @@
- name: Stop if ip var does not match local ips
assert:
that: (ip in ansible_all_ipv4_addresses) or (ip in ansible_all_ipv6_addresses)
msg: "IPv4: '{{ ansible_all_ipv4_addresses }}' and IPv6: '{{ ansible_all_ipv6_addresses }}' do not contain '{{ ip }}'"
that: (ip in ansible_facts['all_ipv4_addresses']) or (ip in ansible_facts['all_ipv6_addresses'])
msg: "IPv4: '{{ ansible_facts['all_ipv4_addresses'] }}' and IPv6: '{{ ansible_facts['all_ipv6_addresses'] }}' do not contain '{{ ip }}'"
when:
- not ignore_assert_errors
- ip is defined
@@ -63,14 +63,14 @@
- name: Stop if kernel version is too low for cilium
assert:
that: ansible_kernel.split('-')[0] is version('4.9.17', '>=')
that: ansible_facts['kernel'].split('-')[0] is version('4.9.17', '>=')
when:
- kube_network_plugin == 'cilium' or cilium_deploy_additionally
- not ignore_assert_errors
- name: Stop if kernel version is too low for nftables
assert:
that: ansible_kernel.split('-')[0] is version('5.13', '>=')
that: ansible_facts['kernel'].split('-')[0] is version('5.13', '>=')
when:
- kube_proxy_mode == 'nftables'
- not kube_proxy_remove
@@ -93,6 +93,6 @@
- name: Stop if download_localhost is enabled for Flatcar Container Linux
assert:
that: ansible_os_family not in ["Flatcar", "Flatcar Container Linux by Kinvolk"]
that: ansible_facts['os_family'] not in ["Flatcar", "Flatcar Container Linux by Kinvolk"]
msg: "download_run_once not supported for Flatcar Container Linux"
when: download_run_once or download_force_cache