1
0
Fork 0
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:
Brian Coca 2018-12-10 11:40:44 -05:00 committed by GitHub
parent e0ad0eb42c
commit 0c1f62065c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View 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.

View file

@ -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 '''