mirror of https://github.com/ansible/ansible.git
now set_fact and include_vars intermediate results are congruent with delegation
(cherry picked from commit 7bec196061)
pull/76392/head
parent
f3de38a975
commit
8e8c4be23f
@ -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