After we've installed the ansible,
Password-free login is configured.
Now we can check the connectivity of management hosts and managed hosts
Ansible all-m Ping
In our actual production we tend to use sudo to perform root permissions for ordinary users.
Ansible all-m ping-u Ansible-sudo
We can find a directory to create a host list file inventory.cfg
If we create it in the home directory,
Cat/home/inventory.cfg
[Webservers]
192.168.220.98
192.168.220.116
Ansible all-m ping-i inventory.cfg
To specify the host list here, we can also place the inventory.cfg file somewhere else.
For example, if we put it in the/etc/ansible directory, we need to specify a detailed location here.
Ansible all-m ping-i/etc/ansible/inventory.cfg
Note: You often need to get details of the execution process when debugging an Automation script in Ansible, you can add a-V or a-VVV after the command to get detailed output results
Ansible all-m Ping-v
Ansible all-m PING-VVV
Ansible a little trial.