On 28. feb. 2017 19:06, Brian Coca wrote:
note the change, only the last one is an empty list [ ] , if
project_config is undefined it should be an empty hash/dictionary, as
.apt can only be part of that and not a list. Default will need to
return what is expected of the 'next step'

with_items: " {{ (project_config | default({})).apt | default([]) }}"


My experience is that it doesn't matter it I use {}, [] or a mix, it works either way.

  - name: "[] []"
    debug: msg="This will not print {{ item }}"
    with_items: " {{ (project_config | default([])).apt | default([]) }}"

  - name: "{} []"
    debug: msg="This will not print {{ item }}"
    with_items: " {{ (project_config | default({})).apt | default([]) }}"

  - name: "[] {}"
    debug: msg="This will not print {{ item }}"
    with_items: " {{ (project_config | default([])).apt | default({}) }}"

  - name: "{} {}"
    debug: msg="This will not print {{ item }}"
    with_items: " {{ (project_config | default({})).apt | default({}) }}"


TASK [[] []] ************************************************************

TASK [{} []] ************************************************************

TASK [[] {}] ************************************************************

TASK [{} {}] ************************************************************

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

--
Kai Stian Olstad

--
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/3d6dd671-7a28-3f61-06ce-98e711b645dc%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to