温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

(2)ansible 安装部署

发布时间:2020-07-23 11:28:33 来源:网络 阅读:227 作者:TangYGao 栏目:系统运维

ansible安装部署非常简单,只依赖于python和ssh,而这两个依赖默认都已经安装,我接触到的环境大部分是centos、redhat环境,也有少数ubuntu、suse这类系统,不过还是尽熟悉的来,在centos 操作系统安装ansible作为管理节点。

一、pip安装

ansbile 底层也是基于python编写,所以通过pip方式可以安装ansible
步骤1:安装python-pip及pythondevel程序包
shell> yum install python-pip python-devel -y

步骤2:安装环境检查
//确保服务器安装了gcc glibc 等开发环境包
shell> yum install gcc glibc-devel zlib-devel rpm-build openssl-devel -y
//更新pip至最新版本
shell> pip install --upgrde pip

步骤3:安装ansible
shell> pip install ansible --upgrade

步骤4:查看安装的ansible版本
shell> ansible --version
ansible 2.7.10

注释:centos7.5 这个方法不一定能安装成功,因为python版本的问题,当你pip的时候,新版本的ansible会报错python过低。
如果对系统python 版本升级,那你会碰到好多的问题,推荐2个工具大家可以了解下,Pyenv / Virtualenv 多python环境扩展管理工具。

二、yum 安装

(1)添加yum源 选择阿里epel源
shell> rpm -ivh https://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm centos7
shell> rpm -ivh https://mirrors.aliyun.com/epel/epel-release-latest-6.noarch.rpm centos6

(2) yum 安装ansible
shell> yum -y install ansible

三、 apt-get 安装

(1)添加ansible源
shell> apt-add-repository -y ppa:ansible/ansible
(2)安装ansible
shell> apt-get update
shell> apt-get install -y ansible

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI