Added back variables which control which parts of the roles are run #2371
+36
−17
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.
These were the ones I ran into issues with, but I guess there are others I should add if this approach is acceptable.
We have discussed this a little on matrix, but it's easy for things to get lost in the busy room, so I will lay out what I am trying to achieve here to motivate this and then maybe we can figure out the best way forward.
My setup is that I don't use the
playbooks/matrix.yml
playbook, I include the roles into my own custom playbook. The playbook I run does all the setup and any restarting needed, meaning I never need to (or need to for any other ansible roles I use) set any tags to get my infrastructure in the state described by the inventory.I basically run
ansible-playbook site.yml -l matrix
and multiple playbooks are invoked, in order, which setup my matrix host and associated services (such as database roles on another host) to the state I expect them to be in.The issue I see with having roles like the ones in this playbook, which require you to set tags for them to work, is that there is no way to set tags inside a playbook when invoking a role (at least using
role:
andinclude_role
seems to have other issues relating to inventory [1]). So, unless I am missing something, there would be no way for me to avoid requiring setting tags on my invocation ofansible-playbook
.In my experience with using ansible for my homelab, it feels alien to be to have to use tags to make a role work (i.e. running all the tasks without tag filtering is illogical) and also alien to be to have to use tags to filter out related-but-optional functionality of a role (e.g. rust-state-compress). When I put a
role:
directive in my playbook I expect it to setup a thing based on the state of the inventory.I am really grateful for this project, and all it makes super easy, and I appreciate that the way I use these roles isn't the expected way, but with the change of removing these
run_
variables, it's now become very difficult to impossible to include these roles in another playbook without also accepting that you need to use the CLI tags interface documented for the mainsetup.yml
playbook in this repo, which is what I am trying to avoid having to do.[1] It appears that using
include_role
doesn't mix the variables of all the roles together in the same way asrole:
so you end up with a load of missing variables making it effectively useless.