Interview Prep/Ansible/Jinja2, Conditionals and Loops

What does `loop_control` provide?

IntermediateConceptJinja2, Conditionals and Loops
Answer
  • label — what is printed for each item (hides noisy dicts and secrets)
  • loop_var — rename item, essential in nested includes
  • index_var — expose the loop index
  • pause — sleep between iterations
  • extended: true — adds ansible_loop (first, last, length, previtem, nextitem)
loop: "{{ users }}"
loop_control:
  label: "{{ item.name }}"
  pause: 2
All Ansible questions Roadmap: Ansible

More on Jinja2, Conditionals and Loops