mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
make adhoc include_role/task work again! (#49247)
* adhoc include_role/task work again! - fix task, pass if set
This commit is contained in:
parent
e0ad0eb42c
commit
0c1f62065c
2 changed files with 11 additions and 3 deletions
2
changelogs/fragments/fix_adhoc_includes.yml
Normal file
2
changelogs/fragments/fix_adhoc_includes.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- adhoc always added async_val and poll to tasks, but now includes are enforcing non valid parameters, this bypasses the error.
|
|
@ -76,13 +76,19 @@ class AdHocCLI(CLI):
|
|||
|
||||
def _play_ds(self, pattern, async_val, poll):
|
||||
check_raw = self.options.module_name in ('command', 'win_command', 'shell', 'win_shell', 'script', 'raw')
|
||||
|
||||
mytask = {'action': {'module': self.options.module_name, 'args': parse_kv(self.options.module_args, check_raw=check_raw)}}
|
||||
|
||||
# avoid adding to tasks that don't support it, unless set, then give user an error
|
||||
if self.options.module_name not in ('include_role', 'include_tasks') or any(async_val, poll):
|
||||
mytask['async_val'] = async_val
|
||||
mytask['poll'] = poll
|
||||
|
||||
return dict(
|
||||
name="Ansible Ad-Hoc",
|
||||
hosts=pattern,
|
||||
gather_facts='no',
|
||||
tasks=[dict(action=dict(module=self.options.module_name, args=parse_kv(self.options.module_args, check_raw=check_raw)), async_val=async_val,
|
||||
poll=poll)]
|
||||
)
|
||||
tasks=[mytask])
|
||||
|
||||
def run(self):
|
||||
''' create and execute the single task playbook '''
|
||||
|
|
Loading…
Reference in a new issue