Hi,
TL;DR: I'd like to factor out the commonalities of my role definitions
into re-useable templates and I was wondering what the best way to do
this is.
My current setup follows the canonical role setup with a common role
and a bunch of more specific roles. For example, I have a role to
setup Cassandra, another role to setup Postgres, some other role to
install a daemon, and so on. Each role is a cohesive unit of
functionality and because of this, I can re-arrange the distribution
of roles across different deployments.
That said, each role has bunch of common stuff in it that repeats
itself. For example, making sure mount points exist, certain users
exist, apply config templates, certain tarballs are sourced and
unpacked, etc. There's a lot of non-role specific boilerplate.
I'd like to parameterize my role definitions. I've looked at includes
and parameterized roles. Parameterized roles feels closest to my
needs, but the problem I see is that they are only parameterized to
extent of simple parameters - when jinja templates, vars, and handlers
come into play, it feels like I need some kind of role inheritance(*).
Includes feel more straight forward, but I guess a role would need to
include a global task definition, i.e. it would include something from
outside the scope of its role.
So I'm left wondering whether I've missed a trick somewhere, or maybe
I've just missed some documentation somewhere.
Cheers,
Ben
(*) Sounds complicated.