blob: 5f7438feb5f3b3d4edf3bec348fc83d8e2cfe6a8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
- hosts: testhost,testhost2
gather_facts: no
tasks:
- set_fact:
module_to_run: 'debug'
when: inventory_hostname == 'testhost'
- set_fact:
module_to_run: 'ping'
when: inventory_hostname == 'testhost2'
- action:
module: '{{ module_to_run }}'
register: out
- assert:
that:
- "'msg' in out"
- "'ping' not in out"
when: inventory_hostname == 'testhost'
- assert:
that:
- "'ping' in out"
- "'msg' not in out"
when: inventory_hostname == 'testhost2'
|