mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-02 14:40:19 -07:00
Merge branch 'task-host-loop-bypass' of https://github.com/sivel/ansible into sivel-task-host-loop-bypass
This commit is contained in:
commit
e74853300a
4 changed files with 41 additions and 3 deletions
|
@ -405,6 +405,7 @@ class PlayBook(object):
|
|||
vault_pass = self.vault_password,
|
||||
run_hosts=hosts,
|
||||
no_log=task.no_log,
|
||||
run_once=task.run_once,
|
||||
)
|
||||
|
||||
runner.module_vars.update({'play_hosts': hosts})
|
||||
|
|
|
@ -31,7 +31,7 @@ class Task(object):
|
|||
'local_action', 'transport', 'sudo', 'remote_user', 'sudo_user', 'sudo_pass',
|
||||
'items_lookup_plugin', 'items_lookup_terms', 'environment', 'args',
|
||||
'any_errors_fatal', 'changed_when', 'failed_when', 'always_run', 'delay', 'retries', 'until',
|
||||
'su', 'su_user', 'su_pass', 'no_log',
|
||||
'su', 'su_user', 'su_pass', 'no_log', 'run_once',
|
||||
]
|
||||
|
||||
# to prevent typos and such
|
||||
|
@ -41,7 +41,7 @@ class Task(object):
|
|||
'delegate_to', 'local_action', 'transport', 'remote_user', 'sudo', 'sudo_user',
|
||||
'sudo_pass', 'when', 'connection', 'environment', 'args',
|
||||
'any_errors_fatal', 'changed_when', 'failed_when', 'always_run', 'delay', 'retries', 'until',
|
||||
'su', 'su_user', 'su_pass', 'no_log',
|
||||
'su', 'su_user', 'su_pass', 'no_log', 'run_once',
|
||||
]
|
||||
|
||||
def __init__(self, play, ds, module_vars=None, default_vars=None, additional_conditions=None, role_name=None):
|
||||
|
@ -122,6 +122,7 @@ class Task(object):
|
|||
self.environment = ds.get('environment', {})
|
||||
self.role_name = role_name
|
||||
self.no_log = utils.boolean(ds.get('no_log', "false"))
|
||||
self.run_once = utils.boolean(ds.get('run_once', 'false'))
|
||||
|
||||
#Code to allow do until feature in a Task
|
||||
if 'until' in ds:
|
||||
|
|
|
@ -144,6 +144,7 @@ class Runner(object):
|
|||
vault_pass=None,
|
||||
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
|
||||
run_once=False, # option to enable/disable host bypass loop for a given task
|
||||
):
|
||||
|
||||
# used to lock multiprocess inputs and outputs at various levels
|
||||
|
@ -197,6 +198,7 @@ class Runner(object):
|
|||
self.su_pass = su_pass
|
||||
self.vault_pass = vault_pass
|
||||
self.no_log = no_log
|
||||
self.run_once = run_once
|
||||
|
||||
if self.transport == 'smart':
|
||||
# if the transport is 'smart' see if SSH can support ControlPersist if not use paramiko
|
||||
|
@ -1200,7 +1202,7 @@ class Runner(object):
|
|||
if self.forks == 0 or self.forks > len(hosts):
|
||||
self.forks = len(hosts)
|
||||
|
||||
if p and getattr(p, 'BYPASS_HOST_LOOP', None):
|
||||
if (p and (getattr(p, 'BYPASS_HOST_LOOP', None)) or self.run_once):
|
||||
|
||||
# Expose the current hostgroup to the bypassing plugins
|
||||
self.host_set = hosts
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue