0Pricing
Ansible Academy · Lesson

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

  1. The loop Keyword Over a List
  2. Looping Over Dictionaries
  3. Nested Loops with subelements
  4. loop_control: label, index & pause
← Back to Ansible Academy