- Ansible Quick Start Guide
- Mohamed Alibi
- 121字
- 2021-07-23 16:37:47
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:
推薦閱讀
- 大數(shù)據(jù)導(dǎo)論:思維、技術(shù)與應(yīng)用
- Google Cloud Platform Cookbook
- 我的J2EE成功之路
- Practical Ansible 2
- Excel 2007函數(shù)與公式自學(xué)寶典
- Mobile DevOps
- 現(xiàn)代機械運動控制技術(shù)
- 云計算和大數(shù)據(jù)的應(yīng)用
- C++程序設(shè)計基礎(chǔ)(上)
- Redash v5 Quick Start Guide
- 網(wǎng)絡(luò)信息安全項目教程
- 玩轉(zhuǎn)PowerPoint
- 工業(yè)機器人應(yīng)用系統(tǒng)三維建模
- 系統(tǒng)安裝、維護與數(shù)據(jù)備份技巧
- 歐姆龍CP1H型PLC編程與應(yīng)用