mirror of https://github.com/ansible/ansible.git
* remove default from delegate_facts to inherit (#45492)
* remove default from delegate_facts to inherit
fixes #45456
* test delegate_facts
* added note about inheritance and defaults
* yamllint
(cherry picked from commit 8743e6ae2e)
* added changelog
pull/51774/head
parent
bdf7f42b7c
commit
7589d496fc
@ -0,0 +1,2 @@
|
|||||||
|
bugfixes:
|
||||||
|
- delegate_facts - fix to work properly under block and include_role (https://github.com/ansible/ansible/pull/51553)
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
- hosts: testhost
|
||||||
|
gather_facts: false
|
||||||
|
tasks:
|
||||||
|
- name: set var to delegated host directly
|
||||||
|
set_fact: qq1=333
|
||||||
|
delegate_facts: true
|
||||||
|
delegate_to: localhost
|
||||||
|
|
||||||
|
- name: ensure qq1 exists in localhost but not in testhost
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- qq1 is undefined
|
||||||
|
- "'qq1' in hostvars['localhost']"
|
||||||
|
|
||||||
|
- name: set var to delegated host via inheritance
|
||||||
|
block:
|
||||||
|
- set_fact: qq2=333
|
||||||
|
delegate_facts: true
|
||||||
|
delegate_to: localhost
|
||||||
|
|
||||||
|
- name: ensure qq2 exists in localhost but not in testhost
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- qq2 is undefined
|
||||||
|
- "'qq2' in hostvars['localhost']"
|
||||||
Loading…
Reference in New Issue