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
b5c62ec0
Commit
b5c62ec0
authored
Mar 20, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enhance logging, way to gate verbosity levels pending.
parent
05e27a41
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
11 deletions
+28
-11
bin/ansible-playbook
+10
-7
examples/playbooks/playbook3.yml
+0
-1
lib/ansible/playbook.py
+7
-1
lib/ansible/utils.py
+2
-2
test/TestPlayBook.py
+9
-0
No files found.
bin/ansible-playbook
View file @
b5c62ec0
...
...
@@ -43,6 +43,12 @@ class PlaybookCallbacks(object):
def
on_task_start
(
self
,
name
,
is_conditional
):
print
utils
.
task_start_msg
(
name
,
is_conditional
)
def
on_setup_primary
(
self
):
print
"SETUP PHASE ****************************
\n
"
def
on_setup_secondary
(
self
):
print
"
\n
VARIABLE IMPORT PHASE ******************
\n
"
def
on_unreachable
(
self
,
host
,
msg
):
print
"unreachable: [
%
s] =>
%
s"
%
(
host
,
msg
)
...
...
@@ -52,14 +58,11 @@ class PlaybookCallbacks(object):
def
on_ok
(
self
,
host
,
host_result
):
print
"ok: [
%
s]
\n
"
%
(
host
)
def
on_setup_primary
(
self
):
print
"preparing nodes..."
def
on_setup_secondary
(
self
):
print
"preparing conditional imports..."
def
on_import_for_host
(
self
,
host
,
imported_file
):
pass
print
"
%
s: importing
%
s"
%
(
host
,
imported_file
)
def
on_not_import_for_host
(
self
,
host
,
missing_file
):
print
"
%
s: not importing file:
%
s"
%
(
host
,
missing_file
)
def
on_play_start
(
self
,
pattern
):
print
"PLAY [
%
s] ****************************
\n
"
%
pattern
...
...
examples/playbooks/playbook3.yml
View file @
b5c62ec0
...
...
@@ -32,7 +32,6 @@
-
"
vars/external_vars.yml"
-
[
"
vars/$facter_operatingsystem.yml"
,
"
vars/defaults.yml"
]
# and this is just a regular task line from a playbook, as we're used to.
...
...
lib/ansible/playbook.py
View file @
b5c62ec0
...
...
@@ -465,8 +465,12 @@ class PlayBook(object):
SETUP_CACHE
[
host
]
.
update
(
data
)
self
.
callbacks
.
on_import_for_host
(
host
,
filename2
)
break
else
:
self
.
callbacks
.
on_not_import_for_host
(
host
,
filename2
)
if
not
found
:
raise
errors
.
AnsibleError
(
"no files matched for vars_files import sequence:
%
s"
%
sequence
)
raise
errors
.
AnsibleError
(
"
%
s: FATAL, no files matched for vars_files import sequence:
%
s"
%
(
host
,
sequence
)
)
else
:
filename2
=
utils
.
path_dwim
(
self
.
basedir
,
utils
.
template
(
filename
,
cache_vars
))
...
...
@@ -508,6 +512,8 @@ class PlayBook(object):
if
'failed'
in
host_result
:
self
.
callbacks
.
on_failed
(
host
,
host_result
)
self
.
failures
[
host
]
=
1
else
:
self
.
callbacks
.
on_ok
(
host
,
host_result
)
# now for each result, load into the setup cache so we can
# let runner template out future commands
...
...
lib/ansible/utils.py
View file @
b5c62ec0
...
...
@@ -54,9 +54,9 @@ def smjson(result):
def
task_start_msg
(
name
,
conditional
):
if
conditional
:
return
"NOTIFIED: [
%
s] **********
\n
"
%
name
return
"
\n
NOTIFIED: [
%
s] **********
\n
"
%
name
else
:
return
"TASK: [
%
s] *********
\n
"
%
name
return
"
\n
TASK: [
%
s] *********
\n
"
%
name
def
regular_generic_msg
(
hostname
,
result
,
oneline
,
caption
):
''' output on the result of a module run that is not command '''
...
...
test/TestPlayBook.py
View file @
b5c62ec0
...
...
@@ -35,6 +35,9 @@ class TestCallbacks(object):
def
on_import_for_host
(
self
,
host
,
filename
):
self
.
events
.
append
([
'import'
,
[
host
,
filename
]])
def
on_not_import_for_host
(
self
,
host
,
missing_filename
):
pass
def
on_task_start
(
self
,
name
,
is_conditional
):
self
.
events
.
append
([
'task start'
,
[
name
,
is_conditional
]])
...
...
@@ -63,6 +66,12 @@ class TestCallbacks(object):
def
on_dark_host
(
self
,
host
,
msg
):
self
.
events
.
append
([
'failed/dark'
,
[
host
,
msg
]])
def
on_setup_primary
(
self
):
pass
def
on_setup_secondary
(
self
):
pass
class
TestRunner
(
unittest
.
TestCase
):
...
...
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