ping_check/ping.yml

29 lines
607 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: "Ping Check: Successful Hosts"
debug:
var: ansible_play_batch
run_once: true
delegate_to: localhost
- name: "Ping Check: Failed Hosts"
debug:
msg: "{{ ansible_play_hosts_all | difference(ansible_play_batch) }}"
run_once: true # noqa: run-once[task]
delegate_to: localhost
...