Is the an equivalent of `serial: 1` looping over whole playbooks?

Hi Ansible list,

I’m thinking my way through a solution to loop through a set of hosts and run a playbook against them one at a time. If the playbook had only one play in it that’d be easy:

`

  • name: Do something against a few hosts at a time.
    hosts: target-hosts
    serial: 2
    max_fail_percentage: 20

tasks:
[…]

`

But I want to do something that goes like:

  1. remove a cloud instance
  2. spin up a replacement
  3. deploy a build to it
  4. update load balancers and monitoring to include the new host

Where some of those operations want to run as local actions and others on different remote hosts, and many happen in roles, so these steps are split out into separate plays.

In pre-2.0 Ansible versions you could run playbook-level includes using with_items and iterate over a playbook end-to-end that way, but that functionality has been removed now.

Is there a way of executing whole playbook one host at a time within Ansible itself currently, other than? It seems like it’d be a reasonably common use case for patching/upgrades where you benefit from making changes a few hosts at a time and validating them before moving on, but I’ve only spotted descriptions of people doing this at play or task level, not with whole playbooks. Or if not, how have other people solved a problem like this where you want

thanks for any thoughts!

Nikki