Hi, 
Some time ago I wrote a little awk-script to filter all output except 
errors to run playbooks via cronjob and only get emails if errors occured.
It was just for exercising and I used only a few test cases, so it might 
work or not ;). I don't use it in production, but perhaps it will help you.

Usage: ansible-playbook my_playbook.yml | ansible_silencer.sh

ansible_silencer.sh:
#!/bin/bash
awk '  /^\.\.\.ignoring/ { buffered=0 };
        { if ( buffered==1 ) {
            if ( play_printed==0 ) { print play; play_printed=1; };
            if ( task_printed==0 ) { print "\n" task; task_printed=1; };
            if ( handler_printed==0 ) { print "\n" handler; 
handler_printed=1; };
                print linebuffer; buffered=0; };};
        /^PLAY/  { play=$0; play_printed=0 };
        /^TASK/  { task=$0; task_printed=0; handler_printed=1 };
        /^RUNNING HANDLER/ { handler=$0; handler_printed=0; task_printed=1 
};
        /^fatal:/ { linebuffer=$0; buffered=1 }; '

-- 
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/cfbefc33-f97b-43bf-96c3-8adf1af21853%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to