streamline ansible_default_ipv4 gathering loop (#9281)
parent
0d5bcd3e20
commit
0ff883afeb
|
@ -4,13 +4,15 @@
|
||||||
# Thanks https://medium.com/opsops/ansible-default-ipv4-is-not-what-you-think-edb8ab154b10
|
# Thanks https://medium.com/opsops/ansible-default-ipv4-is-not-what-you-think-edb8ab154b10
|
||||||
|
|
||||||
- name: Gather ansible_default_ipv4 from all hosts
|
- name: Gather ansible_default_ipv4 from all hosts
|
||||||
tags: always
|
setup:
|
||||||
include_tasks: fallback_ips_gather.yml
|
gather_subset: '!all,network'
|
||||||
when: hostvars[delegate_host_to_gather_facts].ansible_default_ipv4 is not defined
|
filter: "ansible_default_ipv4"
|
||||||
loop: "{{ groups['k8s_cluster']|default([]) + groups['etcd']|default([]) + groups['calico_rr']|default([]) }}"
|
delegate_to: "{{ item }}"
|
||||||
loop_control:
|
delegate_facts: yes
|
||||||
loop_var: delegate_host_to_gather_facts
|
when: hostvars[item].ansible_default_ipv4 is not defined
|
||||||
|
loop: "{{ (groups['k8s_cluster']|default([]) + groups['etcd']|default([]) + groups['calico_rr']|default([])) | unique }}"
|
||||||
run_once: yes
|
run_once: yes
|
||||||
|
tags: always
|
||||||
|
|
||||||
- name: create fallback_ips_base
|
- name: create fallback_ips_base
|
||||||
set_fact:
|
set_fact:
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
---
|
|
||||||
# include to workaround mitogen issue
|
|
||||||
# https://github.com/dw/mitogen/issues/663
|
|
||||||
|
|
||||||
- name: "Gather ansible_default_ipv4 from {{ delegate_host_to_gather_facts }}"
|
|
||||||
setup:
|
|
||||||
gather_subset: '!all,network'
|
|
||||||
filter: "ansible_default_ipv4"
|
|
||||||
delegate_to: "{{ delegate_host_to_gather_facts }}"
|
|
||||||
connection: "{{ (delegate_host_to_gather_facts == 'localhost') | ternary('local', omit) }}"
|
|
||||||
delegate_facts: yes
|
|
Loading…
Reference in New Issue