I have a couple of questions about variables in playbooks.
Is there a way to get to ansible variables in a playbook? Trying to get to the IPv4 address, neither {{ ansible_eth0.ipv4.address }} nor $ansible_eth0.ipv4.address work. The {{}} syntax yields the MAC address. The $ syntax gets passed through to the command unchanged (did not match anything at all).
StuddlyCaps don’t seem to work but I don’t see anything in the vars section of the docs about acceptable variable names. E.g., I can use “customer_email” but not “customerEmail”. The latter gets passed through to the command as $customerEmail instead of having the value substituted.
Is there a way to get to ansible variables in a playbook? Trying to get to
the IPv4 address, neither {{ ansible_eth0.ipv4.address }} nor
$ansible_eth0.ipv4.address work. The {{}} syntax yields the MAC address. The
$ syntax gets passed through to the command unchanged (did not match
anything at all).
The correct syntax is:
'''
tasks:
- action: shell echo ${ansible_eth0.ipv4.address}
'''
That example works all right for me on devel.
StuddlyCaps don't seem to work but I don't see anything in the vars section
of the docs about acceptable variable names. E.g., I can use
"customer_email" but not "customerEmail". The latter gets passed through to
the command as $customerEmail instead of having the value substituted.