Ansible · Configuration management · Debian · Debian 8

Installing and configuring Ansible on Debian Jessie

Ansible is shipped with Debian through the official repository. The Ansible version available through Debian repository is 1.7.

In this article let’s assume the following details for the machines

Server – Hostname: server, IP :

Node1 – Hostname: node1, IP :

Node2 – Hostname: node2, IP :

Ansible is available in Debian repository. Install Ansible using the following command.

apt-get install ansible

Generate ssh keypair on the Ansible server.


Do the following on nodes

Copy the public key of the server to all the nodes

cat .ssh/ (On Server to copy public key)

Append the public key copied from the server to .ssh/authorized_keys file on all the nodes

Once the keys have been copied we can check them key using the following commands on the server.

# ssh root@node-1
# ssh root@node-x

The above command should login directly and not wait for a password.

Edit /etc/ansible/hosts and append the following lines

node1 ansible_ssh_host=
node2 ansible_ssh_host=

Check the reachabilty of these nodes by using this following command

# ansible -m ping all


node2 | SUCCESS => {
"changed": false,
"ping": "pong"
node1 | SUCCESS => {
"changed": false,
"ping": "pong"

We can use another command to check a particular node.

ansible -m raw -a 'df' node1


node1 | success | rc=0 >>
Filesystem     1K-blocks   Used Available Use% Mounted on
/dev/sda1        7736784 956916   6363820  14% /
udev               10240      0     10240   0% /dev
tmpfs             204876   4416    200460   3% /run
tmpfs             512184      0    512184   0% /dev/shm
tmpfs               5120      0      5120   0% /run/lock
tmpfs             512184      0    512184   0% /sys/fs/cgroup

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s