http://www.ansible.com.cn/docs/intro_installation.html
准备两台机器作为被控制的机器和主控端
主控 192.168.0.103
被控制 192.168.0.105
在主控机器上安装 ansible
yum install ansible
![](https://img.haomeiwen.com/i2787821/0243d6d4d73754d1.png)
发现没有可以安装的ansible,更换源
yum install -y [http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm](http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm)
![](https://img.haomeiwen.com/i2787821/132798f22bcb6141.png)
再次安装ansible
yum install ansible
查看版本
ansible --version
证明安装完![](https://img.haomeiwen.com/i2787821/7bfd69cda1f5a9bd.png)
然后生成密钥对ssh-keygen
我这里发现以前生成过
![](https://img.haomeiwen.com/i2787821/3725dd0197451932.png)
将秘钥发布到被控节点中
ssh-copy-id -i root@192.168.0.105
我这里也copy过修改配置文件
vi /etc/ansible/hosts
在最后添加 webg
![](https://img.haomeiwen.com/i2787821/bd5886f500ba1817.png)
执行个命令看看 ansible -m command -a 'df -lh' webg
![](https://img.haomeiwen.com/i2787821/be43723860c21bea.png)
105 机器上的信息展示出来了 证明 配置ansible正确
点波关注 系统搭建(docker)
网友评论