Reputation: 472
I am defining ansible vars defined as yaml dictionary, following format works well
myvars:
var1:
name: test1
var2:
name: test2
I want to know if following syntax is also valid for ansible?
myvars.var1.name: test1
myvars.var2.name: test2
I have seen this syntax in elasticsearch.yml file, but when I try it in my playbook vars file, ansible throws error
"msg": "'myvars' is undefined"
Upvotes: 0
Views: 261
Reputation: 2568
No, myvars.var1.name: test1
is not valid syntax in ansible.
The variable names should not include dots.
As per documentation, https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html
foo-port, foo port, foo.port and 12 are not valid variable names.
Upvotes: 2