Trying to sort through the email storm here :)

Yes, vars_files and such will evaluate all the variables it can *So that
they may be used* if possible early, as that is often the case.

While it doesn't help your question, I would try to not complicate your
infrastructure so much, it's hard to say from your theoretical example, but
if you could post a more real world example of showing what you are trying
to model, I think you might be doing something a little non-idiomatic.





On Thu, Oct 23, 2014 at 4:22 AM, Hagai Kariti <[email protected]> wrote:

> Hi Stephen
>
> First of all, thanks a lot. Your changes however did not solve my second
> case, the one using 'default' on inventory variables. So I guess some more
> tweaking is required. I'd love to help btw.
>
> Something is also weird about your pull request - it's not in its own
> branch, which makes it more difficult to pull to my repo (I had to copy the
> individual files manually!).  I put them in a branch in my fork if you
> want: https://github.com/hkariti/ansible/tree/premature_template_vars
>
> On Wed, Oct 22, 2014 at 10:10 PM, Stephen Gargan <[email protected]>
> wrote:
>
>> Hagai,
>>
>> I had a similar issue and posted a pull request for it a while back. Its
>> not been merged yet but you can grab it here
>>
>> https://github.com/ansible/ansible/pull/9106
>>
>> Try applying it and see if it fixes your issue too.
>>
>> regards,
>>
>> Steve.
>>
>> On Wednesday, 22 October 2014 13:48:18 UTC+1, Hagai Kariti wrote:
>>>
>>> Since my issue <https://github.com/ansible/ansible/issues/9393> was
>>> closed without a response and redirected me to the list, is it possible to
>>> get a response here?
>>>
>>> On Tuesday, October 7, 2014 10:50:13 AM UTC+3, Hagai Kariti wrote:
>>>>
>>>> Hi
>>>>
>>>> I hope this is the right place to post this. I reported
>>>> https://github.com/ansible/ansible/issues/9242 a few days ago and I
>>>> still have issues after it was closed. I'll give a similar example to the
>>>> one I gave in the issue, but using vars_files and adding one more usecase:
>>>>
>>>> inventory:
>>>>
>>>> localhost ansible_connection=local
>>>> [all:vars]
>>>> var=one
>>>>
>>>>
>>>> vars_file:
>>>>
>>>> var2: "{{var}}"
>>>>
>>>> mapping:
>>>>   one: 1
>>>>   two: 2
>>>>
>>>> playbook:
>>>>
>>>> ---
>>>> - hosts: localhost
>>>>   gather_facts: no
>>>>   vars_files:
>>>>     - vars_file
>>>>   vars:
>>>>     value: "{{mapping[var]}}"
>>>>   tasks:
>>>>     - debug: var=var
>>>>     - debug: var=var2
>>>>     - debug: var=value
>>>>
>>>>
>>>> command:
>>>>
>>>>     ansible-playbook -i inventory playbook.yml -e var=two
>>>>
>>>> output:
>>>>
>>>> TASK: [debug var=var] ******************************
>>>> ***************************
>>>> ok: [localhost] => {
>>>>     "var": "two"
>>>> }
>>>>
>>>> TASK: [debug var=var2] ******************************
>>>> **************************
>>>> ok: [localhost] => {
>>>>     "var2": "one"
>>>> }
>>>>
>>>> TASK: [debug var=value] ******************************
>>>> *************************
>>>> ok: [localhost] => {
>>>>     "value": "1"
>>>> }
>>>>
>>>> In older versions (1.5.5 is the one I test with), the third (mapping)
>>>> usecase is working properly, but the second does not. In the latest dev,
>>>> both don't work
>>>>
>>>> Thanks!
>>>>
>>>  --
>> 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/EunpeCL45k8/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, 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/12a88f83-d97f-4afe-93b3-644ee6887180%40googlegroups.com
>> <https://groups.google.com/d/msgid/ansible-project/12a88f83-d97f-4afe-93b3-644ee6887180%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> 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 [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/CAO0%3DbmHkhDRcMx9DcuvRNLjneiksMsvSmRf9f3EBJEZFDgdGVA%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAO0%3DbmHkhDRcMx9DcuvRNLjneiksMsvSmRf9f3EBJEZFDgdGVA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> 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 [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/CA%2BnsWgxuB2GUWp-W3LpLnO_utLo-wLMadcFyxVhM5u%2BdaSdqXQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to