Hi,

After i create  a list and when item is not present then an item with NONE 
is added to the list. 

    - name: Create an empty list variable
      set_fact:
        ece_nodes: []

    - name: Append string to ECE node list
      set_fact:
        ece_nodes: "{{ ece_nodes + [ item ] }}"
      with_items:
        - "{{ dp_record | default(None) | 
regex_replace('-[0-9].[0-9].[0-9][0-9].rpm','') }}"
        - "{{ iampython_record | default(None) | 
regex_replace('-[0-9].[0-9].[0-9].rpm','') }}"
        - "{{ iamservice_record | default(None) | 
regex_replace('-[0-9].[0-9].[0-9][0-9].rpm','') }}"
        - "{{ iamesa_record | default(None) | 
regex_replace('-[0-9].[0-9].[0-9][0-9].rpm','') }}"
  
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. Only the available items should be added to the list 
and the unavailable item should be ignored.

With Regards
Rakesh


-- 
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/92f4746a-8441-4e71-b99d-f1d9a28f636c%40googlegroups.com.

Reply via email to