Linux编译安装最新版ansible

本文档详细介绍了如何下载并安装Ansible 2.9.22版本,包括依赖安装、源码解压、执行安装步骤以及配置文件的拷贝和修改,为自动化运维提供基础。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

下载最新版ansible

wget https://releases.ansible.com/ansible/ansible-2.9.22.tar.gz

安装依赖

yum -y install python-jinja2 PyYAML python-paramiko python-babel python-crypto

解开压缩包

tar xvf ansible-2.9.22.tar.gz

进入目录执行安装

进入解压后的目录查看文件列表

 cd ansible-2.9.22/
 [root@C6-190 ansible-2.9.22]# ll
total 160
drwxr-xr-x  2 root root  4096 May 25 05:18 bin
drwxr-xr-x  2 root root  4096 May 25 05:18 changelogs
drwxr-xr-x  3 root root  4096 May 25 05:18 contrib
-rw-r--r--  1 root root 35148 May 25 05:18 COPYING
drwxr-xr-x  6 root root  4096 May 25 05:18 docs
drwxr-xr-x  3 root root  4096 May 25 05:18 examples
drwxr-xr-x  3 root root  4096 May 25 05:18 hacking
drwxr-xr-x  3 root root  4096 May 25 05:18 lib
drwxr-xr-x  2 root root  4096 May 25 05:18 licenses
-rw-r--r--  1 root root 13840 May 25 05:18 Makefile
-rw-r--r--  1 root root  1731 May 25 05:18 MANIFEST.in
drwxr-xr-x 10 root root  4096 May 25 05:18 packaging
-rw-r--r--  1 root root  7724 May 25 05:18 PKG-INFO
-rw-r--r--  1 root root  5175 May 25 05:18 README.rst
-rw-r--r--  1 root root   351 May 25 05:18 requirements.txt
-rw-r--r--  1 root root 12949 May 25 05:18 setup.py
-rw-r--r--  1 root root 28352 May 25 05:18 SYMLINK_CACHE.json
drwxr-xr-x  7 root root  4096 May 25 05:18 test

使用python执行安装

python setup.py build && python setup.py install

拷贝配置文件到/etc/ansible目录下

cp -r ./ansible-2.9.22/examples/* /etc/ansible/

根据具体需要修改配置文件添加主机列表

ll /etc/ansible/
total 28
-rw-r--r-- 1 root root 19985 May 25 14:41 ansible.cfg
-rw-r--r-- 1 root root  1016 May 25 14:41 hosts
drwxr-xr-x 2 root root  4096 May 25 13:53 scripts
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值