Hey everyone,
I’ve been going through the docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html and hit a strange issue that I can’t seem to sort out.
I’m trying to pass a dictionary of config options inside a task, and I keep getting a mapping values are not allowed here
error. Here’s a trimmed-down version of what I’m working with:
vars:
config_data: "{{ lookup('file', 'settings.json') }}"
tasks:
- name: Apply configuration
ansible.builtin.template:
src: config.j2
dest: "/etc/myapp/config.yaml"
variables:
settings: {
mode: "advanced",
enabled: true,
threshold: 2.0
}
I’ve double-checked the syntax, tried reformatting the dictionary, and even tested it with a YAML linter — everything seems fine. But Ansible still complains. I’m wondering if this could be a conflict between how Jinja expressions are evaluated inside YAML or something subtle I’m overlooking.
Has anyone else run into this? Any tips or direction would be appreciated!