Hi All,
I need to pass a json file to ansible-palybook command using --extra-var (like --extra-var @/tmp/test.json). I am able to reference the variable inside playbook if the json key don’t have dot character in it. But I am not able reference the key which contain dot(.) in it. This is just sample entry in JSOn file but I have many keys which contain dot(.) in key name and I can’t remove the dot char in the key name because the file coming from external system.
# cat /tmp/test.json | jq
{
"VMware.Hardware.Version": " vmx-10",
"toolname": "tomcat"
}
Playbook:
# cat test.yml
---
host: myhost
vars:
hdversion: "{{ VMware.Hardware.Version }}" # not works due to dot(.), getting VARIABLE NOT DEFINED when try to reference hdversion inside role
mytoolname: "{{toolname}}" # works fine
any workaround to use hdversion: "{{ VMware.Hardware.Version }}" to get the value?
Any advise or guidance would be greatly appreciated.