ansible安装部署非常简单,只依赖于python和ssh,而这两个依赖默认都已经安装,我接触到的环境大部分是centos, redhat环境,也有少数ubuntu, suse这类系统,不过还是尽熟悉的来,在centos操作系统安装ansible作为管理节点。
一、pip安装
ansbile底层也是基于python编写,所以通过pip方式可以安装ansible
步骤1:安装python-pip及pythondevel程序包
shell>yum安装python-pip python-devel - y
步骤2:安装环境检查
//确保服务器安装了gcc glibc等开发环境包
shell>yum安装gcc glibc-devel zlib-devel rpm-build openssl-devel - y
//更新pip至最新版本
shell>pip安装——upgrde pip
步骤3:安装ansible
shell>pip安装ansible——升级
步骤4:查看安装的ansible版本
shell>ansible——版本
ansible 2.7.10
<强>注释强>:centos7.5这个方法不一定能安装成功,因为python版本的问题,当你皮普的时候,新版本的ansible会报错python过低。
如果对系统python版本升级,那你会碰到好多的问题,推荐2个工具大家可以了解下,Pyenv/Virtualenv多python环境扩展管理工具。
二,百胜安装
(1)添加百胜源选择阿里epel源
shell>rpm -ivh https://mirrors.aliyun.com/epel/epel -发布最新7. - noarch.rpm centos7
shell>rpm -ivh https://mirrors.aliyun.com/epel/epel -发布最新6. - noarch.rpm centos6
(2)百胜安装ansible
shell>百胜是安装ansible
三,apt-get安装
(1)添加ansible源
shell>apt-add-repository - y ppa: ansible/ansible
(2)安装ansible
shell>apt-get更新
shell>apt-get安装- y ansible