• Zach Biles

Variables in Ansible

This will be a short post today, feeling pretty dumb. Just learned the hard way that Ansible variable names can not start with numbers. It even says so in the first line of the documentation on variables: https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#creating-valid-variable-names


You'll get some pretty weird output if you try and start them with numbers. Basically it parses the number as an integer, which removes it from the jinja templating, so a variable like this: `1variable` would end up templated like `variable`, which of course probably doesn't exist. You might also get errors about jinja templating, and not including brackets {{ }}. Errors were pretty nondescript.


Learn from my mistakes, don't do this! Hopefully this helps someone scratching their head for an hour like I did.

1 view0 comments

Recent Posts

See All

AWX Isolated Nodes Broken after AWX Upgrade

tl;dr: Python2 strikes back! Always use Python3. Ran into this issue after an upgrade of AWX from 14.0.0 to 15.0.1, where jobs will just fail with no output in AWX showing what happened. Just a blank