Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
aa095df1
Commit
aa095df1
authored
9 years ago
by
Brian Coca
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11511 from galindro/syslog_json_improvement
syslog_json call plugin improvements
parents
f67949e4
156dab31
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
plugins/callbacks/syslog_json.py
+10
-8
No files found.
plugins/callbacks/syslog_json.py
View file @
aa095df1
...
@@ -4,6 +4,7 @@ import json
...
@@ -4,6 +4,7 @@ import json
import
logging
import
logging
import
logging.handlers
import
logging.handlers
import
socket
class
CallbackModule
(
object
):
class
CallbackModule
(
object
):
"""
"""
...
@@ -26,22 +27,23 @@ class CallbackModule(object):
...
@@ -26,22 +27,23 @@ class CallbackModule(object):
os
.
getenv
(
'SYSLOG_PORT'
,
514
)),
os
.
getenv
(
'SYSLOG_PORT'
,
514
)),
facility
=
logging
.
handlers
.
SysLogHandler
.
LOG_USER
facility
=
logging
.
handlers
.
SysLogHandler
.
LOG_USER
)
)
self
.
logger
.
addHandler
(
handler
)
self
.
logger
.
addHandler
(
self
.
handler
)
self
.
hostname
=
socket
.
gethostname
()
def
on_any
(
self
,
*
args
,
**
kwargs
):
def
on_any
(
self
,
*
args
,
**
kwargs
):
pass
pass
def
runner_on_failed
(
self
,
host
,
res
,
ignore_errors
=
False
):
def
runner_on_failed
(
self
,
host
,
res
,
ignore_errors
=
False
):
self
.
logger
.
info
(
'RUNNER_ON_FAILED '
+
host
+
' '
+
json
.
dumps
(
res
,
sort_keys
=
True
))
self
.
logger
.
error
(
'
%
s ansible-command: task execution FAILED; host:
%
s; message:
%
s'
%
(
self
.
hostname
,
host
,
json
.
dumps
(
res
,
sort_keys
=
True
)
))
def
runner_on_ok
(
self
,
host
,
res
):
def
runner_on_ok
(
self
,
host
,
res
):
self
.
logger
.
info
(
'
RUNNER_ON_OK '
+
host
+
' '
+
json
.
dumps
(
res
,
sort_keys
=
True
))
self
.
logger
.
info
(
'
%
s ansible-command: task execution OK; host:
%
s; message:
%
s'
%
(
self
.
hostname
,
host
,
json
.
dumps
(
res
,
sort_keys
=
True
)
))
def
runner_on_skipped
(
self
,
host
,
item
=
None
):
def
runner_on_skipped
(
self
,
host
,
item
=
None
):
self
.
logger
.
info
(
'
RUNNER_ON_SKIPPED '
+
host
+
' ...'
)
self
.
logger
.
info
(
'
%
s ansible-command: task execution SKIPPED; host:
%
s; message:
%
s'
%
(
self
.
hostname
,
host
,
json
.
dumps
(
res
,
sort_keys
=
True
))
)
def
runner_on_unreachable
(
self
,
host
,
res
):
def
runner_on_unreachable
(
self
,
host
,
res
):
self
.
logger
.
info
(
'RUNNER_UNREACHABLE '
+
host
+
' '
+
json
.
dumps
(
res
,
sort_keys
=
True
))
self
.
logger
.
error
(
'
%
s ansible-command: task execution UNREACHABLE; host:
%
s; message:
%
s'
%
(
self
.
hostname
,
host
,
json
.
dumps
(
res
,
sort_keys
=
True
)
))
def
runner_on_no_hosts
(
self
):
def
runner_on_no_hosts
(
self
):
pass
pass
...
@@ -53,7 +55,7 @@ class CallbackModule(object):
...
@@ -53,7 +55,7 @@ class CallbackModule(object):
pass
pass
def
runner_on_async_failed
(
self
,
host
,
res
):
def
runner_on_async_failed
(
self
,
host
,
res
):
self
.
logger
.
info
(
'RUNNER_SYNC_FAILED '
+
host
+
' '
+
json
.
dumps
(
res
,
sort_keys
=
True
))
self
.
logger
.
error
(
'
%
s ansible-command: task execution FAILED; host:
%
s; message:
%
s'
%
(
self
.
hostname
,
host
,
json
.
dumps
(
res
,
sort_keys
=
True
)
))
def
playbook_on_start
(
self
):
def
playbook_on_start
(
self
):
pass
pass
...
@@ -77,10 +79,10 @@ class CallbackModule(object):
...
@@ -77,10 +79,10 @@ class CallbackModule(object):
pass
pass
def
playbook_on_import_for_host
(
self
,
host
,
imported_file
):
def
playbook_on_import_for_host
(
self
,
host
,
imported_file
):
self
.
logger
.
info
(
'
PLAYBOOK_ON_IMPORTED '
+
host
+
' '
+
json
.
dumps
(
res
,
sort_keys
=
True
))
self
.
logger
.
info
(
'
%
s ansible-command: playbook IMPORTED; host:
%
s; message:
%
s'
%
(
self
.
hostname
,
host
,
json
.
dumps
(
res
,
sort_keys
=
True
)
))
def
playbook_on_not_import_for_host
(
self
,
host
,
missing_file
):
def
playbook_on_not_import_for_host
(
self
,
host
,
missing_file
):
self
.
logger
.
info
(
'
PLAYBOOK_ON_NOTIMPORTED '
+
host
+
' '
+
json
.
dumps
(
res
,
sort_keys
=
True
))
self
.
logger
.
info
(
'
%
s ansible-command: playbook NOT IMPORTED; host:
%
s; message:
%
s'
%
(
self
.
hostname
,
host
,
json
.
dumps
(
res
,
sort_keys
=
True
)
))
def
playbook_on_play_start
(
self
,
name
):
def
playbook_on_play_start
(
self
,
name
):
pass
pass
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment