# Is Ansible the right tool for what I want to do?

**URL:** <https://forum.ansible.com/t/is-ansible-the-right-tool-for-what-i-want-to-do/18720>\
**Category:** Ansible Project\
**Created:** [July 9, 2015, 8:25pm UTC](https://forum.ansible.com/t/is-ansible-the-right-tool-for-what-i-want-to-do/18720 "2015-07-09T20:25:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim\_Skoch](https://avatars.discourse-cdn.com/v4/letter/t/ea666f/32.png) [@Tim\_Skoch](https://forum.ansible.com/u/Tim_Skoch)\
**Post date:** [July 9, 2015, 8:25pm UTC](https://forum.ansible.com/t/is-ansible-the-right-tool-for-what-i-want-to-do/18720/1 "2015-07-09T20:25:59Z")

</div>

I’m setting up a lab with a bunch of VMs, and each of these VMs will serve one of a set of purposes (mostly servers). In setting up each one, I’m keeping detailed notes of exactly what I have installed, configuration changes I have made, etc. The setup process is tedious enough that even with detailed notes, I’m not excited at the prospect of having to rebuild one of these. Ideally I would like to be able to delete and quickly rebuild a particular machine from the ground up as quickly as possible.

A friend recommended Ansible as the solution to this. I’ve been reading the introduction docs, and it looks like Ansible is exactly what I have been looking for - My Ansible “Playbooks/Plays/Tasks/Modules” would then _become_ my detailed notes, and I would get the added benefit of being able to version them as well.

Here is what I _think_ I want to do so far, but I want to make sure I’m going down the right path before I get too far down it. Suppose for example that I need two “Mailserver” type server VMs, one “Desktop” type VM, and three “Database” servers. Each of those quoted “types” has its own set of services which need to be set up, daemons configured, and various other tweaks.

Am I correct that what I want to do here is set up one “Playbook”, which contains a “Play” for each of these types? And each of those “Plays” would contain various tasks/modules to set the machine up in the desired configuration? Do “Roles” come into play here? Maybe I need a “Role” for each type, instead of a “Play”?

Thanks!

---

<div class="post-metadata">

**Author:** ![Greg\_DeKoenigsberg1](https://avatars.discourse-cdn.com/v4/letter/g/838e76/32.png) [@Greg\_DeKoenigsberg1](https://forum.ansible.com/u/Greg_DeKoenigsberg1)\
**Post date:** [July 10, 2015, 2:35pm UTC](https://forum.ansible.com/t/is-ansible-the-right-tool-for-what-i-want-to-do/18720/2 "2015-07-10T14:35:04Z")

</div>

> I'm setting up a lab with a bunch of VMs, and each of these VMs will serve  
> one of a set of purposes (mostly servers). In setting up each one, I'm  
> keeping detailed notes of exactly what I have installed, configuration  
> changes I have made, etc. The setup process is tedious enough that even  
> with detailed notes, I'm not excited at the prospect of having to rebuild  
> one of these. Ideally I would like to be able to delete and quickly rebuild  
> a particular machine from the ground up as quickly as possible.

This is pretty much the ideal Ansible use case.

> A friend recommended Ansible as the solution to this. I've been reading the  
> introduction docs, and it looks like Ansible is exactly what I have been  
> looking for - My Ansible "Playbooks/Plays/Tasks/Modules" would then become  
> my detailed notes, and I would get the added benefit of being able to  
> version them as well.

Yep!

> Here is what I think I want to do so far, but I want to make sure I'm going  
> down the right path before I get too far down it. Suppose for example that  
> I need two "Mailserver" type server VMs, one "Desktop" type VM, and three  
> "Database" servers. Each of those quoted "types" has its own set of  
> services which need to be set up, daemons configured, and various other  
> tweaks.
> 
> Am I correct that what I want to do here is set up one "Playbook", which  
> contains a "Play" for each of these types? And each of those "Plays" would  
> contain various tasks/modules to set the machine up in the desired  
> configuration? Do "Roles" come into play here? Maybe I need a "Role" for  
> each type, instead of a "Play"?

You're spot on.

Roles are for reusability. Let's say those two Mailserver-type VMs end  
up becoming many VMs, all with small differences between them. You  
would build a single "mailserver" role and then you could invoke it  
from different playbooks using different variables each time.

If I were in your shoes, I'd just run full speed ahead with playbooks.  
Get comfortable with those, and then you can read up on roles and  
refactor using them more heavily if you see fit.

Good luck!

--g

---

<div class="post-metadata">

**Author:** ![Toshio\_Kuratomi](https://avatars.discourse-cdn.com/v4/letter/t/41988e/32.png) [@Toshio\_Kuratomi](https://forum.ansible.com/u/Toshio_Kuratomi)\
**Post date:** [July 10, 2015, 2:41pm UTC](https://forum.ansible.com/t/is-ansible-the-right-tool-for-what-i-want-to-do/18720/3 "2015-07-10T14:41:09Z")

</div>

> A friend recommended Ansible as the solution to this. I’ve been reading the introduction docs, and it looks like Ansible is exactly what I have been looking for - My Ansible “Playbooks/Plays/Tasks/Modules” would then become my detailed notes, and I would get the added benefit of being able to version them as well.

Yes, ansible (or config management software in general but on this list we’re mostly making ansible our choice for config management 😉 is a good choice for this problem.

> Here is what I think I want to do so far, but I want to make sure I’m going down the right path before I get too far down it. Suppose for example that I need two “Mailserver” type server VMs, one “Desktop” type VM, and three “Database” servers. Each of those quoted “types” has its own set of services which need to be set up, daemons configured, and various other tweaks.
> 
> Am I correct that what I want to do here is set up one “Playbook”, which contains a “Play” for each of these types?

There are multiple ways to organize your tasks, plays, and playbooks but this sounds like one reasonable way to do it. You may find it a little better to have two levels of playbooks:

- a playbook that has a play for each type of vm that you’re managing
- a master config playbook that includes the playbooks for each type of vm.

That is one way to make it possible to run the plays for each type of vm separately (for instance when testing or when saving time on deploying a change to just one type of vm) in some cases and together in others (when making sure that your whole lab has the current config for instance)

> And each of those “Plays” would contain various tasks/modules to set the machine up in the desired configuration?

Yes, exactly.

Here’s a brief set of files that demonstrate that:

$ cat master.yml
