闻心 發表於 2020-6-17 16:22:00

CentOS 8 Yum安装ansible

<h1 id="ansible的安装">ansible的安装</h1>
<p>直接yum安装ansible会报错,需要先安装epel源。<br>
ansible的安装来源于epel仓库,因此在安装前需确保安装了正确的epel源。</p>
<pre><code>yum install -y epel-release
yum install -y ansible
</code></pre>
<pre><code># yum -y install ansible
Last metadata expiration check: 0:00:29 ago on Tue 16 Jun 2020 04:29:04 PM EDT.
No match for argument: ansible
Error: Unable to find a match: ansible
# ansible --version
-bash: ansible: command not found
# yum install -y epel-release
CentOS-8 - AppStream                               7.2 kB/s | 4.3 kB   00:00   
CentOS-8 - Base                                    2.3 kB/s | 3.9 kB   00:01   
CentOS-8 - Extras                                  3.1 kB/s | 1.5 kB   00:00   
Dependencies resolved.
===================================================================================
Package                Architecture   Version            Repository      Size
===================================================================================
Installing:
epel-release         noarch         8-8.el8            extras            23 k

Transaction Summary
===================================================================================
Install1 Package

Total download size: 23 k
Installed size: 32 k
Downloading Packages:
epel-release-8-8.el8.noarch.rpm                     53 kB/s |23 kB   00:00   
-----------------------------------------------------------------------------------
Total                                             27 kB/s |23 kB   00:00   
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing      :                                                         1/1
Installing       : epel-release-8-8.el8.noarch                               1/1
Running scriptlet: epel-release-8-8.el8.noarch                               1/1
Verifying      : epel-release-8-8.el8.noarch                               1/1

Installed:
epel-release-8-8.el8.noarch                                                      

Complete!
# yum info ansible
Extra Packages for Enterprise Linux Modular 8 - x819 kB/s | 119 kB   00:06   
Extra Packages for Enterprise Linux 8 - x86_64   776 kB/s | 7.0 MB   00:09   
Available Packages
Name         : ansible
Version      : 2.9.9
Release      : 1.el8
Architecture : noarch
Size         : 17 M
Source       : ansible-2.9.9-1.el8.src.rpm
Repository   : epel
Summary      : SSH-based configuration management, deployment, and task execution
             : system
URL          : http://ansible.com
License      : GPLv3+
Description: Ansible is a radically simple model-driven configuration management,
             : multi-node deployment, and remote task execution system. Ansible
             : works over SSH and does not require any software or daemons to be
             : installed on remote nodes. Extension modules can be written in any
             : language and are transferred to managed machines automatically.

# yum -y install ansible
Last metadata expiration check: 0:00:25 ago on Tue 16 Jun 2020 05:06:21 PM EDT.
Dependencies resolved.
===================================================================================
Package             Arch   Version                              Repo       Size
===================================================================================
Installing:
ansible             noarch 2.9.9-1.el8                            epel       17 M
Upgrading:
platform-python-pip noarch 9.0.3-16.el8                           BaseOS    1.8 M
Installing dependencies:
python3-babel       noarch 2.5.1-5.el8                            AppStream 4.8 M
python3-jinja2      noarch 2.10.1-2.el8_0                         AppStream 538 k
python3-jmespath    noarch 0.9.0-11.el8                           AppStream45 k
python3-markupsafex86_64 0.23-19.el8                            AppStream39 k
python3-pip         noarch 9.0.3-16.el8                           AppStream19 k
python3-pyasn1      noarch 0.3.7-6.el8                            AppStream 126 k
python3-pytz      noarch 2017.2-9.el8                           AppStream54 k
python36            x86_64 3.6.8-2.module_el8.1.0+245+c39af44f    AppStream19 k
python3-setuptoolsnoarch 39.2.0-5.el8                           BaseOS    162 k
libsodium         x86_64 1.0.18-2.el8                           epel      162 k
python3-bcrypt      x86_64 3.1.6-2.el8.1                        epel       44 k
python3-pynacl      x86_64 1.3.0-5.el8                            epel      100 k
sshpass             x86_64 1.06-9.el8                           epel       27 k
Installing weak dependencies:
python3-paramiko    noarch 2.4.3-1.el8                            epel      289 k
Enabling module streams:
python36                   3.6                                                   

Transaction Summary
===================================================================================
Install15 Packages
Upgrade   1 Package

Total download size: 25 M
Downloading Packages:
(1/16): python3-jmespath-0.9.0-11.el8.noarch.rpm   424 kB/s |45 kB   00:00   
(2/16): python3-markupsafe-0.23-19.el8.x86_64.rpm543 kB/s |39 kB   00:00   
(3/16): python3-pip-9.0.3-16.el8.noarch.rpm      580 kB/s |19 kB   00:00   
(4/16): python3-pyasn1-0.3.7-6.el8.noarch.rpm      583 kB/s | 126 kB   00:00   
(5/16): python3-pytz-2017.2-9.el8.noarch.rpm       1.0 MB/s |54 kB   00:00   
(6/16): python36-3.6.8-2.module_el8.1.0+245+c39af4 250 kB/s |19 kB   00:00   
(7/16): python3-jinja2-2.10.1-2.el8_0.noarch.rpm   745 kB/s | 538 kB   00:00   
(8/16): python3-setuptools-39.2.0-5.el8.noarch.rpm 775 kB/s | 162 kB   00:00   
(9/16): python3-babel-2.5.1-5.el8.noarch.rpm       2.4 MB/s | 4.8 MB   00:01   
(10/16): python3-bcrypt-3.1.6-2.el8.1.x86_64.rpm   118 kB/s |44 kB   00:00   
(11/16): libsodium-1.0.18-2.el8.x86_64.rpm          89 kB/s | 162 kB   00:01   
(12/16): python3-pynacl-1.3.0-5.el8.x86_64.rpm   674 kB/s | 100 kB   00:00   
(13/16): sshpass-1.06-9.el8.x86_64.rpm            71 kB/s |27 kB   00:00   
(14/16): platform-python-pip-9.0.3-16.el8.noarch.r 4.6 MB/s | 1.8 MB   00:00   
(15/16): python3-paramiko-2.4.3-1.el8.noarch.rpm    92 kB/s | 289 kB   00:03   
(16/16): ansible-2.9.9-1.el8.noarch.rpm            976 kB/s |17 MB   00:18   
-----------------------------------------------------------------------------------
Total                                              982 kB/s |25 MB   00:26   
warning: /var/cache/dnf/epel-6519ee669354a484/packages/ansible-2.9.9-1.el8.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 2f86d6a1: NOKEY
Extra Packages for Enterprise Linux 8 - x86_64   1.6 MB/s | 1.6 kB   00:00   
Importing GPG key 0x2F86D6A1:
Userid   : "Fedora EPEL (8) &lt;epel@fedoraproject.org&gt;"
Fingerprint: 94E2 79EB 8D8F 25B2 1810 ADF1 21EA 45AB 2F86 D6A1
From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing      :                                                         1/1
Installing       : python3-setuptools-39.2.0-5.el8.noarch                   1/17
Upgrading      : platform-python-pip-9.0.3-16.el8.noarch                  2/17
Installing       : python36-3.6.8-2.module_el8.1.0+245+c39af44f.x86_64      3/17
Running scriptlet: python36-3.6.8-2.module_el8.1.0+245+c39af44f.x86_64      3/17
Installing       : python3-pip-9.0.3-16.el8.noarch                        4/17
Installing       : sshpass-1.06-9.el8.x86_64                              5/17
Installing       : python3-bcrypt-3.1.6-2.el8.1.x86_64                      6/17
Installing       : libsodium-1.0.18-2.el8.x86_64                            7/17
Installing       : python3-pynacl-1.3.0-5.el8.x86_64                        8/17
Installing       : python3-pytz-2017.2-9.el8.noarch                         9/17
Installing       : python3-babel-2.5.1-5.el8.noarch                        10/17
Installing       : python3-pyasn1-0.3.7-6.el8.noarch                     11/17
Installing       : python3-paramiko-2.4.3-1.el8.noarch                     12/17
Installing       : python3-markupsafe-0.23-19.el8.x86_64                   13/17
Installing       : python3-jinja2-2.10.1-2.el8_0.noarch                  14/17
Installing       : python3-jmespath-0.9.0-11.el8.noarch                  15/17
Installing       : ansible-2.9.9-1.el8.noarch                              16/17
Cleanup          : platform-python-pip-9.0.3-15.el8.noarch               17/17
Running scriptlet: platform-python-pip-9.0.3-15.el8.noarch               17/17
Verifying      : python3-babel-2.5.1-5.el8.noarch                         1/17
Verifying      : python3-jinja2-2.10.1-2.el8_0.noarch                     2/17
Verifying      : python3-jmespath-0.9.0-11.el8.noarch                     3/17
Verifying      : python3-markupsafe-0.23-19.el8.x86_64                  4/17
Verifying      : python3-pip-9.0.3-16.el8.noarch                        5/17
Verifying      : python3-pyasn1-0.3.7-6.el8.noarch                        6/17
Verifying      : python3-pytz-2017.2-9.el8.noarch                         7/17
Verifying      : python36-3.6.8-2.module_el8.1.0+245+c39af44f.x86_64      8/17
Verifying      : python3-setuptools-39.2.0-5.el8.noarch                   9/17
Verifying      : ansible-2.9.9-1.el8.noarch                              10/17
Verifying      : libsodium-1.0.18-2.el8.x86_64                           11/17
Verifying      : python3-bcrypt-3.1.6-2.el8.1.x86_64                     12/17
Verifying      : python3-paramiko-2.4.3-1.el8.noarch                     13/17
Verifying      : python3-pynacl-1.3.0-5.el8.x86_64                     14/17
Verifying      : sshpass-1.06-9.el8.x86_64                               15/17
Verifying      : platform-python-pip-9.0.3-16.el8.noarch               16/17
Verifying      : platform-python-pip-9.0.3-15.el8.noarch               17/17

Upgraded:
platform-python-pip-9.0.3-16.el8.noarch                                          

Installed:
ansible-2.9.9-1.el8.noarch                                                      
python3-paramiko-2.4.3-1.el8.noarch                                             
python3-babel-2.5.1-5.el8.noarch                                                
python3-jinja2-2.10.1-2.el8_0.noarch                                             
python3-jmespath-0.9.0-11.el8.noarch                                             
python3-markupsafe-0.23-19.el8.x86_64                                          
python3-pip-9.0.3-16.el8.noarch                                                
python3-pyasn1-0.3.7-6.el8.noarch                                                
python3-pytz-2017.2-9.el8.noarch                                                
python36-3.6.8-2.module_el8.1.0+245+c39af44f.x86_64                              
python3-setuptools-39.2.0-5.el8.noarch                                          
libsodium-1.0.18-2.el8.x86_64                                                   
python3-bcrypt-3.1.6-2.el8.1.x86_64                                             
python3-pynacl-1.3.0-5.el8.x86_64                                                
sshpass-1.06-9.el8.x86_64                                                      

Complete!
</code></pre>
<p>检查ansible版本</p>
<pre><code># type ansible
ansible is /usr/bin/ansible
# ansible --version
ansible 2.9.9
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)
</code></pre>


</div>
<div id="MySignature" role="contentinfo">
    * * *
胖并快乐着的死肥宅
* * *<br><br>
来源:https://www.cnblogs.com/bpzblog/p/13153093.html
頁: [1]
查看完整版本: CentOS 8 Yum安装ansible