Hi,
i’m probably hitting a basic newbie misunderstanding here. What would be the best practice approach to write a playbook that does something like:
Call a playbook like patch_hosts.yml , targetting all hosts.
patch_hosts will run a yum update. But first, it’ll detect if the host is in a cluster, and if so, shutdown the cluster. If it’s running websphere, it’ll shut that down. If it’s running a DB, etc, etc.
Then for the patching, it can also get funky: if it’s a cluster it’s going to yum update, then reboot, then patch the cluster, make some checks, etc. Same kind of complexity for websphere patching, and so forth. There could be a pile of fixes to apply in sequence that take quite some time.
Basically, in the end this playbook is branching out into other playbooks. In the end I’m running lots of tasks against lots of hosts.
The problem is, if I have 1000 hosts and 50 are going to install websphere_patch_123456, I’ll have 950 hosts that skip that task, but nevertheless wait for the 50 to complete. Same for clusters, same for other apps, etc.
End result, I have 1000 hosts running actions that, if individually run per host, might take 30 minutes, but because everyone is basically executing/skipping every task and waiting for each other, it ends up meaning the total time is going to almost be the sum of all the slowest tasks of the slowest hosts, run in sequence. It can end up absurdly long.
What’s the correct approach here? Is attempting to use a top-level “patch_everything.yml” not the best practice? Or is there some “fork and forget and run everywhere individually” option? Note, I do not want to fire and forget individual tasks, I want to fire and forget the entire playbook against each host, as if I was doing a for x in hostlist ; do ansible-playbook xxx loop. Which I could do but seems like a very clunky workaround.