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/strategy_linear/task_action_templating.yml

27 lines
581 B
YAML

- 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'