There’s a wait option on ec2 instance creation that will stop the playbook until the instance is up. Not sure what exactly it is testing, but I’ve seen it there.
A primitive alternative is just to stick a one-minute (or whatever is needed) delay into the playbook.
You can also put a delay loop in. See this link and seach for “Retrying”:
The ‘wait: true’ option is one I have already put into the role, but it is returning before the boot-up sequence has completed.
I think what I’ll try to do is move the logic for waiting into the boot-up scripts themselves, so that I can spin them all up at once and have then wait on the primary to serve up the metadata needed.