Seems like this should be pretty simple, but I can’t seem to find a way to do it. Is there some way to perform a local_action whenever a target is unreachable? I just want to post to a slack channel if ping fails.
~Bill
Seems like this should be pretty simple, but I can’t seem to find a way to do it. Is there some way to perform a local_action whenever a target is unreachable? I just want to post to a slack channel if ping fails.
~Bill
You could probably do this with sth like this:
(in a playbook)
host: unreachable_host
gather_facts: false
pre_tasks:
block:
name: Gathering facts
setup:
rescue:
name: local task
debug:
msg: …
Don’t think so. If a host unreachable, rescue never happens.
OK, this works: you store the results, clear errors on hosts and look for problem children.
`
It will only work if at least one host is reachable, but that's probably good enough.
By the way, you don't need your two block: since they only have one task each.
Thanks. Yes, I had the blocks there because I had been playing with the rescue approach earlier.