Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fluentd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ansible
Plugins
fluentd
Commits
63bd69e4
Commit
63bd69e4
authored
8 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
ansible-playbooks/general#69 more comprehensive logging
parent
721923be
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fluentd.py
+86
-0
86 additions, 0 deletions
fluentd.py
with
86 additions
and
0 deletions
fluentd.py
+
86
−
0
View file @
63bd69e4
...
...
@@ -92,10 +92,27 @@ class CallbackModule(CallbackBase):
}
self
.
logger
.
_log
(
severity
,
json
.
dumps
(
data
),
None
)
##### PLAYBOOK callbacks #####
def
v2_playbook_on_start
(
self
,
playbook
):
self
.
playbook
=
playbook
.
_file_name
self
.
_log
(
logging
.
INFO
,
'
OK
'
,
'
start
'
,
'
Start playbook %s
'
%
self
.
playbook
)
def
v2_playbook_on_play_start
(
self
,
play
):
self
.
_log
(
logging
.
INFO
,
'
OK
'
,
'
start
'
,
'
Start play %s
'
%
play
.
get_name
().
strip
())
def
v2_playbook_on_task_start
(
self
,
task
,
is_conditional
):
super
(
CallbackModule
,
self
).
v2_playbook_on_task_start
(
task
,
is_conditional
)
def
v2_playbook_on_cleanup_task_start
(
self
,
task
):
super
(
CallbackModule
,
self
).
v2_playbook_on_cleanup_task_start
(
task
)
def
v2_playbook_on_notify
(
self
,
result
,
handler
):
super
(
CallbackModule
,
self
).
v2_playbook_on_notify
(
result
,
handler
)
def
v2_playbook_on_handler_task_start
(
self
,
task
):
super
(
CallbackModule
,
self
).
v2_playbook_on_handler_task_start
(
task
)
def
v2_playbook_on_stats
(
self
,
stats
):
summarize_stat
=
{}
for
host
in
stats
.
processed
.
keys
():
...
...
@@ -108,6 +125,33 @@ class CallbackModule(CallbackBase):
self
.
_log
(
logging
.
INFO
,
status
,
'
finish
'
,
'
Finish playbook %s
'
%
self
.
playbook
,
extra
=
summarize_stat
)
def
v2_playbook_on_setup
(
self
):
super
(
CallbackModule
,
self
).
v2_playbook_on_setup
()
def
v2_playbook_on_no_hosts_matched
(
self
):
super
(
CallbackModule
,
self
).
v2_playbook_on_no_hosts_matched
()
def
v2_playbook_on_no_hosts_remaining
(
self
):
super
(
CallbackModule
,
self
).
v2_playbook_on_no_hosts_remaining
()
def
v2_playbook_on_include
(
self
,
included_file
):
super
(
CallbackModule
,
self
).
v2_playbook_on_include
(
included_file
)
def
v2_playbook_on_import_for_host
(
self
,
result
,
imported_file
):
super
(
CallbackModule
,
self
).
v2_playbook_on_import_for_host
(
result
,
imported_file
)
def
v2_playbook_on_not_import_for_host
(
self
,
result
,
missing_file
):
super
(
CallbackModule
,
self
).
v2_playbook_on_not_import_for_host
(
result
,
missing_file
)
def
v2_playbook_on_vars_prompt
(
self
,
varname
,
private
=
True
,
prompt
=
None
,
encrypt
=
None
,
confirm
=
False
,
salt_size
=
None
,
salt
=
None
,
default
=
None
):
super
(
CallbackModule
,
self
).
v2_playbook_on_vars_prompt
(
varname
,
private
,
prompt
,
encrypt
,
confirm
,
salt_size
,
salt
,
default
)
##### RUNNER callbacks #####
def
v2_runner_on_ok
(
self
,
result
,
**
kwargs
):
task_name
=
str
(
result
.
_task
).
replace
(
'
TASK:
'
,
''
)
if
'
failed
'
in
result
.
_result
.
keys
()
and
result
.
_result
[
'
failed
'
]:
...
...
@@ -122,3 +166,45 @@ class CallbackModule(CallbackBase):
def
v2_runner_on_failed
(
self
,
result
,
**
kwargs
):
self
.
v2_runner_on_ok
(
result
)
def
v2_runner_on_unreachable
(
self
,
result
):
self
.
_log
(
logging
.
ERROR
,
'
FATAL
'
,
'
host
'
,
'
Host %s unreachable
'
%
result
.
_host
.
name
,
extra
=
result
.
_result
,
host
=
result
.
_host
.
name
)
def
v2_runner_on_async_poll
(
self
,
result
):
super
(
CallbackModule
,
self
).
v2_runner_on_async_poll
(
result
)
def
v2_runner_on_async_ok
(
self
,
result
):
super
(
CallbackModule
,
self
).
v2_runner_on_async_ok
(
result
)
def
v2_runner_on_async_failed
(
self
,
result
):
super
(
CallbackModule
,
self
).
v2_runner_on_async_failed
(
result
)
def
v2_runner_on_skipped
(
self
,
result
):
super
(
CallbackModule
,
self
).
v2_runner_on_skipped
(
result
)
def
v2_runner_on_file_diff
(
self
,
result
,
diff
):
super
(
CallbackModule
,
self
).
v2_runner_on_file_diff
(
result
,
diff
)
def
v2_runner_retry
(
self
,
result
):
super
(
CallbackModule
,
self
).
v2_runner_retry
(
result
)
def
v2_runner_item_on_ok
(
self
,
result
):
super
(
CallbackModule
,
self
).
v2_runner_item_on_ok
(
result
)
def
v2_runner_item_on_failed
(
self
,
result
):
super
(
CallbackModule
,
self
).
v2_runner_item_on_failed
(
result
)
def
v2_runner_item_on_skipped
(
self
,
result
):
super
(
CallbackModule
,
self
).
v2_runner_item_on_skipped
(
result
)
def
v2_runner_on_no_hosts
(
self
,
task
):
super
(
CallbackModule
,
self
).
v2_runner_on_no_hosts
(
task
)
##### OTHER callbacks #####
def
v2_on_file_diff
(
self
,
result
):
super
(
CallbackModule
,
self
).
v2_on_file_diff
(
result
)
def
v2_on_any
(
self
,
*
args
,
**
kwargs
):
super
(
CallbackModule
,
self
).
v2_on_any
(
*
args
,
**
kwargs
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment