Hi all, I need to get the value of a variable whose name is saved in
another one, in other words I need the lookup plugin vars
Unfortunately I can't upgrade ansible to a release upper to 2.4, so I have
to reinvent the wheel.. unpleasant feeling.
Is there a way to implement it in another way?
I tried like so
# when: lookup('vars', item|basename, default=false)
when: confobj
vars:
confobj: "{% set output = globals()[item|basename] if
globals()[item|basename] is defined else false %}\
{{ output }}"
But the variable is not defined in the global namespace..
Actually the problem is a little more simple.. the variable could be set in
{host,group}_vars or in roles/*/{default,vars}
For the former case I could get it thanks the available var plugin with
host_vars[inventory_hostname][item|basename]
but how to retrieve those variables set by roles stuff?
regards
Luca
--
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/a1140fcb-80e0-4f66-b227-4232b40f1ecd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.