Ansible Script 추가
This commit is contained in:
18
ansible/00_old/health_check.yml
Normal file
18
ansible/00_old/health_check.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
- name: Check the health of all servers
|
||||
hosts: all
|
||||
tasks:
|
||||
- name: Check if server is reachable
|
||||
ping:
|
||||
register: result
|
||||
ignore_errors: true
|
||||
|
||||
- name: Print result
|
||||
debug:
|
||||
var: result
|
||||
when: result is defined
|
||||
|
||||
- name: Print error message
|
||||
debug:
|
||||
msg: "Server {{ inventory_hostname }} could not be reached."
|
||||
when: result.ping is undefined
|
||||
Reference in New Issue
Block a user