Looping Over Dictionaries
Create users from key-value data.
Lists Are Not Enough
Creating users needs more than a name: a group, a shell, a state. A flat list cannot carry that. You need a list of dictionaries. 🗂️
A List of Dictionaries
Each list entry becomes a small dictionary of key-value pairs. One loop iteration then has several named fields to work with.
loop:
- { name: alice, group: admin }
- { name: bob, group: dev }All lessons in this course
- The loop Keyword Over a List
- Looping Over Dictionaries
- Nested Loops with subelements
- loop_control: label, index & pause