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.
I want to do something like this:
- name: my task
module_name:
<some more params>
register: [var1, var2]
If I add register: var1 \n register: var2 then only the second one get's registered.
EDIT:
OK, I think my confusion lied in the bit how variable registration works. So when you do register: any_var_name, 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.