Haven’t found any info about this. I can probably work around this itch, but if variable indirection is available, I would use it.
Cheers!
Haven’t found any info about this. I can probably work around this itch, but if variable indirection is available, I would use it.
Cheers!
You can't do a Perl style $$var, but you can use hashes to simulate this.
$hash.{$somevar}
So essentially you can do this:
$hostvars.{$ansible_hostname}.{$variable_name}
Syntax differences if we are talking about Jinja2 versus playbooks, of course.
$ansible_hostname is an automatically set magic variable.
Thanks! Very useful trick.