← All Ansible Automation Flashcard Decks

Ansible Playbook Structure and Variables Flashcards

6 cards from real Ansible Automation practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.

Read the first 6 Ansible Playbook Structure and Variables flashcards as text
  1. What Ansible keyword allows you to iterate over a list of items in a task?

    Answer: loop

    The 'loop' keyword (introduced in Ansible 2.5) is the modern way to iterate over a list in a task, replacing older 'with_*' constructs.

  2. How do you register the output of a task into a variable in Ansible?

    Answer: Use the 'register' keyword followed by the variable name

    The 'register' keyword captures a task's return value into a named variable for use in subsequent tasks.

  3. What is the function of 'block', 'rescue', and 'always' in an Ansible playbook?

    Answer: They provide structured error handling—block runs tasks, rescue handles failures, always runs regardless of outcome

    'block/rescue/always' implements try/catch/finally style error handling in Ansible playbooks.

  4. In Ansible, what is the difference between 'import_tasks' and 'include_tasks'?

    Answer: import_tasks is static (parsed upfront) enabling full tag/check-mode support; include_tasks is dynamic allowing variable-based file names

    Static imports are processed at parse time (full feature support), while dynamic includes are processed at runtime (conditional file selection).

  5. What does the 'notify' directive do in an Ansible task, and when does the notified handler execute?

    Answer: It triggers a named handler to run at the end of the play, but only if the notifying task reported a change

    Handlers are triggered by 'notify' and run once at the end of the play, only when the notifying task made a change.

  6. What is the purpose of the 'delegate_to' directive in an Ansible task?

    Answer: It runs the task on a different host than the one currently being processed

    'delegate_to' redirects task execution to a specified host while maintaining the context (variables, facts) of the current target host.

How this page was made: written with AI tools and published by Nathan Beja, founder of Practice Test Geeks, who is responsible for its content. Exam facts are checked against the official sources listed below. Not reviewed by a subject-matter expert. Editorial policy

Sources & references

Exam facts on this page (fees, format, dates, passing scores) are checked against these official sources; the date is our last check. Editorial policy

  1. redhat.com — Score release, test delivery, renewal, score validity, exam information · verified Oct 2026
  2. docs.redhat.com — Fees, exam format, retake policy · verified Oct 2026