OK, this works: you store the results, clear errors on hosts and look for 
problem children.


---
- hosts: all
 gather_facts: no
 tasks:
   - block: 
      - setup:        
       register: result     
      
    - name: clearing host errors
     meta: clear_host_errors
   
   - block:
     - local_action:
         module: slack
         token: "redacted"
         msg: "Ping failed on host {{inventory_hostname}}"
     when: result.unreachable is defined




On Thursday, August 3, 2017 at 8:02:56 AM UTC-5, William McKenzie wrote:
>
> 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 received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/706f388e-ac82-43f7-a529-d54fdc252f4c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to