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/cc7129b8-6011-4e1f-b8b5-19c6595a3945%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.