title: Ansible register multiple variables within a single task
body: <p>I have an ansible task and I want to register multiple variables inside it, how do I achieve this? It doesn't seem that a list or a comma separated string would work.</p>
  
  <p>I want to do something like this:</p>
  
  <pre><code>- name: my task
    module_name:
      &lt;some more params&gt;
    register: [var1, var2]
  </code></pre>
  
  <p>If I add <code>register: var1 \n register: var2</code> then only the second one get's registered.</p>
  
  <p>EDIT:
  OK, I think my confusion lied in the bit how variable registration works. So when you do <code>register: any_var_name</code>, the newly created variable contains the whole output of the task. Then you can access it any way you want as in the accepted answer.</p>