Re: [ansible-project] Re: group_vars and ansible's patterns - suggestions please!

2016-10-27 Thread Dan Rough
This is really useful Allen. Thanks!

Dynamically including vars files was another option we'd considered. We had 
discounted it though as we were going to have to litter the include statement 
throughout our play books and roles which we didn't like. Your dynamic_vars 
playbook is a neat solution to the problem.

Dan

> On 26 Oct 2016, at 22:50, Allen Sanabria  wrote:
> 
> I use to use group_vars/. Instead I use vars/ now. Since include_vars plugin 
> now supports directories and you can limit the depth of the include. Here is 
> an example on how I manage vars/ today 
> https://github.com/linuxdynasty/ansible-examples/tree/master/playbooks
> 
>> On Wednesday, October 26, 2016 at 1:39:21 PM UTC-7, Dan Rough wrote:
>> Hi,
>> 
>> I'd like to know how others are dealing with keeping their group_vars files 
>> granular. Ours have become a little unwieldily and we're considering 
>> approaches to breaking them apart.
>> 
>> When we provision a server, we assign it to a number of groups. Among those 
>> groups, each server is added to at least three groups. Firstly, we add it to 
>> a group which defines its role, for example app_server. Another group 
>> represents the location of the DC that the server is in, which might be LON, 
>> for example. Thirdly, we also add it to a group which denotes whether it is 
>> a production server or a test server, prod, for example. That allows us to 
>> use ansible's patterns when we're configuring the server to do something 
>> like this: - hosts: "prod::_server" or - hosts: 
>> "prod::_server".
>> 
>> We have a variables which need to be defined based on these three variables, 
>> Environment, Region and Role. Our current thinking is to create a group_vars 
>> file for each of the possible combinations, prod_LON_app_server, for 
>> example. The affect of this decision will mean that we're going to see an 
>> explosion in the number of groups a server is added to, and the number of 
>> group_vars files we maintain.
>> 
>> Before we take this route, can anyone tell me if we're missing a trick? Is 
>> there a technique that we're missing?
>> 
>> Thanks!
>> 
>> Dan.
> 
> -- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "Ansible Project" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/ansible-project/_Fvptfvs-gk/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/3b610f47-2e53-4196-8710-024fe7e3f01b%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1D9951D3-6DA8-425E-94B8-E6CFC1828B0E%40gamevy.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: group_vars and ansible's patterns - suggestions please!

2016-10-26 Thread Allen Sanabria
I use to use group_vars/. Instead I use vars/ now. Since include_vars 
plugin now supports directories and you can limit the depth of the include. 
Here is an example on how I manage vars/ 
today https://github.com/linuxdynasty/ansible-examples/tree/master/playbooks

On Wednesday, October 26, 2016 at 1:39:21 PM UTC-7, Dan Rough wrote:
>
> Hi,
>
> I'd like to know how others are dealing with keeping their group_vars 
> files granular. Ours have become a little unwieldily and we're considering 
> approaches to breaking them apart.
>
> When we provision a server, we assign it to a number of groups. Among 
> those groups, each server is added to at least three groups. Firstly, we 
> add it to a group which defines its role, for example app_server. Another 
> group represents the location of the DC that the server is in, which might 
> be LON, for example. Thirdly, we also add it to a group which denotes 
> whether it is a production server or a test server, prod, for example. That 
> allows us to use ansible's patterns when we're configuring the server to do 
> something like this: - hosts: "prod::_server" or - hosts: 
> "prod::_server".
>
> We have a variables which need to be defined based on these three 
> variables, Environment, Region and Role. Our current thinking is to create 
> a group_vars file for each of the possible combinations, 
> prod_LON_app_server, for example. The affect of this decision will mean 
> that we're going to see an explosion in the number of groups a server is 
> added to, and the number of group_vars files we maintain.
>
> Before we take this route, can anyone tell me if we're missing a trick? Is 
> there a technique that we're missing?
>
> Thanks!
>
> Dan.
>

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3b610f47-2e53-4196-8710-024fe7e3f01b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: group_vars and ansible's patterns - suggestions please!

2016-10-26 Thread Dan Rough
That's a good idea. Thanks! I hadn't thought of that. That will simplify things 
in one or two locations.

> On 26 Oct 2016, at 22:01, Alexander H. Laughlin  
> wrote:
> 
> Hi Dan,
> 
> Why not store the values in a dictionary and just pull the values you need 
> for any given server based on its key?
> 
> Alex
> 
>> On Wednesday, October 26, 2016 at 1:39:21 PM UTC-7, Dan Rough wrote:
>> Hi,
>> 
>> I'd like to know how others are dealing with keeping their group_vars files 
>> granular. Ours have become a little unwieldily and we're considering 
>> approaches to breaking them apart.
>> 
>> When we provision a server, we assign it to a number of groups. Among those 
>> groups, each server is added to at least three groups. Firstly, we add it to 
>> a group which defines its role, for example app_server. Another group 
>> represents the location of the DC that the server is in, which might be LON, 
>> for example. Thirdly, we also add it to a group which denotes whether it is 
>> a production server or a test server, prod, for example. That allows us to 
>> use ansible's patterns when we're configuring the server to do something 
>> like this: - hosts: "prod::_server" or - hosts: 
>> "prod::_server".
>> 
>> We have a variables which need to be defined based on these three variables, 
>> Environment, Region and Role. Our current thinking is to create a group_vars 
>> file for each of the possible combinations, prod_LON_app_server, for 
>> example. The affect of this decision will mean that we're going to see an 
>> explosion in the number of groups a server is added to, and the number of 
>> group_vars files we maintain.
>> 
>> Before we take this route, can anyone tell me if we're missing a trick? Is 
>> there a technique that we're missing?
>> 
>> Thanks!
>> 
>> Dan.
> 
>   
> -- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "Ansible Project" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/ansible-project/_Fvptfvs-gk/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/18a8673f-c17a-4ed1-ad15-45c438402166%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/922B0762-DDB2-45EC-B688-60CB004F2C14%40gamevy.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: group_vars and ansible's patterns - suggestions please!

2016-10-26 Thread Alexander H. Laughlin
Hi Dan,

Why not store the values in a dictionary and just pull the values you need 
for any given server based on its key?

Alex

On Wednesday, October 26, 2016 at 1:39:21 PM UTC-7, Dan Rough wrote:
>
> Hi,
>
> I'd like to know how others are dealing with keeping their group_vars 
> files granular. Ours have become a little unwieldily and we're considering 
> approaches to breaking them apart.
>
> When we provision a server, we assign it to a number of groups. Among 
> those groups, each server is added to at least three groups. Firstly, we 
> add it to a group which defines its role, for example app_server. Another 
> group represents the location of the DC that the server is in, which might 
> be LON, for example. Thirdly, we also add it to a group which denotes 
> whether it is a production server or a test server, prod, for example. That 
> allows us to use ansible's patterns when we're configuring the server to do 
> something like this: - hosts: "prod::_server" or - hosts: 
> "prod::_server".
>
> We have a variables which need to be defined based on these three 
> variables, Environment, Region and Role. Our current thinking is to create 
> a group_vars file for each of the possible combinations, 
> prod_LON_app_server, for example. The affect of this decision will mean 
> that we're going to see an explosion in the number of groups a server is 
> added to, and the number of group_vars files we maintain.
>
> Before we take this route, can anyone tell me if we're missing a trick? Is 
> there a technique that we're missing?
>
> Thanks!
>
> Dan.
>

-- 

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/18a8673f-c17a-4ed1-ad15-45c438402166%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.