From 2f2e792cae85838766d94cf755b1f26f74f67a06 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Tue, 28 Feb 2017 18:06:06 +0000 Subject: [PATCH] Added support for ANSIBLE_VERBOSITY environment variable Fixes 22087 Signed-off-by: Sorin Sbarnea --- lib/ansible/cli/__init__.py | 2 +- lib/ansible/constants.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/cli/__init__.py b/lib/ansible/cli/__init__.py index 32cb932cb5..d4585def51 100644 --- a/lib/ansible/cli/__init__.py +++ b/lib/ansible/cli/__init__.py @@ -287,7 +287,7 @@ class CLI(with_metaclass(ABCMeta, object)): # base opts parser = SortedOptParser(usage, version=CLI.version("%prog")) - parser.add_option('-v','--verbose', dest='verbosity', default=0, action="count", + parser.add_option('-v','--verbose', dest='verbosity', default=C.DEFAULT_VERBOSITY, action="count", help="verbose mode (-vvv for more, -vvvv to enable connection debugging)") if inventory_opts: diff --git a/lib/ansible/constants.py b/lib/ansible/constants.py index 299917b75f..fbc89ca495 100644 --- a/lib/ansible/constants.py +++ b/lib/ansible/constants.py @@ -195,6 +195,7 @@ MERGE_MULTIPLE_CLI_TAGS = get_config(p, DEFAULTS, 'merge_multiple_cli_tags', 'AN #### GENERALLY CONFIGURABLE THINGS #### DEFAULT_DEBUG = get_config(p, DEFAULTS, 'debug', 'ANSIBLE_DEBUG', False, value_type='boolean') +DEFAULT_VERBOSITY = get_config(p, DEFAULTS, 'verbosity', 'ANSIBLE_VERBOSITY', 0, value_type='integer') DEFAULT_HOST_LIST = get_config(p, DEFAULTS,'inventory', 'ANSIBLE_INVENTORY', DEPRECATED_HOST_LIST, value_type='path') DEFAULT_ROLES_PATH = get_config(p, DEFAULTS, 'roles_path', 'ANSIBLE_ROLES_PATH', '/etc/ansible/roles', value_type='pathlist', expand_relative_paths=True) DEFAULT_REMOTE_TMP = get_config(p, DEFAULTS, 'remote_tmp', 'ANSIBLE_REMOTE_TEMP', '~/.ansible/tmp')