Undef keyword/function documentation

Maybe, I’m overthinking this, but while perusing the Ansible documentation I discovered undef in filters section. There is an example of how to use, and a reference to it in the Ansible 2.8 Porting Guide, but haven’t found any more details on it. Is it something that is built into Ansible? Does it come from Python or Jinja2?

The optional hint option (wouldn’t have known it was optional until reading the porting guide) seems useful to provide information to a user one what variable is undefined in playbooks, etc.

Maybe it’s not very important, but it would be nice to have some more discoverable documentation for this and any other lesser-known functions in Ansible, even if it’s just a link to another site in the case of Python or Jinja2 stuff.

Thanks.

It’s a custom function Ansible adds to the global Jinja2 environment. I opened a PR to try to improve the documentation Add documentation for the custom Jinja2 global function `undef` by s-hertel · Pull Request #953 · ansible/ansible-documentation · GitHub, any suggestions welcome.

3 Likes

Thanks for the information and submitting that PR, @shertel .