mirror of https://github.com/ansible/ansible.git
loop/fact delegation fix (#75768)
now set_fact and include_vars intermediate results are congruent with delegationpull/76194/head
parent
8bbecc7cac
commit
7bec196061
@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- set_fact/include_vars correctly handle delegation assignments within loops
|
||||
@ -0,0 +1,21 @@
|
||||
- hosts: localhost
|
||||
gather_facts: no
|
||||
tasks:
|
||||
- set_fact:
|
||||
test: 123
|
||||
delegate_to: "{{ item }}"
|
||||
delegate_facts: true
|
||||
when: test is not defined
|
||||
loop: "{{ groups['all'] | difference(['localhost']) }}"
|
||||
|
||||
- name: ensure we didnt create it on current host
|
||||
assert:
|
||||
that:
|
||||
- test is undefined
|
||||
|
||||
- name: ensure facts get created
|
||||
assert:
|
||||
that:
|
||||
- "'test' in hostvars[item]"
|
||||
- hostvars[item]['test'] == 123
|
||||
loop: "{{ groups['all'] | difference(['localhost']) }}"
|
||||
Loading…
Reference in New Issue