Preparing management server

In order to make managing servers in environment easier, and also make it possible to scale it let’s install Ansible on management server mgmt01. In addition, in this post I will cover some basic configuration using Ansible, including installation of Jenkins which we will use later in the project to create CI/CD pipeline.

Process of installing Ansible together with it’s dependencies on CentOS 8 is widely covered in technical articles, like this one. However, I would like to touch on configuration after the product is installed.

One important step in configuration is to make sure that all other nodes in environment are listed in hosts configuration file and added to Ansible inventory. To do that create file /etc/ansible/hosts and if you follow the same naming convention and IP addresses assignment add following content:

content of /etc/ansible/hosts file

This way IP addresses of remote nodes will be resolvable on management host and Ansible will treat them as an inventory. Additionally, thanks to dividing them into collections like “app” or “rep”(reporting), it will be easy to scale environment by adding IP addresses of new servers if such need arises.

After the file is created you should confirm that it’s content is treated as an inventory by running following command:

ansible-inventory --list

You should see output similar to the one below:

Ansible inventory

There is one more thing to do configuration wise, which is optional, but I will include this one for purpose of presenting best practices. I am taking about securing connection between management server and managed nodes. For this we will require a SSH key. It can be generated using command:


By default the resulting file will be placed in directory /home/currentuser/.ssh/id_rsa. In next blog post I will describe how to automatically distribute the private key on management nodes by creating base role and running first Ansible playbook in this project. Stay tuned!

Leave a Reply

Your email address will not be published. Required fields are marked *