mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2025-12-14 22:04:43 +03:00
Only consider host in 'k8s_cluster' when checking if ip is a cached fact (#11817)
This avoids spurious failure with 'localhost'. It should also be more correct the inventory contains uncached hosts which are not in `k8s_cluster` and therefore should not be Kubespray business. (We still use hostvars for uncached hosts, because it's easier to select on 'ansible_default_ipv4' that way and does not change the end result)
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
- name: Stop if any host not in '--limit' does not have a fact cache
|
||||
vars:
|
||||
uncached_hosts: "{{ hostvars | dict2items | selectattr('value.ansible_default_ipv4', 'undefined') | map(attribute='key') }}"
|
||||
excluded_hosts: "{{ hostvars.keys() | difference(query('inventory_hostnames', ansible_limit)) }}"
|
||||
excluded_hosts: "{{ groups['k8s_cluster'] | difference(query('inventory_hostnames', ansible_limit)) }}"
|
||||
assert:
|
||||
that: uncached_hosts | intersect(excluded_hosts) == []
|
||||
fail_msg: |
|
||||
|
||||
Reference in New Issue
Block a user