ping_check/ping.yml
2024-03-28 10:29:13 -04:00

24 lines
552 B
YAML

---
- name: Ping check to determine if hosts are reachable
hosts: all
become: false
gather_facts: false
tasks:
- name: Ping target hosts
ansible.builtin.ping:
register: ping_results
ignore_errors: true
failed_when: false
- name: Display ping check results
ansible.builtin.debug:
msg: "{{ lookup('template', 'ping_results.j2') | from_yaml }}"
run_once: true # noqa: run-once[task]
delegate_to: localhost
- name: Clear host error
ansible.builtin.meta: clear_host_errors
...