Ansible – Basic installation

Published on Author gryzli

Here are the very basic steps of getting running copy of Ansible.


Clone ansible from Git:

mkdir ansible_install && cd ansible_install

# Clone the source tree
git clone git://

# Now make sure to download/update the core modules:
cd ansible 
git submodule update --init --recursive

# Install some necessary modules
pip install paramiko PyYAML jinja2 httplib2

# Build and install
python build
python install 


Alternatively run ansible from the git cloned directory

If you don’t want to make a system wide ansible install, you could run it from the git cloned directory.

Here are the commands:

# Go to the ansible source directory

cd ansible

# Now source the environment

source hacking/env-setup

You could make sure you are using the alternative ansible by checking with “which”:

which ansible

# It must give something like: 
# Here my source path is: 
# /home/user/ansible_git_source/ 



Create ansible config file

Ansible comes with some example config template here:


The preference for searching and loading config files is as follows (First is the highest precedence):

  • ANSIBLE_CONFIG                   – You can set this environment variable with a path to your desired ansible.cfg
  • $(cwd)/ansible.cfg                     – ansible.cfg in the current working directory
  • /home/$(whoami)/.ansible.cfg   – .ansible.cfg in our /home/$user directory
  • /etc/ansible/ansible.cfg             – system-wide ansible.cfg

One Response to Ansible – Basic installation

  1. On Cent7 now, you can easily get this via Epel.

    sudo yum install -y epel-release
    sudo yum update -y epel-release
    sudo yum install -y ansible