Hi,

First off I wanted to say that I've been using Ansible for a while now and 
so far I'm really pleased with it.
The product is powerful and flexible and the community is alive and helpful.

I was hoping that some of you might be able to share your insights on how 
to best approach the following:

I have 'x' backend hosts and 'y' frontend hosts. Each backend host runs 5 
instances of a certain application, each with their own configuration.
Currently I have these defined through group_vars, such as:

[be-hosts]
my-backend-host[1:6]

[fe-hosts]
my-frontend-host[1:15]

This way I can easily apply a playbook against all of the backend or 
frontend hosts.
However, the challenge lies in defining the application instances, which 
I'd really like to be somewhat more dynamic.
Currently I drive this through host_vars such as:

my-backend-host1
instances: { start: 1, end: 5 }

my-backend-host2
instances: { start: 6, end: 10 }

etc.

One of my roles contains a directory called 'instances' with 
sub-directories called instanceN, the files from these directories are 
copied/templated using a 'with_sequence' loop.
However, I would really like to be able to specify certain variables on a 
host/group level for a specific instance which with this setup I can't; 
well I can by defining instanceN.someVariable of course but it's not really 
clean, nor is it easy to limit execution to a single instance this way.

In short, I would like to be able to treat those application instances like 
one can treat hosts using group_vars / limit etc. 
What would also be nice is being able to intelligently allocate the 
instances based on the hostname (host1 = 1 -  5, host2 = 6 - 10, host3 = 11 
- 15, so that would be something like start=(hostN - 1) * 5 end=(hostN * 5))

Any advice? Would you suggest a completely different approach?

Thanks for sharing your insights,
Nico.


  


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/62e5d735-f040-4798-a759-d26113e576aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to