- Learning DevOps
- Mikael Krief
- 205字
- 2021-06-24 12:32:11
Testing the inventory
Once the inventory is written, it is possible to test whether all of the hosts mentioned are accessible from Ansible. To do this, we can execute the following command:
ansible -i inventory all -u demobook -m ping
The -i argument is the path of the inventory file, the -u argument corresponds to the remote user name used to connect to the remote machine, and -m is the command to execute—here, we execute the ping command on all machines in the inventory.
The following screenshot shows the execution of this command:

We can also test connectivity only on hosts of a particular group by calling this command with the group name instead of all. For example, in our case, we will execute this command:
ansible -i inventory webserver -u demobook -m ping
The following screenshot shows the execution of this command:

In this section, we learned that Ansible needs an inventory file to configure hosts. Then, we created and tested our first inventory file and finally, we saw how to go further in the configuration of this file.
In the next section, we will see how to set up and write the configuration action code in the Ansible playbooks.
- 腦深部電刺激術(shù)
- 藥事管理與法規(guī)
- 中國神經(jīng)介入發(fā)展史
- 突面畸形的正畸策略及技術(shù)
- 圖說災(zāi)難逃生自救叢書:海嘯
- 實用胃腸病臨床手冊
- 何以為人:試管嬰兒技術(shù)的起源與發(fā)展
- 老年癡呆居家康復(fù)指導(dǎo)
- 帕金森病中西醫(yī)結(jié)合診療與康復(fù)
- 細(xì)針穿刺細(xì)胞病理學(xué)
- Hands-On Reactive Programming with Clojure
- BTK抑制劑與淋巴瘤診療病例分析
- 深井效應(yīng)
- 家庭護(hù)理指導(dǎo):常見內(nèi)外科疾病家庭護(hù)理
- 戰(zhàn)勝癌癥需“三防”:你不可不懂的癌癥三防常識