配置免密登陆:
1.ansible -i costome_hosts all -m authorized_key -a "user=root key=‘{{ lookup(‘file‘, ‘/root/.ssh/id_rsa.pub‘)}}‘ path=‘/root/.ssh/authorized_keys‘ manage_dir=no"
costome_hosts 配置
[default] 1.1.1.1 ansible_ssh_pass=‘qqqqq‘ 2.2.2.2 ansible_ssh_pass=‘ddddd‘ [all:vars] ansible_ssh_user=‘root‘
原文:https://www.cnblogs.com/wt11/p/14139549.html