CI fails on ansible-lint with `yaml[truthy]`, `fqcn[action-core]`, `name[missing]` and `no-changed-when`
IntermediateTroubleshootingYAML, Syntax and Jinja2 Errors
Answer
Likely causes → The lint profile was raised (for example to production), or ansible-lint was upgraded and added rules.
Diagnose →
ansible-lint --version
ansible-lint -p # parseable output, one violation per line
Fix →
yaml[truthy]: usetrue/falseinstead ofyes/no.fqcn[action-core]: writeansible.builtin.copyinstead ofcopy.name[missing]: give every task a name.no-changed-when: addchanged_whentocommandandshelltasks.
For a large legacy codebase, run ansible-lint --fix first, then review the diff.
Prevent → Pin the ansible-lint version in requirements-dev.txt, and set the profile in .ansible-lint. Use --generate-ignore to accept the existing violations and stop new ones.
More on YAML, Syntax and Jinja2 Errors
`Syntax Error while loading YAML. mapping values are not allowed in this context`Beginner`found character '\t' that cannot start any token`Beginner`ERROR! conflicting action statements: ansible.builtin.copy, dest`IntermediateAnsible says `This one looks easy to fix. It seems that there is a value started with a quote, and the YAML parser is expecting to see the line ended with the same kind of quote.`Beginner`We could be wrong, but this one looks like it might be an issue with missing quotes. Always quote template expression brackets when they start a value.`Beginner`ERROR! A malformed block was encountered while loading tasks: {...} should be a list or None but is <class 'ansible.parsing.yaml.objects.AnsibleMapping'>`Intermediate