1.0 安装

准备环境

开始安装

yum list ansible –showduplicates | sort -r yum install ansible-2.9.15

准确指定版本号,我们不想每次安装的Ansible版本不一致

相关冗余输出

[root@192-168-31-106 ~]# yum list ansible --showduplicates | sort -r
ansible.noarch                         2.9.15-1.el7                         epel

[root@192-168-31-106 ~]# yum install ansible-2.9.15
================================================================================================
 Package                       Arch            Version                    Repository       Size
================================================================================================
Installing:
 ansible                       noarch          2.9.15-1.el7               epel             17 M
Installing for dependencies:
 PyYAML                        x86_64          3.10-11.el7                base            153 k
 libyaml                       x86_64          0.1.4-11.el7_0             base             55 k
 python-babel                  noarch          0.9.6-8.el7                base            1.4 M
 python-cffi                   x86_64          1.6.0-5.el7                base            218 k
 python-enum34                 noarch          1.0.4-1.el7                base             52 k
 python-idna                   noarch          2.4-1.el7                  base             94 k
 python-jinja2                 noarch          2.7.2-4.el7                base            519 k
 python-markupsafe             x86_64          0.11-10.el7                base             25 k
 python-paramiko               noarch          2.1.1-9.el7                base            269 k
 python-ply                    noarch          3.4-11.el7                 base            123 k
 python-pycparser              noarch          2.14-1.el7                 base            104 k
 python2-cryptography          x86_64          1.7.2-2.el7                base            502 k
 python2-httplib2              noarch          0.18.1-3.el7               epel            125 k
 python2-jmespath              noarch          0.9.4-2.el7                epel             41 k
 python2-pyasn1                noarch          0.1.9-7.el7                base            100 k
 sshpass                       x86_64          1.06-2.el7                 extras           21 k
Transaction Summary
================================================================================================

检查是否安装成功

[root@192-168-31-106 ~]# ansible --version
ansible 2.9.15
  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, Apr  2 2020, 13:16:51) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]