--- - name: Tests machine connections via Ansible Tower/Ansible Automation Platform hosts: all gather_facts: no become: no vars: # These vars are used to purposefully fail a node fail_host : "{{ tower_fail_host | default('no') }}" host_to_fail : "{{ tower_host_to_fail | default('lab-prod-1') }}" tasks: - name: "Test #1 - whoami" command : cmd : whoami changed_when : no register : r_cmd_whoami - name: "Results #1 - whoami" debug: msg: - "rc : {{ r_cmd_whoami.rc }}" - "stdout : {{ r_cmd_whoami.stdout }}" - "stderr : {{ r_cmd_whoami.stderr }}" - name: "Test #2 - induce failure (but only for a specified host)" command: cmd: /bin/false when: - fail_host | bool and inventory_hostname == host_to_fail ...