Xu_Chen
(Xu Chen)
1
I am interested in doing something like this:
- name: loop over items
shell: cat /path/{{ item }}
with_items:
- t1
- t2
- t3
register: result[{{ item }}]
Then I can do something like:
- name: use the result hashtable
shell: echo /path/{{ result[item].stdout }}
with_items:
- t1
- t2
Is this possible? Thanks…
Xu_Chen
(Xu Chen)
2
I tried something like this, but it doesn’t work:
- name: loop over items
shell: cat /path/{{ item }}
with_items:
- t1
- t2
- t3
register: output
Then I can do something like:
- name: use the result hashtable
shell: echo /path/{{ output.results[loop.index0].stdout }}
with_items:
- t1
- t2
- t3
loop doesn’t seem to work in the task file…
No, register doesn't work like that, it just takes a simple string.