Hi All,
As much as I hate to bring an old thread back to life, I have to as I've 
failed to find workarounds for this issue.
Based on my inventory file, I would like to keep the group_vars dir in 
multiple locations instead of the same single directory as it makes it 
harder to maintain.
So instead of 
group_vars
├── db_in
├── db_servers
├── db_us
├── in_servers
├── us_servers
├── web_in
├── web_servers
└── web_us
I would like to have something like (or any other suggestions/workaround to 
make things more organised) below:
group_variables
├── db-servers-grp
│ ├── db_in
│ └── db_us
├── general-grp
│ ├── db_servers
│ └── web_servers
├── region-grp
│ ├── in_servers
│ └── us_servers
└── web-server-grp
├── web_in
└── web_us
This way I can have in my ansible.cfg file the following variable:
group_vars_dirs = group_variables/db-servers-grp, 
group_variables/general-grp, group_variables/region-grp, 
group_variables/web-server-grp
This would help in scalability when there are thousands of regions or even 
sub-regions
I have an inventory as below (This is a sample of a larger inventory of 
around 2000 hosts):
all:
children:
web_servers:
children:
web_us:
hosts:
web_us_example1:
web_us_example2:
web_us_example3:
web_in:
hosts:
web_in_example1:
web_in_example2:
web_in_example3:
db_servers:
children:
db_us:
hosts:
db_us_example1:
db_us_example2:
db_us_example3:
db_in:
hosts:
db_in_example1:
db_in_example2:
db_in_example3:
us_servers:
children:
web_us:
db_us:
in_servers:
children:
web_in:
db_in:


I would appreciate any feedback at all.

Thanks,
Rahul Raj Purohit
On Thursday, February 11, 2016 at 12:28:14 PM UTC-5 Marc Petrivelli wrote:

> +
>
> I agree this would be a nice feature.  Forcing group_vars and host_vars to 
> be relative to your inventory file/script was shorted sighted.  It's super 
> sloppy but you can work around this with sym links.  Shamefully, I have 
> done this.
>
>
> On Wednesday, February 10, 2016 at 9:56:31 PM UTC-5, muff...@gmail.com 
> wrote:
>>
>> Hi all,
>>
>> I've been wondering on how am I going to move the contents of my 
>> group_vars and host_vars to a different location then I found 
>> https://github.com/ansible/ansible/issues/13051 which basically was 
>> rejected.
>>
>> My use case is mainly to have a better organization of my configurations. 
>> Since I was able to specify a custom location for my inventory and 
>> roles_path as stated also in the above link, I also wanted to set a custom 
>> location for my group_vars and host_vars.
>>
>> Currently, my Ansible directory tree looks like this:
>>
>> ANSIBLE_DIR=/etc/ansible
>>
>> $ANSIBLE_DIR/ansible.cfg
>> $ANSIBLE_DIR/main.yml
>> $ANSIBLE_DIR/environment/{development,staging,production}
>> $ANSIBLE_DIR/roles/{defaults,files,handlers,meta,tasks,templates,vars}/
>>
>> Then, I want to have my group_vars and host_vars to be located at:
>>
>> $ANSIBLE_DIR/vars/{groups,hosts}/
>>
>> I find it messy (sorry) if my group_vars and host_vars are located inside 
>> the $ANSIBLE_DIR/environment/ directory. Thus, I want to move it to some 
>> other place.
>>
>> Thank you and I hope you will consider this feature request.
>>
>> Kind regards,
>>
>> Muffin
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/7711c9ec-a47c-4015-9347-ef885c2edd95n%40googlegroups.com.

Reply via email to