官术网_书友最值得收藏!

Ad hoc versus playbook: the ping module

As discussed previously, Ansible ad hoc can be used for a quick check, such as running a ping command to check if the hosts are up and running. The command should look as follows:

ansible servers -m ping

The output of the command will look similar to the following:

The ping module can also be used in the playbook as part of the bigger script, where the result of the ping can be piped to be the condition for another action. The playbook code is as follows:

---
- name: Ping module playbook usage
hosts: servers
gather_facts: false
tasks:
- name: ping the local servers
ping:

The output of this code will look as follows:

主站蜘蛛池模板: 原阳县| 新建县| 佛坪县| 绥芬河市| 方城县| 全南县| 安义县| 绥中县| 龙江县| 万荣县| 塘沽区| 额敏县| 剑川县| 电白县| 长汀县| 栾城县| 汨罗市| 仪征市| 邢台市| 孟津县| 澜沧| 中山市| 曲靖市| 日照市| 贵南县| 清流县| 察隅县| 锡林郭勒盟| 昌江| 连云港市| 灵川县| 施秉县| 涞水县| 土默特右旗| 健康| 锡林郭勒盟| 乐陵市| 门头沟区| 大兴区| 渭源县| 江川县|