Ansible 安装和入门

2021-09-09 14:49:39 浏览数 (1)

Ansible安装

ansible的安装方法有多种

EPEL源的rpm包安装:
代码语言:javascript复制
[root@ansible ~]#yum install ansible

Bash

Copy

编译安装
代码语言:javascript复制
yum -y install python-jinja2 PyYAML python-paramiko python-babel python-crypto
tar xf ansible-1.5.4.tar.gz
cd ansible-1.5.4
python setup.py build
python setup.py install
mkdir /etc/ansible
cp -r examples/* /etc/ansible
Git方式
代码语言:javascript复制
git clone git://github.com/ansible/ansible.git --recursive
cd ./ansible
source ./hacking/env-setup

Bash

Copy

pip 安装

pip 是安装Python包的管理器,类似 yum

代码语言:javascript复制
yum install python-pip python-devel
yum install gcc glibc-devel zibl-devel  rpm-bulid openssl-devel
pip install  --upgrade pip
pip install ansible --upgrade

Bash

Copy

确认安装
代码语言:javascript复制
[root@ansible ~]#ansible --version
ansible 2.9.5
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Nov 21 2019, 19:31:34) [GCC 8.3.1 20190507 (Red Hat 8.3.1-4)]

0 人点赞