LOGBOOK

HELP

Quiz Entry - updated: 2026.11.12

Why does the lab playbook start with a "fast fail" task, and how is it written?

It stops the play on hosts that can't run it before anything is changed: an ansible.builtin.fail task with a when that is true if the host has less RAM than min_ram_mb or isn't Debian.

- name: Zeige Nachricht für fehlende Systemanforderungen
  ansible.builtin.fail:
    msg: "Die {{ inventory_hostname }} erfüllte nicht die minimalen Anforderungen."
  when: >
    ansible_facts['memtotal_mb'] < min_ram_mb or
    ansible_facts['distribution'] != "Debian"

(The message means "host X did not meet the minimum requirements".)

Putting the check first is the point. If an unsuitable host fails halfway through, it is left half-configured: packages installed, a site enabled, no certificate. Failing on the first task leaves it untouched, and the message says exactly why.

The condition is the inverse of the requirements, joined with or: the host is rejected if either requirement is missed. On a host that meets both, the task shows as skipping, which is the expected result. memtotal_mb is a number fact, so the comparison with min_ram_mb (256) is numeric. The apt and a2enmod tasks that follow only work on Debian-family systems, which is why the distribution is part of the check.

Go deeper:

From Quiz: ITIA / Ansible Task Control: Loops, Conditionals, Handlers and Error Handling | Updated: Nov 12, 2026