ansible学习02

ansible 对主机清单进行磁盘使用查看

vi  /etc/ansible/hosts

[webservers]
## alpha.example.org
## beta.example.org
## 192.168.1.100
## 192.168.1.110
192.168.10.127
192.168.10.128

[root@localhost ansible]# ansible all -m shell -a "df -h" -k
SSH password:
192.168.10.128 | FAILED | rc=-1 >>
Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this. Please add this host's fingerprint to your known_hosts file to manage this host.
192.168.10.127 | CHANGED | rc=0 >>
Filesystem Size Used Avail Use% Mounted on
devtmpfs 1.8G 0 1.8G 0% /dev
tmpfs 1.8G 0 1.8G 0% /dev/shm
tmpfs 1.8G 13M 1.8G 1% /run
tmpfs 1.8G 0 1.8G 0% /sys/fs/cgroup
/dev/mapper/centos-root 33G 4.0G 29G 13% /
/dev/mapper/centos-var 6.1G 857M 5.2G 14% /var
/dev/sda1 197M 150M 48M 76% /boot
tmpfs 367M 52K 367M 1% /run/user/1000
tmpfs 367M 0 367M 0% /run/user/0

修改 vi  /etc/ansible/ansible.cfg 

#host_key_checking = False  注释行注释取消

host_key_checking = False

 

posted @ 2021-07-13 16:42  beawh  阅读(22)  评论(0编辑  收藏  举报