Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make ansible adhoc work with include_role #56163

Merged
merged 2 commits into from May 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/ansible-adhoc.yaml
@@ -0,0 +1,2 @@
bugfixes:
- allow include_role to work with ansible command
2 changes: 1 addition & 1 deletion lib/ansible/cli/adhoc.py
Expand Up @@ -69,7 +69,7 @@ def _play_ds(self, pattern, async_val, poll):
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

Expand Down
4 changes: 4 additions & 0 deletions test/integration/targets/include_import/runme.sh
Expand Up @@ -10,6 +10,10 @@ function gen_task_files() {
done
}

## Adhoc

ansible -m include_role -a name=role1 localhost

## Import (static)

# Playbook
Expand Down