when Host Unreachable, execute a command or a script only for the failed host

Hi,

I have a group of hosts (say 3 hosts) of which one becomes unresponsive (due to heavy load or sshd is not running etc reasons). So eventually Ansible Playbook would fail with unreachable host message for that host. I want to handle this error and run a script locally (where the playbook is running from) to shutdown the unreachable host (there is an API from VMware where I can use to shutdown the VM without having to ssh to the remote VM). I am trying to simulate this by running a dummy script however my command is not executing for the unreachable host or it is executing for the good hosts as well (the ones that i can reach) but I don’t want to. This is my playbook,