title: Write to csv file
body: <p>I need some contents to be written in csv format to a file using ansible</p>
  
  <pre><code>shell: ps -ef | grep java | awk '{print $1}'
  register: username
  
  shell: ps -ef | grep java | awk '{print $2}'
  register: id
  </code></pre>
  
  <p>The output for username will be similar to :</p>
  
  <pre><code>root
  admin
  test_admin
  </code></pre>
  
  <p>The output for id will be similar to:</p>
  
  <pre><code>1232
  4343
  2233
  </code></pre>
  
  <p>so I want this to be written to a csv file as</p>
  
  <pre><code>root,1232
  admin,4343
  test_admin,2233
  </code></pre>
  
  <p>Please suggest.</p>