diff --git a/bin/ansible b/bin/ansible
index 5304ac3c7f3..fd87a40d36e 100755
--- a/bin/ansible
+++ b/bin/ansible
@@ -96,7 +96,7 @@ class Cli(object):
pattern=pattern,
callbacks=self.callbacks, sudo=options.sudo,
sudo_pass=sudopass,sudo_user=options.sudo_user,
- transport=options.connection, debug=options.debug
+ transport=options.connection, verbose=options.verbose
)
if options.seconds:
diff --git a/bin/ansible-playbook b/bin/ansible-playbook
index 8df340df4e9..0e44ffe592b 100755
--- a/bin/ansible-playbook
+++ b/bin/ansible-playbook
@@ -58,15 +58,15 @@ def main(args):
for playbook in args:
stats = callbacks.AggregateStats()
- playbook_cb = callbacks.PlaybookCallbacks()
- runner_cb = callbacks.PlaybookRunnerCallbacks(stats)
+ playbook_cb = callbacks.PlaybookCallbacks(verbose=options.verbose)
+ runner_cb = callbacks.PlaybookRunnerCallbacks(stats, verbose=options.verbose)
pb = ansible.playbook.PlayBook(
playbook=playbook,
module_path=options.module_path,
host_list=options.inventory,
forks=options.forks,
- debug=options.debug,
+ verbose=options.verbose,
remote_user=options.remote_user,
remote_pass=sshpass,
callbacks=playbook_cb,
diff --git a/docs/man/man1/ansible-playbook.1 b/docs/man/man1/ansible-playbook.1
index 4411b79906a..eb3ba53ab03 100644
--- a/docs/man/man1/ansible-playbook.1
+++ b/docs/man/man1/ansible-playbook.1
@@ -2,12 +2,12 @@
.\" Title: ansible-playbook
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets v1.75.2
-.\" Date: 05/25/2012
+.\" Date: 06/19/2012
.\" Manual: System administration commands
.\" Source: Ansible 0.5
.\" Language: English
.\"
-.TH "ANSIBLE\-PLAYBOOK" "1" "05/25/2012" "Ansible 0\&.5" "System administration commands"
+.TH "ANSIBLE\-PLAYBOOK" "1" "06/19/2012" "Ansible 0\&.5" "System administration commands"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -34,9 +34,9 @@ The names of one or more YAML format files to run as ansible playbooks\&.
.RE
.SH "OPTIONS"
.sp
-\fB\-D\fR, \fB\-\-debug\fR
+\fB\-v\fR, \fB\-\-verbose\fR
.sp
-Debug mode
+Verbose mode, more output from successful actions will be shown
.PP
\fB\-i\fR \fIPATH\fR, \fB\-\-inventory=\fR\fIPATH\fR
.RS 4
diff --git a/docs/man/man1/ansible-playbook.1.asciidoc.in b/docs/man/man1/ansible-playbook.1.asciidoc.in
index 527ae091d19..377dcef5326 100644
--- a/docs/man/man1/ansible-playbook.1.asciidoc.in
+++ b/docs/man/man1/ansible-playbook.1.asciidoc.in
@@ -34,9 +34,9 @@ The names of one or more YAML format files to run as ansible playbooks.
OPTIONS
-------
-*-D*, *--debug*
+*-v*, *--verbose*
-Debug mode
+Verbose mode, more output from successful actions will be shown
*-i* 'PATH', *--inventory=*'PATH'::
diff --git a/docs/man/man1/ansible.1 b/docs/man/man1/ansible.1
index 31bfe865b7f..0554ebdc9b0 100644
--- a/docs/man/man1/ansible.1
+++ b/docs/man/man1/ansible.1
@@ -2,12 +2,12 @@
.\" Title: ansible
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets v1.75.2
-.\" Date: 05/25/2012
+.\" Date: 06/19/2012
.\" Manual: System administration commands
.\" Source: Ansible 0.5
.\" Language: English
.\"
-.TH "ANSIBLE" "1" "05/25/2012" "Ansible 0\&.5" "System administration commands"
+.TH "ANSIBLE" "1" "06/19/2012" "Ansible 0\&.5" "System administration commands"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -70,11 +70,6 @@ The
to pass to the module\&.
.RE
.PP
-\fB\-D\fR, \fB\-\-debug\fR
-.RS 4
-Debug mode
-.RE
-.PP
\fB\-k\fR, \fB\-\-ask\-pass\fR
.RS 4
Prompt for the SSH password instead of assuming key\-based authentication with ssh\-agent\&.
diff --git a/docs/man/man1/ansible.1.asciidoc.in b/docs/man/man1/ansible.1.asciidoc.in
index f01dc549e5e..794844fcebe 100644
--- a/docs/man/man1/ansible.1.asciidoc.in
+++ b/docs/man/man1/ansible.1.asciidoc.in
@@ -60,10 +60,6 @@ The 'DIRECTORY' to load modules from. The default is '/usr/share/ansible'.
The 'ARGUMENTS' to pass to the module.
-*-D*, *--debug*::
-
-Debug mode
-
*-k*, *--ask-pass*::
Prompt for the SSH password instead of assuming key-based authentication with ssh-agent.
diff --git a/lib/ansible/callbacks.py b/lib/ansible/callbacks.py
index c981aabb7e1..8921a994230 100644
--- a/lib/ansible/callbacks.py
+++ b/lib/ansible/callbacks.py
@@ -132,14 +132,10 @@ class CliRunnerCallbacks(DefaultRunnerCallbacks):
self._async_notified = {}
def on_failed(self, host, res):
- invocation = res.get('invocation','')
- if not invocation.startswith('async_status'):
- self._on_any(host,res)
+ self._on_any(host,res)
def on_ok(self, host, res):
- invocation = res.get('invocation','')
- if not invocation.startswith('async_status'):
- self._on_any(host,res)
+ self._on_any(host,res)
def on_unreachable(self, host, res):
if type(res) == dict:
@@ -180,28 +176,23 @@ class CliRunnerCallbacks(DefaultRunnerCallbacks):
class PlaybookRunnerCallbacks(DefaultRunnerCallbacks):
''' callbacks used for Runner() from /usr/bin/ansible-playbook '''
- def __init__(self, stats):
+ def __init__(self, stats, verbose=False):
self.stats = stats
self._async_notified = {}
+ self.verbose = verbose
def on_unreachable(self, host, msg):
print "fatal: [%s] => %s" % (host, msg)
def on_failed(self, host, results):
- invocation = results.get('invocation',None)
- if not invocation or invocation.startswith('setup ') or invocation.startswith('async_status '):
- print "failed: [%s] => %s\n" % (host, utils.smjson(results))
- else:
- print "failed: [%s] => %s => %s\n" % (host, invocation, utils.smjson(results))
+ print "failed: [%s] => %s\n" % (host, utils.smjson(results))
def on_ok(self, host, host_result):
- invocation = host_result.get('invocation','')
- if invocation.startswith('async_status'):
- pass
- elif not invocation or invocation.startswith('setup '):
+ # show verbose output for non-setup module results if --verbose is used
+ if not self.verbose or host_result.get("verbose_override",None) is not None:
print "ok: [%s]\n" % (host)
else:
- print "ok: [%s] => %s\n" % (host, invocation)
+ print "ok: [%s] => %s" % (host, utils.smjson(host_result))
def on_error(self, host, err):
print >>sys.stderr, "err: [%s] => %s\n" % (host, err)
@@ -230,8 +221,8 @@ class PlaybookRunnerCallbacks(DefaultRunnerCallbacks):
class PlaybookCallbacks(object):
''' playbook.py callbacks used by /usr/bin/ansible-playbook '''
- def __init__(self):
- pass
+ def __init__(self, verbose=False):
+ self.verbose = verbose
def on_start(self):
print "\n"
diff --git a/lib/ansible/playbook/__init__.py b/lib/ansible/playbook/__init__.py
index 4e9e5dbd3c3..738e38f9bad 100644
--- a/lib/ansible/playbook/__init__.py
+++ b/lib/ansible/playbook/__init__.py
@@ -55,7 +55,7 @@ class PlayBook(object):
remote_port = C.DEFAULT_REMOTE_PORT,
transport = C.DEFAULT_TRANSPORT,
private_key_file = C.DEFAULT_PRIVATE_KEY_FILE,
- debug = False,
+ verbose = False,
callbacks = None,
runner_callbacks = None,
stats = None,
@@ -95,7 +95,7 @@ class PlayBook(object):
self.remote_pass = remote_pass
self.remote_port = remote_port
self.transport = transport
- self.debug = debug
+ self.verbose = verbose
self.callbacks = callbacks
self.runner_callbacks = runner_callbacks
self.stats = stats
@@ -166,7 +166,7 @@ class PlayBook(object):
private_key_file=self.private_key_file,
setup_cache=self.SETUP_CACHE, basedir=self.basedir,
conditional=task.only_if, callbacks=self.runner_callbacks,
- debug=self.debug, sudo=task.play.sudo, sudo_user=task.play.sudo_user,
+ verbose=self.verbose, sudo=task.play.sudo, sudo_user=task.play.sudo_user,
transport=task.play.transport, sudo_pass=self.sudo_pass, is_playbook=True
)
@@ -256,7 +256,7 @@ class PlayBook(object):
forks=self.forks, module_path=self.module_path, timeout=self.timeout, remote_user=play.remote_user,
remote_pass=self.remote_pass, remote_port=play.remote_port, private_key_file=self.private_key_file,
setup_cache=self.SETUP_CACHE, callbacks=self.runner_callbacks, sudo=play.sudo, sudo_user=play.sudo_user,
- debug=self.debug, transport=play.transport, sudo_pass=self.sudo_pass, is_playbook=True
+ verbose=self.verbose, transport=play.transport, sudo_pass=self.sudo_pass, is_playbook=True
).run()
self.stats.compute(setup_results, setup=True)
diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py
index b5217badcbf..075a9fba838 100644
--- a/lib/ansible/runner/__init__.py
+++ b/lib/ansible/runner/__init__.py
@@ -111,7 +111,7 @@ class Runner(object):
private_key_file=C.DEFAULT_PRIVATE_KEY_FILE, sudo_pass=C.DEFAULT_SUDO_PASS,
background=0, basedir=None, setup_cache=None,
transport=C.DEFAULT_TRANSPORT, conditional='True', callbacks=None,
- debug=False, sudo=False, sudo_user=C.DEFAULT_SUDO_USER,
+ verbose=False, sudo=False, sudo_user=C.DEFAULT_SUDO_USER,
module_vars=None, is_playbook=False, inventory=None):
"""
@@ -172,7 +172,7 @@ class Runner(object):
self.module_args = module_args
self.module_vars = module_vars
self.timeout = timeout
- self.debug = debug
+ self.verbose = verbose
self.remote_user = remote_user
self.remote_pass = remote_pass
self.remote_port = remote_port
diff --git a/lib/ansible/utils.py b/lib/ansible/utils.py
index ee87cc72785..65650d2adfa 100644
--- a/lib/ansible/utils.py
+++ b/lib/ansible/utils.py
@@ -49,18 +49,12 @@ def exit(msg, rc=1):
def bigjson(result):
''' format JSON output (uncompressed) '''
- # hide some internals magic from command line userland
result2 = result.copy()
- if 'invocation' in result2:
- del result2['invocation']
return json.dumps(result2, sort_keys=True, indent=4)
def smjson(result):
''' format JSON output (compressed) '''
- # hide some internals magic from command line userland
result2 = result.copy()
- if 'invocation' in result2:
- del result2['invocation']
return json.dumps(result2, sort_keys=True)
def task_start_msg(name, conditional):
@@ -324,8 +318,8 @@ def base_parser(constants=C, usage="", output_opts=False, runas_opts=False, asyn
''' create an options parser for any ansible script '''
parser = SortedOptParser(usage)
- parser.add_option('-D','--debug', default=False, action="store_true",
- help='debug mode')
+ parser.add_option('-v','--verbose', default=False, action="store_true",
+ help='verbose mode')
parser.add_option('-f','--forks', dest='forks', default=constants.DEFAULT_FORKS, type='int',
help="specify number of parallel processes to use (default=%s)" % constants.DEFAULT_FORKS)
parser.add_option('-i', '--inventory-file', dest='inventory',
diff --git a/library/setup b/library/setup
index 52c7e62328f..fb181c93482 100755
--- a/library/setup
+++ b/library/setup
@@ -411,5 +411,8 @@ setup_result['changed'] = changed
setup_result['md5sum'] = md5sum2
setup_result['ansible_facts'] = setup_options
+# hack to keep --verbose from showing all the setup module results
+setup_result['verbose_override'] = True
+
print json.dumps(setup_result)
diff --git a/test/TestPlayBook.py b/test/TestPlayBook.py
index ec72f261e13..64d26a7ce93 100644
--- a/test/TestPlayBook.py
+++ b/test/TestPlayBook.py
@@ -63,7 +63,7 @@ class TestCallbacks(object):
def on_ok(self, host, result):
# delete certain info from host_result to make test comparisons easier
host_result = result.copy()
- for k in [ 'ansible_job_id', 'results_file', 'invocation', 'md5sum', 'delta', 'start', 'end' ]:
+ for k in [ 'ansible_job_id', 'results_file', 'md5sum', 'delta', 'start', 'end' ]:
if k in host_result:
del host_result[k]
for k in host_result.keys():