mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Make ansible adhoc work with include_role (#56163)
* Make ansible adhoc work with include_role Fix logic condition so that include_role works without ``` ERROR! 'async_val' is not a valid attribute for a IncludeRole The error appears to be in 'None': line 0, column 0, but may be elsewhere in the file depending on the exact syntax problem. (could not open file to display line) ``` * Add include_role test for adhoc
This commit is contained in:
parent
2a39dc84b7
commit
cd95843ea5
3 changed files with 7 additions and 1 deletions
2
changelogs/fragments/ansible-adhoc.yaml
Normal file
2
changelogs/fragments/ansible-adhoc.yaml
Normal file
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- allow include_role to work with ansible command
|
|
@ -69,7 +69,7 @@ class AdHocCLI(CLI):
|
|||
mytask = {'action': {'module': context.CLIARGS['module_name'], 'args': parse_kv(context.CLIARGS['module_args'], check_raw=check_raw)}}
|
||||
|
||||
# avoid adding to tasks that don't support it, unless set, then give user an error
|
||||
if context.CLIARGS['module_name'] not in ('include_role', 'include_tasks') or any(frozenset((async_val, poll))):
|
||||
if context.CLIARGS['module_name'] not in ('include_role', 'include_tasks') and any(frozenset((async_val, poll))):
|
||||
mytask['async_val'] = async_val
|
||||
mytask['poll'] = poll
|
||||
|
||||
|
|
|
@ -10,6 +10,10 @@ function gen_task_files() {
|
|||
done
|
||||
}
|
||||
|
||||
## Adhoc
|
||||
|
||||
ansible -m include_role -a name=role1 localhost
|
||||
|
||||
## Import (static)
|
||||
|
||||
# Playbook
|
||||
|
|
Loading…
Reference in a new issue