HostOnNet Blog


Ansible is a DevOps tool, used for managing servers. Ansible allow you to manage multiple servers easily. With ansible playbook, you can automate complex server administration and deployment tasks.


Installing Ansible

To install Ansible on Ubuntu, run

sudo apt-get install ansible

Quick Start

We need to create a file with name “hosts”, that list all our servers. We can group them under differnt category, for example, webservers, dbservers, etc.. so we can manage them easily.

Here is my hosts file

boby@hon-pc-01:~/www/ansible $ cat hosts 
boby@hon-pc-01:~/www/ansible $

You can specify user and port in the server list. Or you can specify it in ansible.cfg

Now, lets run

boby@hon-pc-01:~/www/ansible $ ansible -i hosts cpanelservers -a "uptime" | success | rc=0 >>
 17:47:55 up  1:51,  1 user,  load average: 0.46, 0.44, 0.49 | success | rc=0 >>
 17:49:05 up 94 days, 10:02,  1 user,  load average: 2.47, 2.42, 2.11

boby@hon-pc-01:~/www/ansible $ 

Ansible run the command “uptime” on all servers listed in cpanelservers group and print out the result.

This is very basic usage of ansible. You can use Ansible playbook for complex software installation/management tasks.


Posted in Linux