Courseiva
Coordinate rolling updates →mediumMultiple Choice

Ansible Serial Batch Size: Calculation and Valid Values

An Ansible playbook sets 'serial: 20%' for rolling updates, but the inventory contains 5 hosts. How many hosts are updated simultaneously?

Quick Answer

The answer is 1 because serial: 20% is evaluated as a percentage of the total inventory size at the time the play runs, and Ansible recalculates that number for whatever inventory it is actually working against rather than using a fixed count baked into the playbook. With 5 hosts in inventory, 20% of 5 works out to exactly 1.0, so the batch size for this run is 1 host at a time - there is no fractional host to round, but even when the math does not land on a whole number, Ansible rounds down rather than up, so a value like 22% of 5, which is 1.1, would still result in a batch size of 1, never 2. This matters because the same serial: 20% setting would produce a completely different batch size against a larger inventory, so the percentage form is really about scaling the rollout to the size of the fleet rather than specifying a fixed number of hosts. Whenever a question gives you a percentage-based serial value along with a specific inventory count, the way to solve it is to multiply the percentage by the total host count and round down to the nearest whole host, since Ansible never updates more hosts in a batch than that percentage actually allows.

⚠ Common exam trap

Test-takers frequently assume percentages are rounded up or that a fractional result like 1.0 would be treated as 2, but Ansible uses floor rounding (truncation) for serial batch sizes, and with exactly 1.0, the result is 1, not 2.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

1

When 'serial: 20%' is set in an Ansible playbook, the percentage is calculated based on the total number of hosts in the inventory. With 5 hosts, 20% of 5 equals 1.0, which is rounded down to 1. Therefore, only 1 host is updated at a time during the rolling update.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✓

    1

    Why this is correct

    Serial accepts a percentage, which Ansible converts to a host count by rounding up fractional results. Twenty percent of five hosts equals one, so a single host is updated per batch, giving strictly sequential updates across the inventory.

  • ✗

    2

    Why it's wrong here

    Ansible rounds the percentage down to the nearest whole host, so 20% of 5 yields 1, not 2. The figure 2 tempts because 20% of 5 is arithmetically 1, and rounding up feels natural, but Ansible's serial calculation truncates rather than rounds.

  • ✗

    3

    Why it's wrong here

    Ansible computes 20% of five hosts as one, rounding up to the nearest whole host, not three. Three would result from a serial value of 50% or greater against five hosts, or from an explicit serial: 3 setting.

  • ✗

    0

    Why it's wrong here

    Ansible rounds serial percentages up to at least one host, so 20% of five hosts yields one host, never zero. Zero would only arise from an empty inventory or a serial value of zero, which Ansible rejects as invalid configuration.

  • ✗

    5

    Why it's wrong here

    Serial limits each batch to 20% of the inventory, which rounds up to one host out of five, not all five. Updating all hosts simultaneously occurs when serial is omitted entirely or set to 100%.

About these practice questions

One of 392 original EX294 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

2 more ways this is tested on EX294

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. What is the effect of setting 'serial: 5' in an Ansible playbook that targets a group of 20 hosts?

easy
  • A.The playbook runs on 5 hosts per task, then moves to next task.
  • ✓ B.The playbook runs on 5 hosts at a time, sequentially.
  • C.The playbook runs only on the first 5 hosts.
  • D.The playbook runs on all 20 hosts at once.

Why B: Setting 'serial: 5' in an Ansible playbook configures the playbook to execute each task on a batch of 5 hosts at a time, moving to the next batch only after the current batch completes all tasks. This ensures that no more than 5 hosts are processed concurrently, providing controlled, sequential rolling updates across the 20-host group.

Variation 2. Which THREE of the following are valid 'serial' values for an Ansible rolling update playbook?

easy
  • ✓ A.serial: [1,2,3]
  • ✓ B.serial: 50%
  • ✓ C.serial: 1
  • D.serial: '25%'
  • E.serial: 'batch'

Why A: Option A (serial: [1,2,3]) is correct because Ansible accepts a list of integers for serial, applying each value in sequence to successive batches of hosts (first 1 host, then 2, then 3). Option B (serial: 50%) is correct because serial accepts a percentage string, so Ansible processes 50% of the hosts in each batch. Option C (serial: 1) is correct because a plain integer is the most basic valid serial value, running the play on one host at a time. Option D (serial: '25%') is not a valid serial value because the percentage must be an unquoted YAML scalar (or quoted without issue only when the value is a string, but Ansible expects the percentage form as a plain scalar; quoting it makes it a string that Ansible does not interpret as a percentage). Option E (serial: 'batch') is not valid because 'batch' is not a recognized keyword or numeric/percentage value for serial.

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This EX294 practice question is part of Courseiva's free Red Hat certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the EX294 exam.