Hi Ansible Developers.
I want to know how to use “with_items:” loop in my own custom module ?
e.g.
`
tasks:
- name: “Something custom action”
my_first_mod:
name: “{{ item }}”
with_items:
- ‘andres’
- ‘lukas’
`
Any help in where I’ve gone wrong with this would be much appreciated.
Hi Shin,
Following tasks should work as expected, and shall loop over input list by one item each time. Just for reference:
Using with_items to loop over list:
tasks:
- name: loop over items
debug:
msg: “{{ item }}”
with_items:
- item_1
- item_2
Using Loop to loop over list:
tasks:
- name: loop over items
debug:
msg: “{{ item }}”
loop:
- item_1
- item_2
I want to know the issue/error you are facing when you are trying the same with your custom module.
Regards,
Sumit Jaiswal
alias: justjais
Hello justjais.
Thank you for your reply.
Check it again my playbook, I missed some…, “with_items:” indent issue. jumping to conclusion!
Case closed.
2018年11月2日金曜日 19時32分03秒 UTC+9 Sumit Jaiswal: