[WIP] Excluded certain include_role
and include_tasks
attributes from post_validate
#75719
+27
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SUMMARY
Fixes #75240.
This PR makes some of
IncludeRole
andIncludeTasks
attributes to be exempt frompost_validate
based on value ofalways_post_validate
property and aims to remove unnecessary template validation atinclude_role
orinclude_tasks
task level (not their content). E.g.: when usinginclude_role
with a role which has only one task, and ifremote_user
is templated, then it should not be validated atinclude_role
level, but validated on the tasks inside the included role.I'm not fully sure this is a complete fix though, hence the WIP/Draft status, as I'm looking for feedback.
ISSUE TYPE
COMPONENT NAME
lib/ansible/playbook/base.py
lib/ansible/playbook/play_context.py
ADDITIONAL INFORMATION
Example playbook/role: https://github.com/egmar/include_role_example/blob/main/validate.yml
Before fix:
After fix: