mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
@@ -145,6 +145,7 @@ class Runner(object):
|
||||
su_user=None, # User to su to when running command, ex: 'root'
|
||||
su_pass=C.DEFAULT_SU_PASS,
|
||||
run_hosts=None, # an optional list of pre-calculated hosts to run on
|
||||
no_log=False, # option to enable/disable logging for a given task
|
||||
):
|
||||
|
||||
# used to lock multiprocess inputs and outputs at various levels
|
||||
@@ -196,6 +197,7 @@ class Runner(object):
|
||||
self.su_user_var = su_user
|
||||
self.su_user = None
|
||||
self.su_pass = su_pass
|
||||
self.no_log = no_log
|
||||
|
||||
if self.transport == 'smart':
|
||||
# if the transport is 'smart' see if SSH can support ControlPersist if not use paramiko
|
||||
@@ -341,6 +343,8 @@ class Runner(object):
|
||||
# if module isn't using AnsibleModuleCommon infrastructure we can't be certain it knows how to
|
||||
# do --check mode, so to be safe we will not run it.
|
||||
return ReturnData(conn=conn, result=dict(skipped=True, msg="cannot yet run check mode against old-style modules"))
|
||||
elif 'NO_LOG' in args:
|
||||
return ReturnData(conn=conn, result=dict(skipped=True, msg="cannot use no_log: with old-style modules"))
|
||||
|
||||
args = template.template(self.basedir, args, inject)
|
||||
|
||||
|
||||
@@ -220,6 +220,8 @@ class ActionModule(object):
|
||||
pipes.quote(tmp_src), pipes.quote(source_rel))
|
||||
if self.runner.noop_on_check(inject):
|
||||
module_args_tmp = "%s CHECKMODE=True" % module_args_tmp
|
||||
if self.runner.no_log:
|
||||
module_args_tmp = "%s NO_LOG=True" % module_args_tmp
|
||||
module_return = self.runner._execute_module(conn, tmp, 'file', module_args_tmp, inject=inject, complex_args=complex_args)
|
||||
|
||||
module_result = module_return.result
|
||||
|
||||
@@ -45,6 +45,9 @@ class ActionModule(object):
|
||||
# python modules for now
|
||||
module_args += " CHECKMODE=True"
|
||||
|
||||
if self.runner.no_log:
|
||||
module_args += " NO_LOG=True"
|
||||
|
||||
# shell and command are the same module
|
||||
if module_name == 'shell':
|
||||
module_name = 'command'
|
||||
|
||||
Reference in New Issue
Block a user