我只是想要平一个主机(DNS主机)来检查可达性。看有没有合适的方法来做这件事?我没有把握。下面是我关于net_ping的剧本
---
- name: Set User
hosts: web_servers
gather_facts: false
become: false
vars:
ansible_network_os: linux
tasks:
- name: Pinging Host
net_ping
dest: 10.250.30.11但,
TASK [Pinging Host] *******************************************************************************************************************
task path: /home/veeru/PycharmProjects/Miscellaneous/tests/ping_test.yml:10
ok: [10.250.30.11] => {
"changed": false,
"msg": "Could not find implementation module net_ping for linux"
}与ping模块
---
- name: Set User
hosts: dns
gather_facts: false
become: false
tasks:
- name: Pinging Host
action: ping看起来它正在尝试将ssh转换到IP中。(签入详细模式)。我也不知道原因?我该怎么做ICMP平?我不想把DNS IP也放在库存中。
UPDATE1:
嗯,看来ansible_network_os中没有对ansible_network_os的支持。
发布于 2019-05-09 08:08:12
您可以使用ping命令:
---
- hosts: all
gather_facts: False
connection: local
tasks:
- name: ping
shell: ping -c 1 -w 2 8.8.8.8
ignore_errors: true发布于 2020-08-07 08:42:05
尝试使用至模块指定在本地主机上执行此任务。也许ansible正在尝试连接到这些设备来执行ping shell命令。下面的代码示例适用于我。
tasks:
- name: ping test
shell: ping -c 1 -w 2 {{ ansible_host }}
delegate_to: localhost
ignore_errors: true发布于 2021-10-24 08:46:47
还可以在ansible中通过以下adhoc命令运行/检查ping延迟
ansible all -m shell -a "ping -c3 google.com"https://stackoverflow.com/questions/56054563
复制相似问题