Open dcasella opened 3 months ago
I believe this occurs because underneath the covers, the syntax-check
performed is done using localhost
as the inventory. This is despite what the documentation says on syntax-check
violations.
Our linter runs ansible-playbook --syntax-check on all playbooks, and if any of these reports a syntax error, this stops any further processing of these files.
This error cannot be disabled due to being a prerequisite for other steps. You can exclude these files from linting, but it is better to make sure they can be loaded by Ansible. This is often achieved by editing the inventory file and/or ansible.cfg so ansible can load required variables.
Also, I do think #4225 is related.
Summary
Using
groups['{group_name}']
inserial
gets linted as an error:Issue Type
OS / ENVIRONMENT
STEPS TO REPRODUCE
ansible.cfg
:inventories/D/on-prem.yaml
:playbooks/test.yaml
:Run commands (both work):
Linter error:
Desired Behavior
No linter error.
Actual Behavior
Linter error:
N.B. I get the same error in the root repository (
/home/dcasella/{REDACTED_PATH}
from the log above). The example provided was tested inside a/test
directory.