You can’t do that in sync rules (afaik), because the sync rule does not know about the hosts variables.
You can only use information from import sources.
So to assign the host group to different hosts the assign rule for the hostgroup that uses the host.vars.roles is the way to go.
i do not agree here. The vars do not have to be evaluated at this moment. Its a simple assign rule statement that has just to be written into the object config as it is.
Nice, absolutely did not know about that. No wonder if it is not mentioned anywhere in the docs.
@theFeu pinging you, as there is essential information missing from the docs for a function the Director provides for at least three years. Could that be merged into the official docs?
Well, I have to say that I personally am not that familiar with the director and didn’t know about that myself.
I will have to look into that (both the official documentation and what is described here) and figure out which colleague might be most suited to tackle that.
Some cooperation will be needed here and, as it is holiday season and the first person that came to mind is unavailable right now, this might take a little while.
Thank you all for your hints. However I wonder why this assign rules in director sync are different (and less understandable) syntax as configured via files.