ping_check/ping.yml
2024-03-28 10:37:58 -04:00

27 lines
650 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_check
ignore_errors: true
failed_when: false
- name: Set ping check results
ansible.builtin.set_fact:
ping_results: "{{ lookup('template', 'ping_results.j2') | from_yaml }}"
run_once: true # noqa: run-once[task]
delegate_to: localhost
- name: Display ping check results
ansible.builtin.debug:
var: ping_results
run_once: true # noqa: run-once[task]
delegate_to: localhost
...