As it currently stands, role dependencies are executed prior to the
role in which they are defined. This is a good feature.
But!
I'm running into the situation where I have a 'common' role that gets
run after some OS-specific roles -- mainly the OS-specific roles are
doing the package installation and OS specific configurations and the
common role is doing everything that is similar between the
distributions.
It would be great if I could tell the os-specific role to depend on
the common role, but make the common role execute _after_ the
os-specific role. Does this idea make sense? Would it be a useful
feature for others? Or should it be solved in a different way with
re-organizing my roles?
My current implementation just runs the roles in a specific order --
without any dependencies. It works, just wanted to see if there was a
way to clean things up.
That’d be a very useful feature! Currently, it’s possible to declare what roles roleA depends on. But sometimes, when writing isolated modules that constitute to a whole, one would like to express that roleA should depend on roleB and roleC when declaring those. Something named like required_by, required_in, required_before (note that we would like both roleB and roleC to be played before roleA). I think that name required_after would rather refer to a list of roles that should run before the role the name has been declared in, effectively being a synonym for dependencies.
Hello! I know this thread is old but I am interested and I just got an idea on which I would like your opinion.
In my case, I have a “nginx/proxy” role that creates subdomains proxies to services on my server. I also have a “compose” role that manages those services.
The “nginx/proxy” gets the list of proxy configs from a variable that is updated by “compose”, which in the present case requires me to explicitly make “compose” run before “nginx/proxy”.
What if I want to use dependencies? I thought that I could separate “compose” in two parts: “compose/services” would manage the services and “compose/proxy” would only update the proxy list. Then I could write that “nginx/proxy” depends on “compose/proxy”.
I do not know if it is clear, if it is really relevant, and if such a workaround actually makes sense and would be usable.