EasyEnv
Engineering/Courses/Catalog/Ansible/Loops and Conditionals
Ansible
IntermediateLesson 7 of 1230 min · hands-on

Loops and Conditionals

Part of the Ansible course

A playbook that installs one package has one task. A playbook that installs ten packages should not have ten nearly identical tasks that differ only in a package name, and a playbook that only needs to touch some of your machines should not run every task against all of them regardless.

Picture a machine on an assembly line that stamps the same shape onto a sheet of metal, over and over, once per sheet fed into it. The machine does not care that sheet three is a slightly different size than sheet seven, it repeats the identical stamping motion for whatever comes down the line. ...

Want to learn Ansible Loops and Conditionals in a real environment?

Click below, get a fresh Linux box with Ansible ready to go, and work through Loops and Conditionals hands-on with an AI tutor that knows your code.

Start this lessonLoops and Conditionals

What you'll learn

  • Loop keyword
  • Loop with dicts
  • When conditionals
  • Register
  • Block and rescue basics

Read this lesson in your language

All lessons in this course

12 lessons
  1. 1What Is Ansible20 min
  2. 2Inventory and Ad Hoc Commands25 min
  3. 3Your First Playbook30 min
  4. 4Tasks, Modules, and Handlers30 min
  5. 5Variables and Facts30 min
  6. 6Templates with Jinja230 min
  7. 7Loops and Conditionals30 min
  8. 8Roles and Galaxy35 min
  9. 9Vault and Secrets25 min
  10. 10Tags and Debugging25 min
  11. 11Collections and Plugins25 min
  12. 12Capstone: Multi Host Deploy60 min

Explore other courses

Loops and Conditionals - Ansible (English) | Engineering Courses