#安装ansible
yum -y install ansible
#编辑ansible主机清单
vim /etc/ansible/hosts
#生成密钥对
ssh-keygen -t rsa -f /root/.ssh/id_rsa -N ''
#同步ssh密钥
ssh-copy-id 192.168.12.12 -p 22
#连接ssh
ssh 192.168.12.12 -p 22
#执行ping命令
ansible 192.168.12.12 -m ping
[WARNING]: Platform linux on host 192.168.12.12 is using the discovered Python
interpreter at /usr/bin/python3.5, but future installation...
阅读全文