mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
parent
2f33c1a1a1
commit
5553b20828
206 changed files with 1853 additions and 1870 deletions
|
@ -33,6 +33,7 @@ except ImportError:
|
|||
|
||||
from ansible.plugins.callback import CallbackBase
|
||||
|
||||
|
||||
class CallbackModule(CallbackBase):
|
||||
"""
|
||||
ansible logstash callback plugin
|
||||
|
@ -69,9 +70,9 @@ class CallbackModule(CallbackBase):
|
|||
if not HAS_LOGSTASH:
|
||||
self.disabled = True
|
||||
self._display.warning("The required python-logstash is not installed. "
|
||||
"pip install python-logstash")
|
||||
"pip install python-logstash")
|
||||
else:
|
||||
self.logger = logging.getLogger('python-logstash-logger')
|
||||
self.logger = logging.getLogger('python-logstash-logger')
|
||||
self.logger.setLevel(logging.DEBUG)
|
||||
|
||||
self.handler = logstash.TCPLogstashHandler(
|
||||
|
@ -95,7 +96,7 @@ class CallbackModule(CallbackBase):
|
|||
'ansible_type': "start",
|
||||
'ansible_playbook': self.playbook,
|
||||
}
|
||||
self.logger.info("ansible start", extra = data)
|
||||
self.logger.info("ansible start", extra=data)
|
||||
|
||||
def v2_playbook_on_stats(self, stats):
|
||||
summarize_stat = {}
|
||||
|
@ -115,7 +116,7 @@ class CallbackModule(CallbackBase):
|
|||
'ansible_playbook': self.playbook,
|
||||
'ansible_result': json.dumps(summarize_stat),
|
||||
}
|
||||
self.logger.info("ansible stats", extra = data)
|
||||
self.logger.info("ansible stats", extra=data)
|
||||
|
||||
def v2_runner_on_ok(self, result, **kwargs):
|
||||
data = {
|
||||
|
@ -128,7 +129,7 @@ class CallbackModule(CallbackBase):
|
|||
'ansible_task': result._task,
|
||||
'ansible_result': self._dump_results(result._result)
|
||||
}
|
||||
self.logger.info("ansible ok", extra = data)
|
||||
self.logger.info("ansible ok", extra=data)
|
||||
|
||||
def v2_runner_on_skipped(self, result, **kwargs):
|
||||
data = {
|
||||
|
@ -140,7 +141,7 @@ class CallbackModule(CallbackBase):
|
|||
'ansible_task': result._task,
|
||||
'ansible_host': result._host.name
|
||||
}
|
||||
self.logger.info("ansible skipped", extra = data)
|
||||
self.logger.info("ansible skipped", extra=data)
|
||||
|
||||
def v2_playbook_on_import_for_host(self, result, imported_file):
|
||||
data = {
|
||||
|
@ -152,7 +153,7 @@ class CallbackModule(CallbackBase):
|
|||
'ansible_host': result._host.name,
|
||||
'imported_file': imported_file
|
||||
}
|
||||
self.logger.info("ansible import", extra = data)
|
||||
self.logger.info("ansible import", extra=data)
|
||||
|
||||
def v2_playbook_on_not_import_for_host(self, result, missing_file):
|
||||
data = {
|
||||
|
@ -164,7 +165,7 @@ class CallbackModule(CallbackBase):
|
|||
'ansible_host': result._host.name,
|
||||
'missing_file': missing_file
|
||||
}
|
||||
self.logger.info("ansible import", extra = data)
|
||||
self.logger.info("ansible import", extra=data)
|
||||
|
||||
def v2_runner_on_failed(self, result, **kwargs):
|
||||
data = {
|
||||
|
@ -178,7 +179,7 @@ class CallbackModule(CallbackBase):
|
|||
'ansible_result': self._dump_results(result._result)
|
||||
}
|
||||
self.errors += 1
|
||||
self.logger.error("ansible failed", extra = data)
|
||||
self.logger.error("ansible failed", extra=data)
|
||||
|
||||
def v2_runner_on_unreachable(self, result, **kwargs):
|
||||
data = {
|
||||
|
@ -191,7 +192,7 @@ class CallbackModule(CallbackBase):
|
|||
'ansible_task': result._task,
|
||||
'ansible_result': self._dump_results(result._result)
|
||||
}
|
||||
self.logger.error("ansbile unreachable", extra = data)
|
||||
self.logger.error("ansbile unreachable", extra=data)
|
||||
|
||||
def v2_runner_on_async_failed(self, result, **kwargs):
|
||||
data = {
|
||||
|
@ -205,4 +206,4 @@ class CallbackModule(CallbackBase):
|
|||
'ansible_result': self._dump_results(result._result)
|
||||
}
|
||||
self.errors += 1
|
||||
self.logger.error("ansible async", extra = data)
|
||||
self.logger.error("ansible async", extra=data)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue