It should have made it clear for anyone else reading that
[hostname:vars]
hostnamevar=hostnamevalue
is never intended to work, but I had tried it.

On Tuesday, 12 December 2017 14:19:24 UTC+11, Jason S wrote:
>
> Ah, thank-you Brian.
> Now I have the variables next to the host definition (within the group 
> definition) it works fine, as expected.
>
> I'm trying to think why I missed this even though it was staring me in the 
> face on the documentation page.
>
> I guess I was thinking that all variables would have to be defined with 
> [:vars]
> I had actually tried
> [stable-1:vars]
> var=value
> that is
> [hostname:vars]
> var=value
>
> And if you can do
> [groupname]
> hostname var=value
>
> Why not
> [groupname]
> groupvar=groupvalue
> groupvar2=groupvalue2
> hostname var1=value1 var2=value2
>
> Anyway it is all working for me now so thanks again.
>
>
>
> On Tuesday, 12 December 2017 13:40:27 UTC+11, Brian Coca wrote:
>>
>> [stable:vars] 
>> stable-1 http_port=80 maxRequestsPerChild=808 
>>
>> ^ this is defining a var named 'stable-1 http_port' , not http_port for 
>> stable-1 
>> the format is: 
>>
>> [groupname:vars] 
>> varname=value 
>>
>>
>> then you can use simply with: 
>>
>> debug: 
>>    var: varname 
>>
>> or 
>>
>> debug: 
>>   var: hostvars[inventory_hostname]['varname'] 
>>
>>
>> If you want to define a variable PER host do it in the host definition 
>> [groupname] 
>> hostname varname=value 
>>
>> -- 
>> ---------- 
>> 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/465d57b2-55d0-4600-b6a3-719820ca5e38%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to