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

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:

主站蜘蛛池模板: 定陶县| 遂昌县| 九台市| 卓资县| 凤台县| 牡丹江市| 石泉县| 武强县| 平陆县| 盐池县| 舞钢市| 樟树市| 历史| 祥云县| 德庆县| 乌兰察布市| 抚远县| 富宁县| 呈贡县| 富锦市| 金川县| 富阳市| 正定县| 习水县| 清徐县| 嘉兴市| 罗田县| 抚远县| 龙山县| 阜城县| 陈巴尔虎旗| 涟源市| 丁青县| 特克斯县| 旅游| 曲阳县| 盐源县| 安顺市| 鲁甸县| 洛南县| 武定县|