`template error while templating string: No filter named 'json_query'`
IntermediateTroubleshootingYAML, Syntax and Jinja2 Errors
Answer
Likely causes → json_query is part of community.general, not ansible-core. With a minimal ansible-core install, that collection is not present. When the collection is present but the Python library is missing, you get You need to install "jmespath" prior to running json_query filter instead.
Diagnose →
ansible-galaxy collection list community.general
python3 -c 'import jmespath' # on the controller
Fix → Install community.general and pip install jmespath into the controller's Python, and call the filter by its FQCN, community.general.json_query. Often the cleaner fix is to drop JMESPath and use core filters: selectattr, map(attribute=...) and items2dict.
Prevent → Pin collections in collections/requirements.yml and Python dependencies in requirements.txt, and build both into your execution environment.
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