Hi all

I have a playbook that checks 2 servers for log entrys, below is what is 
expected when it runs correctly: (part of the playbook below)

########################################

    - name: check logs for  Completion
      shell: "docker logs --since 13h ***_***_1 | grep '********' | cut -d' 
' -f2,16-30"
      register: command_output


    - name: sucess notification message via Slack
      slack:
        token: "*******************************"
        msg: "some message"
        username: 'Ansible'
        link_names: 0
        parse: 'none'
        color: 'good' #normal, good, warning, danger
      delegate_to: localhost
      when: *command_output.stdout | length > 0*
      ignore_errors: yes

########################################

and this is the output form the command line:

TASK [success notification message via Slack] 
*****************************************************************
skipping: [10.*.0.138]
*ok: [10.*.0.137 -> localhost]*

########################################

As the task is looking in the logs on both of these hosts will only find 
the entry on 1 of the hosts, and therefore only send the message from the 
server that could actually find the log and not from both servers so that 
the slack channel is not getting bombarded with blank messages from the 
host that didn't have then log entry.



This is all fine until I want to run another play as an alert if both hosts 
skipped the task due to the log not existing on either host. So for example 
this:

TASK [success notification message via Slack] 
*****************************************************************
*skipping: [10.*.0.137]*

*skipping: [10.*.0.138]*

########################################

How could I get around this? and is it even possible?

If there was a way to check the status of a play and if that play had 
skipped all hosts then run another play that would be great.

Hope I have made this understandable, if not please let me know where i 
confused you :)

-- 
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/12b74de8-c0be-4761-8983-95be0729f1c0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to