Ansible-02-Installation

1. Installation

root@ansible:~# apt install ansible

root@ansible:~# ansible --version

ansible 2.5.1
  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/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.17 (default, Mar  8 2023, 18:40:28) [GCC 7.5.0]

root@ansible:~# dpkg -L ansible | less

/etc/ansible/ansible.cfg
/etc/ansible/hosts

2. Configuration

2.1 Config hosts

root@ansible:~# vim /etc/ansible/ansible.cfg

#inventory      = /etc/ansible/hosts

root@ansible:~# vim /etc/ansible/hosts

[zabbix]
192.168.66.120
192.168.66.121
192.168.66.122
192.168.66.123
192.168.66.124
192.168.66.125

[webserver]
10.20.3.[100:120]

[ansible]
192.168.66.120

10.20.2.1
10.20.2.2

root@ansible:~# for i in {1..100}; do echo 10.20.2.$i >> /etc/ansible/hosts;done

2.2 Config ansible.cfg

root@ansible:~# ansible

ansible             ansible-connection  ansible-doc         ansible-inventory   ansible-pull        
ansible-config      ansible-console     ansible-galaxy      ansible-playbook    ansible-vault       

config file privilege

root@ansible:~# ansible --version

ansible 2.5.1
  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/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.17 (default, Mar  8 2023, 18:40:28) [GCC 7.5.0]
root@ansible:~# touch .ansible.cfg

root@ansible:~# ansible --version

ansible 2.5.1
  config file = /root/.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/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.17 (default, Mar  8 2023, 18:40:28) [GCC 7.5.0]
root@ansible:~# mkdir -p /data/ansible

root@ansible:~# cd /data/ansible/

root@ansible:/data/ansible# ansible --version

ansible 2.5.1
  config file = /root/.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/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.17 (default, Mar  8 2023, 18:40:28) [GCC 7.5.0]
root@ansible:/data/ansible# touch ansible.cfg

root@ansible:/data/ansible# ansible --version

ansible 2.5.1
  config file = /data/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/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.17 (default, Mar  8 2023, 18:40:28) [GCC 7.5.0]
root@ansible:/data/ansible# export ANSIBLE_CONFIG=/opt/ansible

root@ansible:/data/ansible# echo $ANSIBLE_CONFIG
/opt/ansible

root@ansible:/data/ansible# ansible --version

ansible 2.5.1
  config file = /data/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/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.17 (default, Mar  8 2023, 18:40:28) [GCC 7.5.0]
  
root@ansible:~# mkdir /opt/ansible/
  
root@ansible:/data/ansible# cd /opt/ansible/

root@ansible:/opt/ansible# ansible --version
ansible 2.5.1
  config file = /opt/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/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.17 (default, Mar  8 2023, 18:40:28) [GCC 7.5.0]

root@ansible:/opt/ansible# export ANSIBLE_CONFIG=/opt/ansible/

root@ansible:/opt/ansible# echo $ANSIBLE_CONFIG
/opt/ansible/

root@ansible:/opt/ansible# ansible --version

ansible 2.5.1
  config file = /opt/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/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.17 (default, Mar  8 2023, 18:40:28) [GCC 7.5.0]

root@ansible:~# vim /opt/ansible/hosts

[test]
1.1.1.1
2.2.2.2

root@ansible:/data/ansible# vim ansible.cfg

inventory      = ./hosts

root@ansible:/data/ansible# cp ./ ansible.cfg /opt/ansible/

root@ansible:/data/ansible# cd /opt/ansible/

root@ansible:/opt/ansible# ll

total 32
drwxr-xr-x 2 root root  4096 Aug 31 13:52 ./
drwxr-xr-x 3 root root  4096 Aug 31 13:42 ../
-rw-r--r-- 1 root root 19302 Aug 31 13:53 ansible.cfg
-rw-r--r-- 1 root root    23 Aug 31 13:44 hosts

root@ansible:/opt/ansible# ansible --version

ansible 2.5.1
  config file = /opt/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/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.17 (default, Mar  8 2023, 18:40:28) [GCC 7.5.0]

root@ansible:/opt/ansible# cd /data/ansible/

root@ansible:/data/ansible# ansible --version

ansible 2.5.1
  config file = /opt/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/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.17 (default, Mar  8 2023, 18:40:28) [GCC 7.5.0]

Recommended to use the current directory, if you have more than one project, manage them separately. Configuration files and host files are managed independently between projects.

root@ansible:/opt/ansible# unset ANSIBLE_CONFIG

root@ansible:/opt/ansible# echo $ANSIBLE_CONFIG

root@ansible:/data/ansible# pwd

/data/ansible

root@ansible:/data/ansible# vim ansible.cfg

root@ansible:/data/ansible# cp /etc/ansible/ansible.cfg

root@ansible:/data/ansible# vim ansible.cfg

Here Ubuntu overwrites without prompting if the file exists, not redhat secure,Red Hat series overrides are aliases that ask if they are overridden before they are overridden

root@ansible:/data/ansible# alias

alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -alF'
alias ls='ls --color=auto'

root@ansible:/opt/ansible# mkdir /data/OA/

root@ansible:/opt/ansible# mkdir /data/FAB/

root@ansible:/opt/ansible# cd /data/OA/

root@ansible:/data/OA# touch ansible.cfg hosts

root@ansible:/data/OA# cd /data/FAB/

root@ansible:/data/FAB# touch ansible.cfg hosts

3. SSH Authentication

The first time you connect you need to enter yes

root@ansible:~# ssh 192.168.66.100

The authenticity of host '192.168.66.100 (192.168.66.100)' can't be established.
ECDSA key fingerprint is SHA256:6MgbSle8hrevYf0ugPivHdG35ekj71HjetVfGUAkfF4.
Are you sure you want to continue connecting (yes/no)? yes

root@ansible:~# ssh 192.168.66.100

root@192.168.66.100's password:

root@ansible:~# ll .ssh/*

-rw-r--r-- 1 root root 222 Sep  1 01:21 .ssh/known_hosts

root@ansible:~# rm -rf .ssh/*

root@ansible:~# ssh 192.168.66.100

The authenticity of host '192.168.66.100 (192.168.66.100)' can't be established.
ECDSA key fingerprint is SHA256:6MgbSle8hrevYf0ugPivHdG35ekj71HjetVfGUAkfF4.
Are you sure you want to continue connecting (yes/no)? 

root@ansible:~# vim /etc/ansible/ansible.cfg

host_key_checking = False

or

root@ansible:~# vim /etc/ssh/ssh_config

    StrictHostKeyChecking ask
    StrictHostKeyChecking no

root@ansible:~# vim /etc/ansible/hosts

192.168.66.100 ansible_ssh_user=root ansible_ssh_password=liang

root@ansible:~# ansible-console

Welcome to the ansible console.
Type help or ? to list commands.

root@all (128)[f:5]$ list

root@all (128)[f:5]$ cd zabbix

root@zabbix (7)[f:5]$ ll

The authenticity of host '192.168.66.120 (192.168.66.120)' can't be established.
ECDSA key fingerprint is SHA256:6MgbSle8hrevYf0ugPivHdG35ekj71HjetVfGUAkfF4.
Are you sure you want to continue connecting (yes/no)? 192.168.66.122 | UNREACHABLE! => {
    "changed": false, 
    "msg": "Failed to connect to the host via ssh: ssh: connect to host 192.168.66.122 port 22: No route to host\r\n", 
    "unreachable": true
}
192.168.66.124 | UNREACHABLE! => {
    "changed": false, 
    "msg": "Failed to connect to the host via ssh: ssh: connect to host 192.168.66.124 port 22: No route to host\r\n", 
    "unreachable": true
}
192.168.66.123 | UNREACHABLE! => {
    "changed": false, 
    "msg": "Failed to connect to the host via ssh: ssh: connect to host 192.168.66.123 port 22: No route to host\r\n", 
    "unreachable": true
}
192.168.66.121 | UNREACHABLE! => {
    "changed": false, 
    "msg": "Failed to connect to the host via ssh: ssh: connect to host 192.168.66.121 port 22: No route to host\r\n", 
    "unreachable": true
}
The authenticity of host '192.168.66.100 (192.168.66.100)' can't be established.
ECDSA key fingerprint is SHA256:6MgbSle8hrevYf0ugPivHdG35ekj71HjetVfGUAkfF4.
Are you sure you want to continue connecting (yes/no)? dir
Please type 'yes' or 'no': 192.168.66.125 | UNREACHABLE! => {
    "changed": false, 
    "msg": "Failed to connect to the host via ssh: ssh: connect to host 192.168.66.125 port 22: No route to host\r\n", 
    "unreachable": true
}

192.168.66.120 | UNREACHABLE! => {
    "changed": false, 
    "msg": "Failed to connect to the host via ssh: Host key verification failed.\r\n", 
    "unreachable": true
}

192.168.66.100 | UNREACHABLE! => {
    "changed": false, 
    "msg": "Failed to connect to the host via ssh: Host key verification failed.\r\n", 
    "unreachable": true
}

root@zabbix (7)[f:5]$ forks 10

root@zabbix (7)[f:10]$ list

192.168.66.120
192.168.66.121
192.168.66.122
192.168.66.123
192.168.66.124
192.168.66.125
192.168.66.100

Note:

yum history
yum history undo 5

1. Installing Ansible on Ubuntu

https://docs.ansible.com/ansible/latest/installation_guide/installation_distros.html#id2

root@ansible-server:~# cat /etc/os-release

NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

root@ansible-server:~# apt update

root@ansible-server:~# apt install software-properties-common

root@ansible-server:~# sudo add-apt-repository --yes --update ppa:ansible/ansible

Cannot add PPA: 'ppa:~ansible/ubuntu/ansible'.
ERROR: '~ansible' user or team does not exist.

root@ansible-server:~# sudo add-apt-repository --yes --update ppa:ansible/ansible

Get:1 http://ppa.launchpad.net/ansible/ansible/ubuntu focal InRelease [18.0 kB]
Get:2 http://ppa.launchpad.net/ansible/ansible/ubuntu focal/main amd64 Packages [1,132 B]
Get:3 http://ppa.launchpad.net/ansible/ansible/ubuntu focal/main Translation-en [756 B]
Hit:4 https://mirrors.aliyun.com/ubuntu focal InRelease                                                                                                                          
Hit:5 https://mirrors.aliyun.com/ubuntu focal-updates InRelease                                                                                                                  
Hit:6 https://mirrors.aliyun.com/ubuntu focal-backports InRelease                                                                                                                
Hit:7 https://mirrors.aliyun.com/ubuntu focal-security InRelease                                                                                                                 
Fetched 19.9 kB in 7s (2,870 B/s)                                                                                                                                                
Reading package lists... Done

root@ansible-server:~# apt install ansible

root@ansible-server:~# ansible --version

ansible [core 2.12.10]
  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/dist-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.8.10 (default, May 26 2023, 14:05:08) [GCC 9.4.0]
  jinja version = 2.10.1
  libyaml = True

root@ansible-server:~# apt list ansible -a

Listing... Done
ansible/focal,now 5.10.0-1ppa~focal all [installed]
ansible/focal 2.9.6+dfsg-1 all

2. Installing Ansible from EPEL

Rocky Linux 8

[root@ansible-01 ~]# yum list ansible

Last metadata expiration check: 1:47:20 ago on Fri 01 Sep 2023 02:26:19 PM CST.
Error: No matching Packages to list

[root@ansible-01 ~]# yum install ansible

Last metadata expiration check: 1:52:16 ago on Fri 01 Sep 2023 02:26:19 PM CST.
No match for argument: ansible
Error: Unable to find a match: ansible

[root@ansible-01 ~]# yum install epel-release.noarch

[root@ansible-01 ~]# yum list ansible

Extra Packages for Enterprise Linux 8 - x86_64                                                                                                    3.2 MB/s |  16 MB     00:04    
Last metadata expiration check: 0:00:04 ago on Fri 01 Sep 2023 04:20:03 PM CST.
Available Packages
ansible.noarch                                                                          7.2.0-1.el8                                                                           epel

[root@ansible-01 ~]# yum install ansible

Last metadata expiration check: 0:02:16 ago on Fri 01 Sep 2023 04:20:03 PM CST.
Dependencies resolved.
==================================================================================================================================================================================
 Package                                                Architecture                      Version                                      Repository                            Size
==================================================================================================================================================================================
Installing:
 ansible                                                noarch                            7.2.0-1.el8                                  epel                                  43 M
Installing dependencies:
 ansible-core                                           x86_64                            2.14.2-4.el8_8                               appstream                            3.4 M
 git-core                                               x86_64                            2.39.3-1.el8_8                               appstream                             11 M
 mpdecimal                                              x86_64                            2.5.1-3.el8                                  appstream                             92 k
 python3.11                                             x86_64                            3.11.2-2.el8_8.1                             appstream                             29 k
 python3.11-cffi                                        x86_64                            1.15.1-1.el8                                 appstream                            292 k
 python3.11-cryptography                                x86_64                            37.0.2-5.el8                                 appstream                            1.1 M
 python3.11-libs                                        x86_64                            3.11.2-2.el8_8.1                             appstream                             10 M
 python3.11-pip-wheel                                   noarch                            22.3.1-2.el8                                 appstream                            1.4 M
 python3.11-ply                                         noarch                            3.11-1.el8                                   appstream                            134 k
 python3.11-pycparser                                   noarch                            2.20-1.el8                                   appstream                            146 k
 python3.11-pyyaml                                      x86_64                            6.0-1.el8                                    appstream                            213 k
 python3.11-setuptools-wheel                            noarch                            65.5.1-2.el8                                 appstream                            719 k
 python3.11-six                                         noarch                            1.16.0-1.el8                                 appstream                             42 k
 sshpass                                                x86_64                            1.09-4.el8                                   appstream                             29 k
Installing weak dependencies:
 python3-jmespath                                       noarch                            0.9.0-11.el8                                 appstream                             44 k

Transaction Summary
==================================================================================================================================================================================
Install  16 Packages

Total download size: 71 M
Installed size: 427 M
Is this ok [y/N]: y
Downloading Packages:
(1/16): mpdecimal-2.5.1-3.el8.x86_64.rpm                                                                                                          180 kB/s |  92 kB     00:00    
(2/16): python3-jmespath-0.9.0-11.el8.noarch.rpm                                                                                                  753 kB/s |  44 kB     00:00    
(3/16): python3.11-3.11.2-2.el8_8.1.x86_64.rpm                                                                                                    418 kB/s |  29 kB     00:00    
(4/16): python3.11-cffi-1.15.1-1.el8.x86_64.rpm                                                                                                   654 kB/s | 292 kB     00:00    
(5/16): git-core-2.39.3-1.el8_8.x86_64.rpm                                                                                                        5.4 MB/s |  11 MB     00:02    
(6/16): ansible-core-2.14.2-4.el8_8.x86_64.rpm                                                                                                    1.6 MB/s | 3.4 MB     00:02    
(7/16): python3.11-cryptography-37.0.2-5.el8.x86_64.rpm                                                                                           1.0 MB/s | 1.1 MB     00:01    
(8/16): python3.11-ply-3.11-1.el8.noarch.rpm                                                                                                      694 kB/s | 134 kB     00:00    
(9/16): python3.11-pycparser-2.20-1.el8.noarch.rpm                                                                                                599 kB/s | 146 kB     00:00    
(10/16): python3.11-pip-wheel-22.3.1-2.el8.noarch.rpm                                                                                             2.1 MB/s | 1.4 MB     00:00    
(11/16): python3.11-pyyaml-6.0-1.el8.x86_64.rpm                                                                                                   828 kB/s | 213 kB     00:00    
(12/16): python3.11-six-1.16.0-1.el8.noarch.rpm                                                                                                   362 kB/s |  42 kB     00:00    
(13/16): sshpass-1.09-4.el8.x86_64.rpm                                                                                                            242 kB/s |  29 kB     00:00    
(14/16): python3.11-setuptools-wheel-65.5.1-2.el8.noarch.rpm                                                                                      1.9 MB/s | 719 kB     00:00    
(15/16): python3.11-libs-3.11.2-2.el8_8.1.x86_64.rpm                                                                                              7.5 MB/s |  10 MB     00:01    
(16/16): ansible-7.2.0-1.el8.noarch.rpm                                                                                                           7.2 MB/s |  43 MB     00:05    
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                             6.4 MB/s |  71 MB     00:11     
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) <epel@fedoraproject.org>"
 Fingerprint: 94E2 79EB 8D8F 25B2 1810 ADF1 21EA 45AB 2F86 D6A1
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
Is this ok [y/N]: y
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                          1/1 
  Installing       : sshpass-1.09-4.el8.x86_64                                                                                                                               1/16 
  Installing       : python3.11-setuptools-wheel-65.5.1-2.el8.noarch                                                                                                         2/16 
  Installing       : python3.11-pip-wheel-22.3.1-2.el8.noarch                                                                                                                3/16 
  Installing       : python3-jmespath-0.9.0-11.el8.noarch                                                                                                                    4/16 
  Installing       : mpdecimal-2.5.1-3.el8.x86_64                                                                                                                            5/16 
  Installing       : python3.11-3.11.2-2.el8_8.1.x86_64                                                                                                                      6/16 
  Running scriptlet: python3.11-3.11.2-2.el8_8.1.x86_64                                                                                                                      6/16 
  Installing       : python3.11-libs-3.11.2-2.el8_8.1.x86_64                                                                                                                 7/16 
  Installing       : python3.11-ply-3.11-1.el8.noarch                                                                                                                        8/16 
  Installing       : python3.11-pycparser-2.20-1.el8.noarch                                                                                                                  9/16 
  Installing       : python3.11-cffi-1.15.1-1.el8.x86_64                                                                                                                    10/16 
  Installing       : python3.11-cryptography-37.0.2-5.el8.x86_64                                                                                                            11/16 
  Installing       : python3.11-pyyaml-6.0-1.el8.x86_64                                                                                                                     12/16 
  Installing       : python3.11-six-1.16.0-1.el8.noarch                                                                                                                     13/16 
  Installing       : git-core-2.39.3-1.el8_8.x86_64                                                                                                                         14/16 
  Installing       : ansible-core-2.14.2-4.el8_8.x86_64                                                                                                                     15/16 
  Installing       : ansible-7.2.0-1.el8.noarch                                                                                                                             16/16 
  Running scriptlet: ansible-7.2.0-1.el8.noarch                                                                                                                             16/16 
  Verifying        : ansible-core-2.14.2-4.el8_8.x86_64                                                                                                                      1/16 
  Verifying        : git-core-2.39.3-1.el8_8.x86_64                                                                                                                          2/16 
  Verifying        : mpdecimal-2.5.1-3.el8.x86_64                                                                                                                            3/16 
  Verifying        : python3-jmespath-0.9.0-11.el8.noarch                                                                                                                    4/16 
  Verifying        : python3.11-3.11.2-2.el8_8.1.x86_64                                                                                                                      5/16 
  Verifying        : python3.11-cffi-1.15.1-1.el8.x86_64                                                                                                                     6/16 
  Verifying        : python3.11-cryptography-37.0.2-5.el8.x86_64                                                                                                             7/16 
  Verifying        : python3.11-libs-3.11.2-2.el8_8.1.x86_64                                                                                                                 8/16 
  Verifying        : python3.11-pip-wheel-22.3.1-2.el8.noarch                                                                                                                9/16 
  Verifying        : python3.11-ply-3.11-1.el8.noarch                                                                                                                       10/16 
  Verifying        : python3.11-pycparser-2.20-1.el8.noarch                                                                                                                 11/16 
  Verifying        : python3.11-pyyaml-6.0-1.el8.x86_64                                                                                                                     12/16 
  Verifying        : python3.11-setuptools-wheel-65.5.1-2.el8.noarch                                                                                                        13/16 
  Verifying        : python3.11-six-1.16.0-1.el8.noarch                                                                                                                     14/16 
  Verifying        : sshpass-1.09-4.el8.x86_64                                                                                                                              15/16 
  Verifying        : ansible-7.2.0-1.el8.noarch                                                                                                                             16/16 

Installed:
  ansible-7.2.0-1.el8.noarch                ansible-core-2.14.2-4.el8_8.x86_64                git-core-2.39.3-1.el8_8.x86_64        mpdecimal-2.5.1-3.el8.x86_64                 
  python3-jmespath-0.9.0-11.el8.noarch      python3.11-3.11.2-2.el8_8.1.x86_64                python3.11-cffi-1.15.1-1.el8.x86_64   python3.11-cryptography-37.0.2-5.el8.x86_64  
  python3.11-libs-3.11.2-2.el8_8.1.x86_64   python3.11-pip-wheel-22.3.1-2.el8.noarch          python3.11-ply-3.11-1.el8.noarch      python3.11-pycparser-2.20-1.el8.noarch       
  python3.11-pyyaml-6.0-1.el8.x86_64        python3.11-setuptools-wheel-65.5.1-2.el8.noarch   python3.11-six-1.16.0-1.el8.noarch    sshpass-1.09-4.el8.x86_64                    

Complete!

[root@ansible-01 ~]# ansible --version

ansible [core 2.14.2]
  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.11/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.11.2 (main, Jun 22 2023, 04:35:24) [GCC 8.5.0 20210514 (Red Hat 8.5.0-18)] (/usr/bin/python3.11)
  jinja version = 3.1.2
  libyaml = True

New version installed By EPEL

[root@ansible-01 ~]# rpm -qi ansible

Name        : ansible
Version     : 7.2.0
Release     : 1.el8
Architecture: noarch
Install Date: Fri 01 Sep 2023 04:24:04 PM CST
Group       : Unspecified
Size        : 344571902
License     : GPL-3.0-or-later AND Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND MIT AND MPL-2.0 AND PSF-2.0
Signature   : RSA/SHA256, Wed 17 May 2023 08:32:07 AM CST, Key ID 21ea45ab2f86d6a1
Source RPM  : ansible-7.2.0-1.el8.src.rpm
Build Date  : Wed 17 May 2023 07:21:38 AM CST
Build Host  : buildvm-s390x-22.s390.fedoraproject.org
Relocations : (not relocatable)
Packager    : Fedora Project
Vendor      : Fedora Project
URL         : https://ansible.com
Bug URL     : https://bugz.fedoraproject.org/ansible
Summary     : Curated set of Ansible collections included in addition to ansible-core
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.

This package provides a curated set of Ansible collections included in addition
to ansible-core.

[root@ansible-01 yum.repos.d]# yum list ansible*

Last metadata expiration check: 0:59:21 ago on Fri 01 Sep 2023 04:20:03 PM CST.
Available Packages
ansible.noarch                                                                                       7.2.0-1.el8                                                         epel     
ansible-collection-ansible-posix.noarch                                                              1.5.4-1.el8                                                         epel     
ansible-collection-ansible-utils.noarch                                                              2.6.1-1.el8                                                         epel     
ansible-collection-chocolatey-chocolatey.noarch                                                      1.4.0-1.el8                                                         epel     
ansible-collection-community-docker.noarch                                                           2.6.0-1.el8                                                         epel     
ansible-collection-community-general.noarch                                                          7.0.0-1.el8                                                         epel     
ansible-collection-community-libvirt.noarch                                                          1.2.0-1.el8                                                         epel     
ansible-collection-community-mysql.noarch                                                            3.5.1-1.el8                                                         epel     
ansible-collection-community-rabbitmq.noarch                                                         1.2.3-1.el8                                                         epel     
ansible-collection-containers-podman.noarch                                                          1.10.1-1.el8                                                        epel     
ansible-collection-microsoft-sql.noarch                                                              1.3.0-3.el8                                                         appstream
ansible-collection-netbox-netbox.noarch                                                              3.7.1-1.el8                                                         epel     
ansible-collection-redhat-rhel_mgmt.noarch                                                           1.1.0-2.el8                                                         appstream
ansible-core.x86_64                                                                                  2.14.2-4.el8_8                                                      appstream
ansible-freeipa.noarch                                                                               1.9.2-3.el8_8                                                       appstream
ansible-freeipa-tests.noarch                                                                         1.9.2-3.el8_8                                                       appstream
ansible-packaging.noarch                                                                             1-8.2.el8                                                           epel     
ansible-pcp.noarch                                                                                   2.2.5-1.el8                                                         appstream
ansible-srpm-macros.noarch                                                                           1-8.2.el8                                                           epel     
ansible-test.x86_64                                                                                  2.14.2-4.el8_8                                                      appstream

[root@ansible-01 yum.repos.d]# yum list | grep ansible-core

ansible-core.x86_64                                               2.14.2-4.el8_8                                             appstream 

[root@ansible-01 ~]# ansible-doc -l |wc -l

7466

https://mirrors.aliyun.com/rockylinux/8.8/AppStream/x86_64/os/Packages/a/?spm=a2c6h.25603864.0.0.1b7d7798Vqvlnp

root@ansible-server:~# dpkg -L ansible | less

3. Remove Ansible By Yum

[root@ansible-01 ~]# yum history

ID     | Command line                                                                                                                | Date and time    | Action(s)      | Altered
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     4 | install ansible                                                                                                             | 2023-09-01 16:23 | Install        |   16   
     3 | install epel-release.noarch                                                                                                 | 2023-09-01 16:19 | Install        |    1 EE
     2 | update                                                                                                                      | 2023-09-01 14:27 | I, U           |   62   
     1 |                                                                                                                             | 2023-09-01 13:44 | Install        |  366 EE

[root@ansible-01 ~]# yum history info 4

Transaction ID : 4
Begin time     : Fri 01 Sep 2023 04:23:42 PM CST
Begin rpmdb    : 370:f225a26b4bf65e613a95382a1a175c1ae9951e5e
End time       : Fri 01 Sep 2023 04:24:05 PM CST (23 seconds)
End rpmdb      : 386:1db75b8f3956885a42096ba5dd3ca16b31ae1c99
User           : root <root>
Return-Code    : Success
Releasever     : 8
Command Line   : install ansible
Comment        : 
Packages Altered:
    Install ansible-core-2.14.2-4.el8_8.x86_64              @appstream
    Install git-core-2.39.3-1.el8_8.x86_64                  @appstream
    Install mpdecimal-2.5.1-3.el8.x86_64                    @appstream
    Install python3-jmespath-0.9.0-11.el8.noarch            @appstream
    Install python3.11-3.11.2-2.el8_8.1.x86_64              @appstream
    Install python3.11-cffi-1.15.1-1.el8.x86_64             @appstream
    Install python3.11-cryptography-37.0.2-5.el8.x86_64     @appstream
    Install python3.11-libs-3.11.2-2.el8_8.1.x86_64         @appstream
    Install python3.11-pip-wheel-22.3.1-2.el8.noarch        @appstream
    Install python3.11-ply-3.11-1.el8.noarch                @appstream
    Install python3.11-pycparser-2.20-1.el8.noarch          @appstream
    Install python3.11-pyyaml-6.0-1.el8.x86_64              @appstream
    Install python3.11-setuptools-wheel-65.5.1-2.el8.noarch @appstream
    Install python3.11-six-1.16.0-1.el8.noarch              @appstream
    Install sshpass-1.09-4.el8.x86_64                       @appstream
    Install ansible-7.2.0-1.el8.noarch                      @epel

[root@ansible-01 ~]# yum history undo 4

posted @ 2023-09-01 23:45  LandonXing  阅读(11)  评论(0)    收藏  举报