Ansible is an IT orchestration tool I’ve been playing with lately. Similar tools include Chef and Puppet. Some cools things about Ansible is that it is open source, and you don’t need anything in your target machine (it just uses an ssh connection).
In this quickstart, I’ll build an Ansible playbook to manage a personal Ubuntu desktop.
First step is to install Ansible. For Ubuntu, a repository is available:
Additional installation methods can be found in this page.
Now, we create a directory that will hold our playbook:
A playbook is the source of instructions that ansible will run when provisioning.
Ansible expects instructions in the yml format. Lets populate our playbook with an initial content:
The next step is to create an inventory file. This will hold a list of servers Ansible can run with:
Now, lets create our roles. For this example, the idea is to have a system role that is responsible for setting up system libraries.
And our system main task:
And this is the content of our sytems task:
Now, to run our playbook:
-K will ask for the machine sudo password. -i will pass the inventory file to use.