首页 > 解决方案 > 在树莓派上进行 ansible Ping 测试

问题描述

我正在寻找一个可以使用蜂窝接口 ping 并测试响应的 ansible 模块。

我在我的树莓派上运行它作为蜂窝连接的验证。

相当于 ping -I wwan0 google.com

我找不到以简单方式执行此操作或根本无法执行此操作的模块。

标签: ansibleraspberry-pi

解决方案


有一个ping模块,但它没有将源接口 ( -I) 作为参数。使用command模块怎么样?

https://docs.ansible.com/ansible/latest/collections/ansible/builtin/command_module.html

像这样简单的东西:

- name: Ping google.com from interface wwan0
  ansible.builtin.command: ping -I wwan0 google.com

推荐阅读