Ansible(2) - Ansible inventory configuration and connectivity testing Ansible配置主机和连接测试教程
1. open the inventory file with your favorite editor and modify it
1 | sudo vi /etc/ansible/hosts |
add servers likes below:
1 | [servers] |
2. verify the inventory
1 | ansible-inventory --list -y |
3. test connectivity by using a Ansible ping
1 | ansible all -m ping |
4. run a testing command from control node to host nodes
1 | ansible all -a "df -h" |
参数说明 args:
- all: all servers
- -a: using ad-hoc commands
- df: disk free
- -h: –human-readable : print sizes in power of 1024
Ansible(2) - Ansible inventory configuration and connectivity testing Ansible配置主机和连接测试教程
https://yanmouxie.com/ansible-2-inventory-configuration-and-connectivity-testing.html