Installing Ansible to CentOS 8

Aman Singh
3 min readAug 12, 2020

--

Ansible is an infrastructure automation tool. It can be used to configure systems, deploy code & software. It is simple and easy to use. It uses OpenSSH to communicate with nodes. As compare to Puppet and Chef, Ansible manages machines without agent. That is Ansible is a agent-less tool. It’s running system is based on single active node. It has immediate remote execution facility because server is responsible for pushing configuration to all the nodes.

Lets get started with Installation on Ansible on CentOS 8.

First, Install python3 on your machine, following command will take care of that.

#dnf install -y python3 python3-pip

Now, search for centos-release-ansible-29.noarch package.

#dnf search centos-release-ansible

You will get following output:

=============== Name Matched: centos-release-ansible ==============
centos-release-ansible-29.noarch : Ansible 2.9 packages from the CentOS ConfigManagement SIG repository

Install centos-release-ansible-29.noarch with dnf install command and run dnf update command to update the repolist. Now, install ansible with dnf command as following.

[root@localhost ~]# dnf install -y ansible
Last metadata expiration check: 0:00:43 ago on Wed 12 Aug 2020 08:59:50 PM UTC.
Dependencies resolved.
==================================================================== Package Architecture Version Repository Size
====================================================================Installing:
ansible noarch 2.9.12-1.el8 centos-ansible-29 17 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-markupsafe x86_64 0.23-19.el8 AppStream 39 k
python3-pytz noarch 2017.2-9.el8 AppStream 54 k
python3-pyyaml x86_64 3.12-12.el8 BaseOS 193 k
sshpass x86_64 1.06-8.el8 centos-ansible-29 27 k
Installing weak dependencies:
python3-jmespath noarch 0.9.0-11.el8 AppStream 45 k
Transaction Summary
====================================================================Install 8 Packages
Total download size: 23 M
Installed size: 119 M
Is this ok [y/N]: y
Downloading Packages:
(1/8): python3-jmespath-0.9.0-11.el8.noarch.rpm 114 kB/s | 45 kB 00:00
(2/8): python3-markupsafe-0.23-19.el8.x86_64.rpm 530 kB/s | 39 kB 00:00
(3/8): python3-pytz-2017.2-9.el8.noarch.rpm 452 kB/s | 54 kB 00:00
(4/8): python3-pyyaml-3.12-12.el8.x86_64.rpm 1.0 MB/s | 193 kB 00:00
(5/8): python3-jinja2-2.10.1-2.el8_0.noarch.rpm 594 kB/s | 538 kB 00:00
(6/8): sshpass-1.06-8.el8.x86_64.rpm 169 kB/s | 27 kB 00:00
(7/8): python3-babel-2.5.1-5.el8.noarch.rpm 1.2 MB/s | 4.8 MB 00:03
(8/8): ansible-2.9.12-1.el8.noarch.rpm 3.8 MB/s | 17 MB 00:04
-------------------------------------------------------------------------------------------------------------------------------------------------------Total 3.4 MB/s | 23 MB 00:06
warning: /var/cache/dnf/centos-ansible-29-7c8a1e4d33b63b6a/packages/ansible-2.9.12-1.el8.noarch.rpm: Header V4 RSA/SHA1 Signature, key ID 6e8b7e8a: NOKEY
CentOS Configmanagement SIG - ansible-29 1.0 MB/s | 1.0 kB 00:00
Importing GPG key 0x6E8B7E8A:
Userid : "CentOS Config Management SIG (https://wiki.centos.org/SpecialInterestGroup/ConfigManagementSIG) <security@centos.org>"
Fingerprint: C75A FB57 D5C0 F238 CB15 BEC8 1AE1 10FA 6E8B 7E8A
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-ConfigManagement
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.06-8.el8.x86_64 1/8
Installing : python3-pyyaml-3.12-12.el8.x86_64 2/8
Installing : python3-pytz-2017.2-9.el8.noarch 3/8
Installing : python3-babel-2.5.1-5.el8.noarch 4/8
Installing : python3-markupsafe-0.23-19.el8.x86_64 5/8
Installing : python3-jinja2-2.10.1-2.el8_0.noarch 6/8
Installing : python3-jmespath-0.9.0-11.el8.noarch 7/8
Installing : ansible-2.9.12-1.el8.noarch
Running scriptlet: ansible-2.9.12-1.el8.noarch 8/8
Verifying : python3-babel-2.5.1-5.el8.noarch 1/8
Verifying : python3-jinja2-2.10.1-2.el8_0.noarch 2/8
Verifying : python3-jmespath-0.9.0-11.el8.noarch 3/8
Verifying : python3-markupsafe-0.23-19.el8.x86_64 4/8
Verifying : python3-pytz-2017.2-9.el8.noarch 5/8
Verifying : python3-pyyaml-3.12-12.el8.x86_64 6/8
Verifying : ansible-2.9.12-1.el8.noarch 7/8
Verifying : sshpass-1.06-8.el8.x86_64 8/8
Installed:
ansible-2.9.12-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-pytz-2017.2-9.el8.noarch python3-pyyaml-3.12-12.el8.x86_64 sshpass-1.06-8.el8.x86_64
Complete!

After installation run ansible version command to check the installation

[root@localhost ~]# ansible --version
ansible 2.9.12
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /root/.local/lib/python3.6/site-packages/ansible
executable location = /bin/ansible
python version = 3.6.8 (default, Apr 16 2020, 01:36:27) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]

From above you can see we have successfully installed ansible 2.9.12 on CentOS 8.

Looking for hosting related solution visit here …..

--

--

Aman Singh
Aman Singh

Written by Aman Singh

Innovative DevOps Engineer | AWS | GCP |Solutions Architect | Orchestrating Excellence

No responses yet