系统是centos7.5 python2.75
yum install -y ansible
ssh-keygen -t rsa
vim /etc/ansible/hosts
定义的一个hello组:
下面是主机节点
把/root/.ssh/id_rsa.pub分发到各节点authorized_key中
ansible hello -m authorized_key -a "user=root key=‘{{ lookup(‘file‘,‘/root/.ssh/id_rsa.pub‘) }}‘" -k
导入成功!
原文:https://www.cnblogs.com/fuyuteng/p/9515164.html