The lookup plugin with "file" can't be used to interpolate variables and
read them back in.

Read the docs on the "include_vars" module and you may be a bit happier,
and it eliminates the overcomplex lookup attempt.


On Wed, Aug 6, 2014 at 7:24 PM, AJ Daws <[email protected]> wrote:

> I created a simple example to demonstrate at
> https://github.com/tdaws/ansible-templated-file-to-var-example.   To try
> it directly, you can git clone
> https://github.com/tdaws/ansible-templated-file-to-var-example &&
> run-me.sh
> Or you can browse the files directly.  The run-me.sh script just shows
> what command I use to call the test.
>
> Output contains the {{ }} notation instead of the replacement values
> desired:
>
> TASK: [testrole | Test multiline templated var]
> *******************************
> ok: [localhost] => {
>     "msg": "#testfile.yml\nvar_tests:\n - name: var_from_playbook\n   v:
> {{ var_from_playbook }}\n\n - name: var_from_role\n   v: {{ var_from_role
> }}"
> }
>
>
>
>
>
> On Wednesday, 6 August 2014 08:06:22 UTC-7, Michael DeHaan wrote:
>
>> "Tried the lookup('file', 'my-user-data.yml') but it does not appear to
>> be parsed by jinja2"
>>
>> Not sure why this would be the case but would need to see the playbook.
>>
>> Needs to be surrounded by "{{ }}" to evaluate of course, which may be
>> part of the problem.
>>
>>
>> On Tue, Aug 5, 2014 at 8:17 PM, Amr Ali <[email protected]> wrote:
>>
>>>  Why not just use a variables file,  along with include_vars.. you can
>>> even use a group or hosts var file..
>>>
>>> What kind of "templating"  options are  you looking into using?
>>>
>>> --
>>> 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/f7f83a30-61e6-4619-afe2-
>>> d3487ae36b02%40googlegroups.com.
>>> 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/ff6d36d1-103d-4528-8459-07ff43ac71b0%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/ff6d36d1-103d-4528-8459-07ff43ac71b0%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/CA%2BnsWgyCatiZU%2BAGSMapu57j%3DqSLUxtD8cMsqcYQQ%2Bo5qAfS9Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to