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