安装ansible需要epel源,所以第一步就是下载epel源,当然环境清理也是少不了的,做好前面的工作之后就可以安装ansible啦,
第一步:安装epel源
# yum install -y epel-release
# yum makecache
第二步:清理环境
# systemctl status iptalbes
# systemctl stop iptables
# systemctl disable iptables
# systemctl status firewalld
# systemctl stop firewalld
# systemctl disable firewalld
# systemctl status NetworkManager
# systemctl stop NetworkManager
# systemctl disable NetworkManager
# getenforce
# vim /etc/selinux/config
selinux=enforcing改成selinux=disabled
第三步:安装ansible
# yum install -y ansible
# ansible --version
# vim /etc/ansible/hosts添加你要控制的主机(本机的IP 192.168.87.26 控制的主机IP 192.168.87.25 控制主机的密码是'nn123')
[client]
192.168.87.25 ansible_ssh_user=root ansible_ssh_pass='nn123'
# ssh-keygen -t rsa
# ssh-agent bsh
# ssh-copy-id -i root@192.168.87.25(一路回车有输入密码的提示就输入密码即可)
# ansible -m ping 192.168.87.25显示如下则是正确的
然后ansible就安装完成啦。