0Pricing
Ansible Academy · Lesson

Combining Conditions with and / or

Build compound when expressions.

More Than One Rule

Real decisions need several rules at once. Ansible lets you combine tests with and and or inside a single when. 🔗

Both Must Be True

With and, every part must hold. This task runs only on Debian hosts that also requested the extras.

when: ansible_os_family == "Debian" and install_extras

All lessons in this course

  1. Run a Task Only when True
  2. Branch on OS Family Facts
  3. Combining Conditions with and / or
  4. Register a Result, Then Decide
← Back to Ansible Academy