编译安装ansible

发布时间 2023-11-28 11:10:50作者: leihongnu

安装包下载地址:https://releases.ansible.com/ansible/

注意:ansible对python版本有要求

 

1、安装依赖

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

 2、安装ansible
tar -zxvf ansible-2.9.9.tar.gz
cd ansible-2.9.9.tar
#构建 注意python的版本  有的操作系统需要:python3 setup.py build
 python setup.py build
#安装
python setup.py install
#创建配置文件目录
mkdir /etc/ansible
#复制安装包中的配置文件到 /etc/ansible
cp -r example/*  /etc/ansible/
 
3、验证
 
#验证前要加K验证
 
编写 /etc/ansible/hosts添加主机
 
ansible ip -m ping  测试连通性,出现pong则成功