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

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:

主站蜘蛛池模板: 南陵县| 长治县| 包头市| 平陆县| 海林市| 佳木斯市| 响水县| 长垣县| 六安市| 翁牛特旗| 海口市| 商河县| 阳江市| 淮阳县| 偃师市| 扎赉特旗| 朝阳市| 吐鲁番市| 建始县| 新龙县| 无棣县| 贞丰县| 衡南县| 津南区| 绩溪县| 兰州市| 邯郸市| 新泰市| 织金县| 壶关县| 平和县| 桂阳县| 新津县| 德阳市| 玉林市| 辰溪县| 淮滨县| 丹江口市| 浦江县| 泰安市| 静海县|