I have notices that if I use a Jinja2 variable in the YAML map key, it's 
not substituted by the variable's value as in the array and the map value. 
For example if I have the following playbook:

---

- name: Test play
  hosts: all
  connection: local
  gather_facts: no
  vars:
    test_var: aaa
    test_list:
      - "{{ test_var }}"
      - "{{ test_var }}": bbb
  tasks:
    - name: Debug task
      debug:
        var: test_list

The output is this:

$ ansible-playbook -i hosts ./site.yaml 

PLAY [Test play] 
************************************************************** 

TASK: [Debug task] 
************************************************************ 
ok: [localhost] => {
    "var": {
        "test_list": [
            "aaa", 
            {
                "{{ test_var }}": "bbb"
            }
        ]
    }
}

PLAY RECAP 
******************************************************************** 
localhost                  : ok=1    changed=0    unreachable=0    failed=0

The first item of the *test_list* is string containing the Jinja2 variable 
which gets substituted by its value. But the second item of the *test_list* is 
a map which has a Jinja2 variable as its key which doesn't get substituted.

Would it be possible to add support for variable substitution in the map 
keys?

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b6740037-5972-4bab-96b4-6cb53f7d8a65%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to