I figure out that the problem was related to the variable name (tags) 
the name tags is also used for the special attribute tags useful for filtering 
tasks to be executed.
Anyway changing the snippet using mytags instead of tags solves the error.

- 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: "{{ mytags|dict2items }}"
    vars:
      mytags:
        Environment: dev
        Application: payment
        Another: "{{ doesnotexist|default() }}"
    when: item.value != ""


Please consider to update the manual

-- 
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/92788aa8-f286-4f70-aabf-20b2c775c1e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to