Host upgrade order in playbook

We’re trying to build a playbook to update our servers OS packages as part of regular maintenance.

What I’d like is to be able to execute the playbook and have it just run the tasks to completion, in as parallel a manner as our infrastructure can tolerate.

All rather straight forward.

The problem comes with host dependencies. In quite a few cases we need hosts to execute in a specific order ie. server a then server b then server c. I’d like to call the playbook with a parallelism of 20, specify our inventory file and then let ansible work out the upgrade order.

Any ideas on a best approach?

I’ve tried googling this, but I suspect I’m using the wrong words for the problem.

Variables set for each host on completion “upgrade_complete=True” then check for that in the other host before it’s upgrade starts? Can I even access cross host variables in a heavily parallelised environment?

Any suggestions would be much appreciated. Or words to feed into Google :slight_smile:

Thanks,
Dave