Files
tower-tests/machine-test.yml
2022-05-06 12:47:55 -04:00

37 lines
839 B
YAML

---
- name: Test machine connections
hosts: all
gather_facts: no
become: no
vars:
# These vars are used to purposefully fail a node for testing
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
...