> podman run --name debian-trixie -it --rm debian:trixie root@6e69c6fab585:/# apt update Get:1 http://deb.debian.org/debian trixie InRelease [138 kB] Get:2 http://deb.debian.org/debian trixie-updates InRelease [47.1 kB] Get:3 http://deb.debian.org/debian-security trixie-security InRelease [43.4 kB] Get:4 http://deb.debian.org/debian trixie/main amd64 Packages [9668 kB] Get:5 http://deb.debian.org/debian trixie-updates/main amd64 Packages [2432 B] Get:6 http://deb.debian.org/debian-security trixie-security/main amd64 Packages [8780 B] Fetched 9907 kB in 1s (10.3 MB/s) All packages are up to date. root@6e69c6fab585:/# apt install ansible Installing: ansible ... Setting up ansible (12.0.0~a6+dfsg-1) ... Processing triggers for libc-bin (2.41-12) ... Processing triggers for ca-certificates (20250419) ... Updating certificates in /etc/ssl/certs... 0 added, 0 removed; done. Running hooks in /etc/ca-certificates/update.d... done. root@6e69c6fab585:/# cd $(mktemp -d) root@6e69c6fab585:/tmp/tmp.i1gsojt4Qs# cat >playbook.yaml < - name: Sample playbook hosts: localhost tasks: - name: Debug print success ansible.builtin.debug: msg: "{{ template_data }}" vars: template_data: "{{ lookup('template', 'template.txt') }}" template_opts: "{{ sample_var['sample_key'] | default('sample_default') }}" sample_var: sample_key: "sample_value" - name: Debug print failure ansible.builtin.debug: msg: "{{ template_data }}" vars: template_data: "{{ lookup('template', 'template.txt') }}" template_opts: "{{ sample_var['sample_key2'] | default('sample_default') }}" sample_var: sample_key: "sample_value" > EOF root@6e69c6fab585:/tmp/tmp.i1gsojt4Qs# cat >template.txt < # Sample template {{ template_opts }} > EOF root@6e69c6fab585:/tmp/tmp.i1gsojt4Qs# ansible-playbook playbook.yaml [WARNING]: No inventory was parsed, only implicit localhost is available [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' PLAY [Sample playbook] *********************************************************************************************************************************************************************************** TASK [Gathering Facts] *********************************************************************************************************************************************************************************** ok: [localhost] TASK [Debug print success] ******************************************************************************************************************************************************************************* ok: [localhost] => { "msg": "# Sample template\nsample_value\n" } TASK [Debug print failure] ******************************************************************************************************************************************************************************* [ERROR]: Task failed: Finalization of task args for 'ansible.builtin.debug' failed: Error while resolving value for 'msg': The lookup plugin 'template' failed: object of type 'dict' has no attribute 'sample_key2' Task failed. Origin: /tmp/tmp.i1gsojt4Qs/playbook.yaml:13:7 11 sample_key: "sample_value" 12 13 - name: Debug print failure ^ column 7 <<< caused by >>> Finalization of task args for 'ansible.builtin.debug' failed. Origin: /tmp/tmp.i1gsojt4Qs/playbook.yaml:14:7 12 13 - name: Debug print failure 14 ansible.builtin.debug: ^ column 7 <<< caused by >>> Error while resolving value for 'msg'. Origin: /tmp/tmp.i1gsojt4Qs/playbook.yaml:15:14 13 - name: Debug print failure 14 ansible.builtin.debug: 15 msg: "{{ template_data }}" ^ column 14 <<< caused by >>> The lookup plugin 'template' failed. Origin: /tmp/tmp.i1gsojt4Qs/playbook.yaml:17:24 15 msg: "{{ template_data }}" 16 vars: 17 template_data: "{{ lookup('template', 'template.txt') }}" ^ column 24 <<< caused by >>> object of type 'dict' has no attribute 'sample_key2' Origin: /tmp/tmp.i1gsojt4Qs/playbook.yaml:18:24 16 vars: 17 template_data: "{{ lookup('template', 'template.txt') }}" 18 template_opts: "{{ sample_var['sample_key2'] | default('sample_default') }}" ^ column 24 fatal: [localhost]: FAILED! => {"msg": "Task failed: Finalization of task args for 'ansible.builtin.debug' failed: Error while resolving value for 'msg': The lookup plugin 'template' failed: object of type 'dict' has no attribute 'sample_key2'"} PLAY RECAP *********************************************************************************************************************************************************************************************** localhost : ok=2 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0