I want to lint a playbook to detect following few among many other possibilities:
- Undefined variable
- Unused variable
- See if vars defined, when case-ignored, are same( conflicting vars hereafter)
I'm not able to figure out what is the good way to do this? I don't want to re-invent the wheel, in the sense that:
- I don't want to do text processing. Ansible does this to accomplish its task.
- Hooks or callbacks if I'm not wrong are couple of levels higher than where I think my solution should hop in.
My intention is to write a tool that seamlessly, and optionally, works with ansible. I would like not to modify ansible's code if I can do without.
Any help or hack or suggestion is appreciated.
PS: Syntax check wouldn't tell me about what I have mentioned above. I've taken a look at the ansible-lint tool. It does text processing, doesn't support inventory(for host_vars etc) and doesn't use ansible python API. So in order to do what I need, I'd have to call many internal APIs of ansible and I would end up writing ansible's code in my tool.