0Pricing
Ansible Academy · Lesson

The loop Keyword Over a List

Install many packages in one task.

Stop Copy-Pasting Tasks

Need to install three packages? Writing three near-identical tasks is tedious and error-prone. The loop keyword lets one task repeat over a list. 🔁

What loop Does

Add loop to a task and give it a list. Ansible runs that task once per item, plugging each value into the module's arguments.

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