Thank you for clearing it up!
On Thursday, October 18, 2018 at 11:54:12 AM UTC-6, Dmitriy Panteleyev
wrote:
>
> I was under the impression that if I define a variable with a `lookup`
> function, it would store the results of the lookup. And then when I used
> that variable, it would spit out the results of the lookup.
>
> However, from running a bunch of different test cases that Ansible
> performs the lookup every time I try to use that variable. Is that by
> design? Is there a way to avoid repeated lookups?
>
>
> So... expectation:
>
> myvar: lookup(...)
>
> >>> look up stuff and store result of lookup in 'myvar'
>
> - name: '{{ myvar }}'
>
> >>> spit out contents of 'myvar'
>
> - debug:
> var: myvar
>
> >>> spit out contents of 'myvar'
>
> etc.
>
>
>
> What seems to be happening is...
>
> myvar: lookup(...)
>
> >>> look up stuff
>
> - name: '{{ myvar }}'
>
> >>> look at 'myvar' and perform the lookup defined by it, then spit out
> result
>
> - debug:
> var: myvar
>
> >>> look at 'myvar' and perform the lookup defined by it, then spit out
> result
>
> etc.
>
>
--
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/25bfa572-884f-4b6d-b82c-5e8e66c88b57%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.