top of page


Getting Started with Ansible for Infrastructure as Code (Introduction & Installation Guide)

As an infrastructure engineer, it may be common that you have to do the same tasks over and over again when you develop servers. It is kind of wasting your time, but ’Ansible’ is useful to eliminate such routine tasks.

What is Ansible?

It is generally known as a configuration management tool for deployment management and configuration management around infrastructure. Chef and Puppet are other typical configuration management tools.

The differences are as follows.


  • Developed by Chef Inc.

  • Requires Agent to be installed on the client to execute it

  • Configuration definition files are written in Ruby, which means the learning cost is high.

  • Released before Ansible and released frequently


  • Developed by Puppet Labs

  • Can be used with an Agent installed on the client running it or as a standalone architecture.

  • The oldest configuration management tool of the three.

  • The configuration definition file is written in Ruby, which means the learning cost is high.


  • Developed by RedHat

  • No need to install an Agent on the client to run it

  • The latest configuration management tool of the three

  • Configuration definition files are written in yaml, which has a low learning cost and is easier to learn.

The differences are as described above, but as for Ansible, it works as long as the client has

Python 2.7 (As of 2023/09) or higher (depending on the Ansible version) is installed and SSH can be used to connect to the client.

Feature of Ansible


Ansible, like other configuration management tools, is characterized by its ability to guarantee equality.

This means that some modules are guaranteed to converge to the same result no matter how many times they are executed.

This is done by the tool itself, without any user intervention.


Control and execute various functions and platform settings in Ansible with a minimum of

Ansible allows you to control and execute various functions and platform settings with a minimum of parameters.

To use these functions, you need to use modules, which are defined functions.

Modules themselves are used for detailed server configuration (yum, user, file)

Some modules are for detailed server settings (yum, user, file), others are for configuring each platform (ec2, azure, gce), and so on.

Each version may or may not be supported, but it can be used.

How to Install Ansible

First, check the installed Python version

#  python --version
Python 2.7.5

Install to specify the epel repository.

# yum install epel-release

Install Ansible.

# yum install --enablerepo=epel ansible
  ansible.noarch 0:2.6.3-1.el7
Dependency Installed:
  PyYAML.x86_64 0:3.10-11.el7       	libtomcrypt.x86_64 0:1.17-26.el7	libtommath.x86_64 0:0.42.0-6.el7  	libyaml.x86_64 0:0.1.4-11.el7_0  make.x86_64 1:3.82-23.el7         	openssl.x86_64 1:1.0.2k-12.el7         	python-babel.noarch 0:0.9.6-8.el7
  python-cffi.x86_64 0:1.6.0-5.el7  	python-enum34.noarch 0:1.0.4-1.el7  python-httplib2.noarch 0:0.9.2-1.el7  python-idna.noarch 0:2.4-1.el7   python-jinja2.noarch 0:2.7.2-2.el7	python-keyczar.noarch 0:0.71c-2.el7    	python-markupsafe.x86_64 0:0.11-10.el7
  python-paramiko.noarch 0:2.1.1-4.el7  python-ply.noarch 0:3.4-11.el7  	python-pycparser.noarch 0:2.14-1.el7  python-six.noarch 0:1.9.0-2.el7  python2-crypto.x86_64 0:2.6.1-15.el7  python2-cryptography.x86_64 0:1.7.2-2.el7  python2-jmespath.noarch 0:0.9.0-3.el7
  python2-pyasn1.noarch 0:0.1.9-7.el7   sshpass.x86_64 0:1.06-2.el7


Install is completed.

# ansible --version
ansible 2.6.3
  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, Jul 13 2018, 13:06:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]


In this article, I have briefly introduced Ansible and explained how to install it.

In the next article, I would like to describe how to make SSH connections from Ansible to other servers and configure various settings after actually installing Ansible.

This blog post is translated from a blog post written by Junichiro Okazaki on our Japanese website Beyond Co..

bottom of page