You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/integration/targets/delegate_to/delegate_facts_loop.yml

22 lines
556 B
YAML

- 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']) }}"