If you are certain that your two lists will be the same size, then you can try using an index variable. See
https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#tracking-progress-through-a-loop-with-index-var Iterate through one list, declare an index variable, and use the index variable to get the appropriate member out of the second list. --EbH On Wednesday, May 29, 2019 at 10:45:01 AM UTC-4, Asha Omanakuttan wrote: > > I need some contents to be written in csv format to a file. > > shell: ps -ef | grep java | awk '{print $1}' > register: username > > shell: ps -ef | grep java | awk '{print $2}' > register: id > > The output for username will be similar to : > root > admin > test_admin > > The output for id will be similar to: > 1232 > 4343 > 2233 > > so I want this to be written to a csv file as > > root,1232 > admin,4343 > test_admin,2233 > > Please suggest. > > -- 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/8d915b90-d8ab-4dc6-97d2-f03e9f141d1a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
