How to reference variables

If I have a yml vars file with:

category:
stuff: a
otherstuff: bar
cat2:

  • subcat1: true
  • subcat2: false

How do I reference these variables in a playbook?

in 0.4 and onward:

${category.otherstuff}

or using Jinja2 syntax, allowed in playbooks in 0.3 and back in 0.5 and onward, and has always been allowed in templates:

{{ category[“otherstuff”] }}

Try --extra-vars="user=foo".

Also set:

user: $user

in the playbook