Thank you,

We might use many inventory files, depending on DEV, REC and PROD 
environments.
I did correct the inventory file, instead of setting [USER1_DEV1:vars], I 
did add an alias:
[USER1_DEV1]
USER1_DEV1 PARAM="[app1','1.0.1','1']"

so when running the ansible-playbook to list the different hosts, the list 
contains only the more detailed ones USER1_DEV1, USER2_DEV1 ....

Regards

Le lundi 26 septembre 2016 10:22:25 UTC+2, fanvalt a écrit :
>
> Hello,
>
> I have an inventory file to install for one user many ways, it looks like 
> this:
>
> [USER1_DEV1]
> PARAM="[app1','1.0.1','1']"
>
> [USER1_DEV2]
> PARAM="['app1','1.1.0','5']"
>
> [USER1_REC1]
> PARAM="['app1','1.0.4','2']"
>
> [USER1_REC2]
> PARAM="['app1','1.1.0','6']"
>
> [USER1_PREREC1]
> PARAM="['app1','1.0.3','3']"
>
> [USER1_PREREC2]
> PARAM="['app1','1.0.3','7']"
>
> [USER1_DEV:children]
> USER1_DEV1
> USER1_DEV2
>
> [USER1_PREREC:children]
> USER1_PREREC1
> USER1_PREREC2
>
> [USER1_REC:children]
> USER1_REC1
> USER1_REC2
>
> [user1:children]
> USER1_DEV
> USER1_REC
> USER1_PREREC
>
> [linux1:children]
> user[1:10]
> produser[70:72]
>
> [user1:vars]
> ansible_user=user1
>
> [linux1:vars]
> ansible_host=linux1.fr.com
>
> [webservers:children]
> linux1
>
>
> So when running the ansible-playbook command, I do use the -l option to 
> decide what to deploy (-l USER1_REC in example).
> The issue is, that I have 10 users and 10 produsers, all working the same 
> way so I would have to duplicate all these lines again and again like:
> [user2:children]
> USER2_DEV
> USER2_REC
> USER2_PREREC
>
> etc ..
> but only the first lines are different:
> [USER1_DEV1]
> PARAM="[app1','1.0.1','1']"
>
> [USER2_DEV1]
> PARAM="[app1','2.0.1','1']"
>
> [USER1_DEV2]
> PARAM="[app1','1.0.1','1']"
>
> [USER2_DEV2]
> PARAM="[app1','1.1.1','1']"
>
> Is there a simple way to proceed for not writing all these lines ? Shall I 
> try to use a dynamic inventory file , could someone give me an example ?
> Regards
>

-- 
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/f606aa0b-52d8-4d8a-aea4-747153088a33%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to