一、Ansible 安装
CentOS 安装
安装 epel 源
$ yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
安装 ansible
$ yum install ansible
Ubuntu 安装
安装 PPA 源
$ apt-get install software-properties-common
$ apt-add-repository ppa:ansible/ansible
$ apt-get update
安装 ansible
$ apt-get install ansible
确认安装结果
$ ansible --version
ansible 2.9.25
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, Nov 16 2020, 22:23:17) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
PIP 安装(推荐)
相较于使用 yum、apt 系统包管理工具,个人更推荐使用 pip,因后者版本更新,且版本可控,安装方式很简单
$ pip install ansible==7.4.0 ansible-core==2.14.4