changes
This commit is contained in:
parent
6a567185b3
commit
888b6f3362
20
ping.yml
20
ping.yml
@ -1,25 +1,29 @@
|
||||
---
|
||||
- name: Ping check to determine if hosts are reachable
|
||||
hosts: all
|
||||
become: false
|
||||
become: true
|
||||
gather_facts: false
|
||||
|
||||
tasks:
|
||||
- name: Wait for connection
|
||||
ansible.builtin.wait_for_connection:
|
||||
timeout: 3
|
||||
|
||||
- name: Ping target hosts
|
||||
ansible.builtin.ping:
|
||||
ansible.builtin.command:
|
||||
cmd: whoami
|
||||
changed_when: false
|
||||
register: ping_check
|
||||
ignore_errors: true
|
||||
# ignore_unreachable: 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: Clear host errors
|
||||
ansible.builtin.meta: clear_host_errors
|
||||
|
||||
- name: Display ping check results
|
||||
ansible.builtin.debug:
|
||||
var: ping_results
|
||||
msg: "{{ lookup('template', 'ping_results.j2') | from_yaml }}"
|
||||
run_once: true # noqa: run-once[task]
|
||||
delegate_to: localhost
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user