说明:
1. 准备3台虚拟机,ip分别是:192.168.18.10,192.168.18.11,192.168.18.12
192.168.18.10:安装ansible,为剩下两台服务器做批量部署
(一)安装
yum -y install epel-release
yum -y install ansible
(二)编辑配置文件
vim /etc/ansible/hosts 添加服务器

(三)
配置客户端(无密码登录)
1. ssh-keygen

2.进入/root/.ssh目录,复制文件id_rsa.pub到两台服务器的/root/.ssh目录下,并重命名
为authorized_keys
scp id_rsa.pub root@192.168.18.11:/root/.ssh/authorized_keys
scp id_rsa.pub root@192.168.18.12:/root/.ssh/authorized_keys
3.错误

错误原因是:root用户没有用ssh命令登录过
在两台服务器分别执行ssh localhost命令后,恢复正常
阅读(959) | 评论(0) | 转发(0) |