Servers: Updates across many servers made easy

Managing multiple Servers?

You have more than one VPS and need to manage them all? So once you need to update your packages on all servers you do the same task for each VPS you have running.

This can be very annoying, because you make the same multiple times.

Therefore is a solution. With Ansible you can manage multiple hosts.

The controlling machine (Ansible) deploys modules to your servers using SSH protocol and these modules are stored temporarily on remote nodes and communicate with the Ansible machine through a JSON connection over the standard output.

Ansible is agent-less, that means you do not need any agent installation on your remote servers. That means you do not need any daemon processes on the remote servers. You just need to have the SSH key installed of the controller machine where ansible is installed, on all your remote servers.

Ansible can handle 100’s of remote servers from a single system over SSH connection and the entire operation can be handled and executed by one single command ‘ansible’. When you deploy or configure a new machine there is command ‘ansible-playbook’.

How to install ansible on Ubuntu 16.04

Ansible can be installed simply with:

sudo apt-get install ansible

The file structure of ansible

All files you need to configure Ansible are located in /etc/ansible

here you will find the following structure:

– ansible.cfg
– hosts
d roles
– site.retry
– site.yml

In the directory roles are all your roles located of tasks you want to perform on your remote machines.

Actually there is a directory _template wich you can copy to a directory with you custom role name and you can write your roles by your own.

Alternatively there existing a lot of roles on Galaxy Ansible you can download.

For detailled configuration please refer to the original documentation at

The hosts file

In this file you configure your servers. You also can group them like this:



In the first block are ungrouped servers. The next two blocks are a server group. For deploying changes or upgrades you can also address only specific host groups.

If you have multiple hosts following a pattern you can specify them like this:



Once you configured your ansible installation you can deploy your configurations easily to all servers at once with this shell command:

$ ansible-playbook /etc/ansible/site.yml

That makes it also easy just to deploy a new single server with a standard setup. With the option -l you can limit the playbook to a server group or a single server:

$ ansible-playbook /etc/ansible/site.yml -l dbservers

in this case the playbook will only apply your configuration to the servers in the group dbservers

$ ansible-playbook /etc/ansible/site.yml -l

in this case the playbook applies only for the host “”

Doing upgrades on all your servers, they have Ubuntu installed, you do it with the module apt:

$ ansible all -m apt -a "upgrade=dist" -f 4

Before you apply your configuration and tasks to your servers you can check what ansible will do, without executing any action, by using the option -C

For more information please check the ansible Documentation at

You might also be interested in: