Custom module parameter type checking ignored on linting

I was curious so I played around with this and found that ansible-lint will show that message in the debug logs if the value cannot be parsed as the expected type and contains jinja template markers {{ }}. If the value does not contain jinja markers, a warning is shown.

So in your case, its unable to parse {{ var }} as a bool. It doesnt actually try to substitute var in, so yea that makes sense.

As for why its just the bool parameter…its not! ansible-lint just quits after it finds one attribute it cant parse. So if you remove that boolean attribute from your module, it should show a similar log message for the next int variable (or maybe the list var, i didnt test with lists)

Heres the ansible-lint code that handles the parsing error. ansible-lint/src/ansiblelint/rules/args.py at a3f8492505b60d4be2c9df973967dca436c0cfa4 · ansible/ansible-lint · GitHub

2 Likes