loop_control: label, index & pause
Tame loop output and behavior.
Loops Can Get Noisy
When item is a big dictionary, the output dumps the whole thing every iteration. The loop_control keyword tames that mess. 🧹
Add loop_control
Place loop_control beside loop in the same task. It holds options that change how the loop behaves and reports.
- ansible.builtin.user:
name: "{{ item.name }}"
loop: "{{ users }}"
loop_control:
label: "{{ item.name }}"All lessons in this course
- The loop Keyword Over a List
- Looping Over Dictionaries
- Nested Loops with subelements
- loop_control: label, index & pause