Files
kubespray/roles/kubespray-defaults/tasks/main.yaml
Ali Afsharzadeh 6a67d28fab [release-2.27] Make fallback_ip cacheable in facts (#12182)
* Make fallback_ip cacheable in facts

* Move cacheable property after fallback_ip variable

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

---------

Co-authored-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>
2025-05-02 22:03:55 -07:00

36 lines
1.2 KiB
YAML

---
- name: Set facts variables
tags:
- always
block:
- name: Gather ansible_default_ipv4
setup:
gather_subset: '!all,network'
filter: "ansible_default_ipv4"
when: ansible_default_ipv4 is not defined
ignore_unreachable: true
# Set 127.0.0.1 as fallback IP if we do not have host facts for host
# ansible_default_ipv4 isn't what you think.
# https://medium.com/opsops/ansible-default-ipv4-is-not-what-you-think-edb8ab154b10
# TODO: discard this and update all the location relying on it in "looping on hostvars" templates
- name: Set fallback_ip
set_fact:
fallback_ip: "{{ ansible_default_ipv4.address | d('127.0.0.1') }}"
cacheable: true
when: fallback_ip is not defined
- name: Set no_proxy
import_tasks: no_proxy.yml
when:
- http_proxy is defined or https_proxy is defined
- no_proxy is not defined
# TODO: Clean this task up when we drop backward compatibility support for `etcd_kubeadm_enabled`
- name: Set `etcd_deployment_type` to "kubeadm" if `etcd_kubeadm_enabled` is true
set_fact:
etcd_deployment_type: kubeadm
when:
- etcd_kubeadm_enabled is defined and etcd_kubeadm_enabled
tags:
- always