I have a playbook variable output as below 

debug:
  msg: "{{my_var}}}"
  
TASK [debug] 
**************************************************************************************************************************
ok: [localhost] => {
    "msg": [
        "line1 has , color-red, in  its   middle"
        "line2 has,   color-blue,   in its middle"
        "line3 has,  color-orange, in its middle"
    ]
}

I want to use the output lines as  an input for another variable using 
set_fact , as like below . 

  - name: Filtering  the color data  
    ansible.builtin.set_fact:
      new_var: "{{ item.split(',')[1] }}"
loop: "{{ var1 }}"

and I am looking for the data like below
  color-red
  color-blue
  color-orange

 - debug: 
     var:  new_var
gives only color-red
 
 But my  var1 looping process the first line only in from the my_var and 
not the next 2 lines.
 This is an example and I may expect lines from my_var from 0 to 100's.

How to print the column[]of output) with multiple lines ??

-- 
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/3490a8af-689c-4cb1-8670-1495258df226n%40googlegroups.com.

Reply via email to