I’ve got a case where I’d like to delegate contents of entire role over to another box. Adding “delegate_to” to every task seems strenuous and not reusable since I may use this role without delegation.
My attempt at simulating what is done with { role: X, tags: A } did not succeed:
actually that is the intent. My example was “simplified” so it’s easy to understand mechanics of it, but obviously it’s hard to explain reasoning for doing it so. In other words instead of “hostname” there’s a command that does some “central registration” of each host, and it has to run from a central place. However in certain cases I can bypass that.
if I’m reading your comment correctly you propose to do:
however that disrupts the flow of the playbook and make my loops bit more complicated (for example where originally I’d have “with_items” loop iterating over items to be applied to the host I now have to implement more complicated constructs like “with_nested” etc.).
Also moving it out like that makes role not self-sufficient - i.e. if I want to recycle my role, I have to use the role that iterates over servers in a specified group or all.