WIP: Replace the include
module with include_tasks
or import_tasks
#147
No reviewers
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
security
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: evolix/ansible-roles#147
Loading…
Reference in a new issue
No description provided.
Delete branch "replace_include"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The behaviour of the
include
module is badly defined (it try to choosebetween statically importing the tasks and dynamically including them)
and can cause problems depending on any number of constraints (mostly if
it choose the wrong behaviour).
Replace it with the
import_tasks
(always statically import tasks) unlessthe
include
is in a loop in which case we replace it withinclude_tasks
(always dynamically include tasks).We also replace
include_role
withimport_role
where relevant (so if theinclude_role
itself isn't looped) as it is more efficient and make the tasks actually appear inansible-playbook --list-tasks
, it result in different behaviour where tags are concerned (they are applied on the imported tasks instead of only on theinclude_role
) but I believe it is what we actually want most of the time (with remount-usr).542292e0f3
to73b7eff126
73b7eff126
to0a968e831d
0a968e831d
to356f4e3c2b
After a few tests, that cause problems with handlers with the same name in different roles, so I reverted that change (should have made a different commit).
356f4e3c2b
tof49ffb1c2d
For info, I used this patch in a playbook and didn't encountered errors.
f49ffb1c2d
to956ecd4700
956ecd4700
to74d4d7c19c
74d4d7c19c
to58cc3d6dcd
58cc3d6dcd
to74a11d0982
74a11d0982
to7c632352a0
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.