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.
21 lines
496 B
YAML
21 lines
496 B
YAML
2 years ago
|
- hosts: testhost,testhost2
|
||
|
gather_facts: no
|
||
|
vars:
|
||
|
run_once_flag: false
|
||
|
tasks:
|
||
|
- debug:
|
||
|
msg: "I am {{ item }}"
|
||
|
run_once: "{{ run_once_flag }}"
|
||
|
register: reg1
|
||
|
loop:
|
||
|
- "{{ inventory_hostname }}"
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- "reg1.results[0].msg == 'I am testhost'"
|
||
|
when: inventory_hostname == 'testhost'
|
||
|
- assert:
|
||
|
that:
|
||
|
- "reg1.results[0].msg == 'I am testhost2'"
|
||
|
when: inventory_hostname == 'testhost2'
|