[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