ansible安装部署

部署环境:  ansible端  192.168.200.113

    节点1:192.168.200.111

    节点2:192.168.200.112

1 安装ansible(只装在113)

      Ansible仓库默认不在yum仓库中,因此我们需要使用下面的命令启用epel仓库。
       yum install epel-release -y
       yum install ansible -y
 
 
关闭防火墙和slinux
systemctl stop firewalld
iptables -F
setenforce 0
 
修改vim /etc/hosts文件
xnyy-w1 192.168.200.111
xnyy-w2 192.168.200.112
xnyy-w3 192.168.200.113
 
ansible 通过ssh协议来对设备管理,需要免交互,免交互的方式有几种。
1.通过ssh-keygen 密钥对方式
创建密钥对
# ssh-keygen -t rsa -P "" -f .ssh/id_rsa
查看
# ls .ssh/
id_rsa  id_rsa.pub  known_hosts
发送公钥
# ssh-copy-id root@192.168.200.111
# ssh-copy-id root@192.168.200.112
 
检查是否无密码登录client
[root@ansible ~]# ssh 192.168.200.111
 
至此,已经安装完。下面测试一下
定义主机  vim /etc/ansible/hosts
[crushlinux]
192.168.200.111
192.168.200.112
 
ansible crushlinux -m ping  测试ansible连接client
更多详细查看有道云笔记
 
 
 
 
posted @ 2020-09-16 10:45  奥义,三千世界  阅读(223)  评论(0编辑  收藏  举报