大山快修 - 简单 - 高效 | 压缩包密码可以在《大山快修》公众号回复 “解压密码” 获取!
[root@m01 ~]# vim /etc/ansible/hosts
[web01]
10.0.0.17 ansible_ssh_user=root ansible_ssh_port=22 ansible_ssh_pass='123'
[web02]
10.0.0.18 ansible_ssh_user=root ansible_ssh_port=22 ansible_ssh_pass='123'
或者
1.生成密钥对 [root@m01 ~]# ssh-keygen
2.推送公钥
[root@m01 ~]# ssh-copy-id 10.0.0.17
[root@m01 ~]# ssh-copy-id 10.0.0.18