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

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:

主站蜘蛛池模板: 舟曲县| 二连浩特市| 久治县| 北票市| 开鲁县| 西丰县| 昌都县| 乳山市| 西宁市| 新邵县| 砚山县| 新巴尔虎右旗| 遵化市| 凭祥市| 龙胜| 上杭县| 霍山县| 新津县| 财经| 绍兴县| 美姑县| 台中市| 凤城市| 咸宁市| 长葛市| 德钦县| 陇南市| 三穗县| 洛川县| 和政县| 南充市| 赤峰市| 屯门区| 聂拉木县| 洛川县| 上思县| 洪湖市| 栖霞市| 东城区| 眉山市| 娱乐|