summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/delegate_to/test_delegate_to_loop_caching.yml
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 16:04:21 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 16:04:21 +0000
commit8a754e0858d922e955e71b253c139e071ecec432 (patch)
tree527d16e74bfd1840c85efd675fdecad056c54107 /test/integration/targets/delegate_to/test_delegate_to_loop_caching.yml
parentInitial commit. (diff)
downloadansible-core-upstream.tar.xz
ansible-core-upstream.zip
Adding upstream version 2.14.3.upstream/2.14.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/integration/targets/delegate_to/test_delegate_to_loop_caching.yml')
-rw-r--r--test/integration/targets/delegate_to/test_delegate_to_loop_caching.yml45
1 files changed, 45 insertions, 0 deletions
diff --git a/test/integration/targets/delegate_to/test_delegate_to_loop_caching.yml b/test/integration/targets/delegate_to/test_delegate_to_loop_caching.yml
new file mode 100644
index 0000000..6ea08f7
--- /dev/null
+++ b/test/integration/targets/delegate_to/test_delegate_to_loop_caching.yml
@@ -0,0 +1,45 @@
+- hosts: testhost,testhost2
+ gather_facts: false
+ vars:
+ delegate_to_host: "localhost"
+ tasks:
+ - set_fact:
+ gandalf:
+ shout: 'You shall not pass!'
+ when: inventory_hostname == 'testhost'
+
+ - set_fact:
+ gandalf:
+ speak: 'Run you fools!'
+ when: inventory_hostname == 'testhost2'
+
+ - name: works correctly
+ debug: var=item
+ delegate_to: localhost
+ with_dict: "{{ gandalf }}"
+ register: result1
+
+ - name: shows same item for all hosts
+ debug: var=item
+ delegate_to: "{{ delegate_to_host }}"
+ with_dict: "{{ gandalf }}"
+ register: result2
+
+ - debug:
+ var: result2.results[0].item.value
+
+ - assert:
+ that:
+ - result1.results[0].item.value == 'You shall not pass!'
+ - result2.results[0].item.value == 'You shall not pass!'
+ when: inventory_hostname == 'testhost'
+
+ - assert:
+ that:
+ - result1.results[0].item.value == 'Run you fools!'
+ - result2.results[0].item.value == 'Run you fools!'
+ when: inventory_hostname == 'testhost2'
+
+ - assert:
+ that:
+ - _ansible_loop_cache is undefined