module

Krikri::SerialBatches

serial: - real Ansible runs the WHOLE play against one batch of hosts at a time instead of every host at once, which is what makes a rolling restart rolling. This engine previously ignored the keyword entirely, so serial: 1 still hit every host simultaneously.

Class methods

order(hosts : Array(Host), order : String | Nil) : Array(Host)

order: - how hosts are sequenced before serial: batches them. Verified against ansible-core 2.19.4 over an inventory listing h3, h1, h2: inventory keeps that order, sorted gives h1 h2 h3, reverse_sorted h3 h2 h1, and reverse_inventory h2 h1 h3 (the inventory order reversed, NOT a sort).

Source
split(hosts : Array(Host), serial : Array(String)) : Array(Array(Host))

Splits hosts according to the play's serial tokens. Each token is either a count ("2") or a percentage of the TOTAL host count ("50%", rounded up); the last token sizes every remaining batch. Verified against ansible-core 2.19.4 for 1, 2, "50%" and [1, 2] over four hosts.

Source