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

@@ -1,9 +1,12 @@
---
- name: Set os_family fact for other redhat-based operating systems
- name: Normalize ansible_facts for redhat-family extensions
set_fact:
ansible_os_family: "RedHat"
ansible_distribution_major_version: "8"
when: ansible_distribution in redhat_os_family_extensions
ansible_facts: >-
{{ ansible_facts | combine({
'os_family': 'RedHat',
'distribution_major_version': '8'
}) }}
when: ansible_facts['distribution'] in redhat_os_family_extensions
tags:
- facts
@@ -86,12 +89,12 @@
{%- if resolvconf | bool -%}/etc/resolvconf/resolv.conf.d/base{%- endif -%}
head: >-
{%- if resolvconf | bool -%}/etc/resolvconf/resolv.conf.d/head{%- endif -%}
when: not ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"] and not is_fedora_coreos
when: ansible_facts['os_family'] not in ["Flatcar", "Flatcar Container Linux by Kinvolk"] and not is_fedora_coreos
- name: Target temporary resolvconf cloud init file (Flatcar Container Linux by Kinvolk / Fedora CoreOS)
set_fact:
resolvconffile: /tmp/resolveconf_cloud_init_conf
when: ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"] or is_fedora_coreos
when: ansible_facts['os_family'] in ["Flatcar", "Flatcar Container Linux by Kinvolk"] or is_fedora_coreos
- name: Check if /etc/dhclient.conf exists
stat:
@@ -122,12 +125,12 @@
- name: Target dhclient hook file for Red Hat family
set_fact:
dhclienthookfile: /etc/dhcp/dhclient.d/zdnsupdate.sh
when: ansible_os_family == "RedHat"
when: ansible_facts['os_family'] == "RedHat"
- name: Target dhclient hook file for Debian family
set_fact:
dhclienthookfile: /etc/dhcp/dhclient-exit-hooks.d/zdnsupdate
when: ansible_os_family == "Debian"
when: ansible_facts['os_family'] == "Debian"
- name: Set etcd vars if using kubeadm mode
set_fact: