Hello,

I did solve my issue by using an array to pass my parameters in the hosts 
file:
[deployserver]
linuxserv1 ansible_connection=local ansible_user=aa01 PARAM="['/aa01/dev', 
'tomweb', '1.2']"
linuxserv1 ansible_connection=local ansible_user=bb01 PARAM="['/bb01/dev', 
'query', '15.1']"
linuxserv2 ansible_connection=local ansible_user=aa01 PARAM="['/aa01/prd', 
'tcserver', '1.2']"

and in my playbook:

    envt: "{{ PARAM[0]|default ('fvfv') }}"
     module: "{{ PARAM[1]|default ('tomcat') }}"
.....

Thank you,
Regards

Le mardi 19 avril 2016 09:49:13 UTC+2, fanvalt a écrit :
>
> THank you, my issue is the following: *the variables are host/user 
> specific*, so I am trying to find a way to set them in an easy way as t*hey 
> will pilote the playbook execution*. (if the parameter is tomcat then the 
> tomcat role will be played etc ...)
> So using a group_var is not easy to manage, I was thinking about setting 
> vars in the hosts in a tab, this way:
> [linuxserver]
> server1 ansible_user=aa01 vartab="1;tomcat;release1"
>
> and then in the playbook getting the variables using the vartab[1] ...
> I am new in ansible, I don't know if this is possible.
>
> Thanks for your help
> Regards
>
> Le mardi 19 avril 2016 01:22:29 UTC+2, Brian Coca a écrit :
>>
>> extra_vars= inside your hosts file has no meaning, it just gives a path 
>> to a variable named 'extra_vars'.
>>
>> Ansible can consume the JSON directly, if you don't want to copy it you 
>> can symlink it to host_vars/hostname or group_vars/group_name and Ansible 
>> will assign those appropriately.
>>
>>
>> ----------
>> Brian Coca
>>
>

-- 
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/003b1964-4089-4bc3-aa5e-fc44a9338112%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to