I didn’t find any working ansible commands to do something on a node, then reboot it, wait for it to come back and do other stuff, so I experimented around and wrote a working
You’ll probably run into trouble when your SSH port is not 22. I guess you can write something with jinja2 syntax to get the SSH port from ansible.
It probably will not work at all, if your SSH port is defined in an ssh_config file (Read the man page for that name, if you don’t know what it is, if you’re interested) and not the ansible hosts list.
I tested this on Ansible 188.8.131.52 and it works here.