mirror of https://github.com/ansible/ansible.git
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.
22 lines
556 B
YAML
22 lines
556 B
YAML
3 years ago
|
- 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']) }}"
|