Hi all, trying the following playbook taken from 
user_guide/playbooks_loops.html 

- hosts: localhost
  tasks:
  - name: create a tag dictionary of non-empty tags
    set_fact:
      tags_dict: "{{ (tags_dict|default({}))|combine({item.key: item.value}) }}"
    loop: "{{ tags|dict2items }}"
    vars:
      tags:
        Environment: dev
        Application: payment
        Another: "{{ doesnotexist|default() }}"
    when: item.value != ""

I got the error 

$ ansible-playbook dict2items.yml 

PLAY [localhost] 
**************************************************************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] 
********************************************************************************************************************************************************************************************************************************************************
ok: [localhost]

TASK [create a tag dictionary of non-empty tags] 
******************************************************************************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"msg": "dict2items requires a dictionary, got 
<class 'jinja2.runtime.StrictUndefined'> instead."}
        to retry, use: --limit @/home/fusillator/Code/ansible/dict2items.retry

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

$ ansible-playbook --version
ansible-playbook 2.7.6

Any hint?

thanks 

Luca 

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f18e492f-7982-41f7-9634-fa92828fbc6a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to