-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
Allow using action/local_action on includes and imports #37260
Conversation
i think we should go in opposite direction and make sure that the 'action' gets set correctly and compare to that. There are things that should never workd i.e |
I did specifically mention that I didn't think that was worthwhile. We could, but it would involve a much larger refactor. Right now we have a lot of code that just does We have at least 3 variants we would have to support:
I think we would end up either having to create a new parser, that is separate from |
modargsparser does this already, we might just want to refactor it to allow for 'external use' |
@bcoca I've updated the code to use |
…n/local_action with import/include
* Prevent using action/local_action on includes and imports. Fixes ansible#28822 * Use ModuleArgsParser to determine action instead of disallowing action/local_action with import/include * Add to_native * switch back to block in task_ds, use ModuleArgsParse otherwise * var should be task_ds * Add test validating action+include_tasks
* Prevent using action/local_action on includes and imports. Fixes ansible#28822 * Use ModuleArgsParser to determine action instead of disallowing action/local_action with import/include * Add to_native * switch back to block in task_ds, use ModuleArgsParse otherwise * var should be task_ds * Add test validating action+include_tasks
* Prevent using action/local_action on includes and imports. Fixes ansible#28822 * Use ModuleArgsParser to determine action instead of disallowing action/local_action with import/include * Add to_native * switch back to block in task_ds, use ModuleArgsParse otherwise * var should be task_ds * Add test validating action+include_tasks
* Prevent using action/local_action on includes and imports. Fixes ansible#28822 * Use ModuleArgsParser to determine action instead of disallowing action/local_action with import/include * Add to_native * switch back to block in task_ds, use ModuleArgsParse otherwise * var should be task_ds * Add test validating action+include_tasks
* Prevent using action/local_action on includes and imports. Fixes ansible#28822 * Use ModuleArgsParser to determine action instead of disallowing action/local_action with import/include * Add to_native * switch back to block in task_ds, use ModuleArgsParse otherwise * var should be task_ds * Add test validating action+include_tasks
* Prevent using action/local_action on includes and imports. Fixes ansible#28822 * Use ModuleArgsParser to determine action instead of disallowing action/local_action with import/include * Add to_native * switch back to block in task_ds, use ModuleArgsParse otherwise * var should be task_ds * Add test validating action+include_tasks
* Prevent using action/local_action on includes and imports. Fixes ansible#28822 * Use ModuleArgsParser to determine action instead of disallowing action/local_action with import/include * Add to_native * switch back to block in task_ds, use ModuleArgsParse otherwise * var should be task_ds * Add test validating action+include_tasks
SUMMARY
Allow using action/local_action on includes and imports. Fixes #28822
Using action or local_action on includes and imports doesn't work. This is due to
playbooks/helpers.py
doing things likeif 'include_role' in task_ds:
which fails because thetask_ds
may look like:or
This PR uses mod_args to determine the action in a more robust way.
ISSUE TYPE
COMPONENT NAME
lib/ansible/playbooks/helpers.py
ANSIBLE VERSION
ADDITIONAL INFORMATION