Skip to content

Instantly share code, notes, and snippets.

@tomassedovic
Created September 20, 2016 13:38
Show Gist options
  • Save tomassedovic/1c559cc05d2800952c534c0c20a5117d to your computer and use it in GitHub Desktop.
Save tomassedovic/1c559cc05d2800952c534c0c20a5117d to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from ansible.plugins.callback import CallbackBase
class CallbackModule(CallbackBase):
CALLBACK_VERSION = 2.0
CALLBACK_TYPE = 'stdout'
CALLBACK_NAME = 'validation_output'
def __init__(self, display=None):
super(CallbackModule, self).__init__(display)
def v2_playbook_on_stats(self, stats):
hosts = sorted(stats.processed.keys())
summaries = [stats.summarize(host) for host in hosts]
failed = any((summary.get('failures', 0) > 0 for summary in summaries))
if failed:
print "LOOOOOL"
else:
print "LOL"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment