allow skipping debug depending on verbosity
This commit is contained in:
parent
fe09f7ee49
commit
5552c04976
1 changed files with 26 additions and 18 deletions
|
@ -26,7 +26,7 @@ class ActionModule(ActionBase):
|
|||
''' Print statements during execution '''
|
||||
|
||||
TRANSFERS_FILES = False
|
||||
VALID_ARGS = set(['msg', 'var'])
|
||||
VALID_ARGS = set(['msg', 'var', 'verbosity'])
|
||||
|
||||
def run(self, tmp=None, task_vars=None):
|
||||
if task_vars is None:
|
||||
|
@ -41,6 +41,12 @@ class ActionModule(ActionBase):
|
|||
|
||||
result = super(ActionModule, self).run(tmp, task_vars)
|
||||
|
||||
verbosity = 0
|
||||
# get task verbosity
|
||||
if 'verbosity' in self._task.args:
|
||||
verbosity = int(self._task.args['verbosity'])
|
||||
|
||||
if verbosity <= self._display.verbosity:
|
||||
if 'msg' in self._task.args:
|
||||
result['msg'] = self._task.args['msg']
|
||||
|
||||
|
@ -62,5 +68,7 @@ class ActionModule(ActionBase):
|
|||
|
||||
# force flag to make debug output module always verbose
|
||||
result['_ansible_verbose_always'] = True
|
||||
else:
|
||||
result['skipped'] = True
|
||||
|
||||
return result
|
||||
|
|
Loading…
Add table
Reference in a new issue