Member-only story
Ansible troubleshooting — Error 206: Jinja Spacing
How to Solve the Ansible Error 206: jinja[spacing]
Introduction
Ansible, the popular open-source automation platform, provides a powerful and flexible way to automate tasks, manage configurations, and orchestrate processes. However, to ensure the maintainability and readability of Ansible playbooks, it's important to adhere to best practices and guidelines. In this article, we'll explore Ansible Error 206, "`jinja[spacing]
`", which is related to Jinja2 string templates. We'll discuss how this rule helps improve readability and reduce the likelihood of typos by enforcing proper spacing in Jinja2 templates within your Ansible playbooks.
The Problem: Jinja Spacing
Ansible Error 206, "`jinja[spacing]
`", checks for the correct spacing within Jinja2 string templates. Specifically, it ensures there are spaces between variables and operators, including filters, such as {{ var_name | filter }}. Proper spacing not only enhances readability but also makes it less likely for typographical errors to occur.
Problematic Code Example:
---
- name: Example error 206
hosts: all
tasks:
- name: Error 206
ansible.builtin.debug:
vars:
foo: "{{some|dict2items}}" # <…