On Wed, 5 Feb 2020 03:52:22 -0800 (PST)
Rakesh Parida <[email protected]> wrote:

> [...]
>  with_items:
>    - "{{ dp_record | default(None) }}"
>    - "{{ iampython_record | default(None) }}"
>    - "{{ iamservice_record | default(None) }}"
>    - "{{ iamesa_record | default(None) }}"
>   
> But when the "iamesa_record" is not present i get the following list Output:
>  "msg": [
>            "dp-steps-common", 
>            "iam-python-common", 
>            "iam-service-default", 
>            "None"
>         ], 
> 
> IS there any way that if the item is not available then it should not be 
> appended to the list.

Yes. Test the "item". For example

  with_items:
    - "{{ dp_record | default(None) }}"
    - "{{ iampython_record | default(None) }}"
    - "{{ iamservice_record | default(None) }}"
    - "{{ iamesa_record | default(None) }}"
  when: item

I've removed the irrelevant regex_replace part of the filters.

HTH,

        -vlado

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20200205132155.6184330f%40gmail.com.

Attachment: pgpDZnjujI1Ji.pgp
Description: OpenPGP digital signature

Reply via email to