The problem is best described with an example:
There are two roles:
mailserver
: a basic mail server configurationmailinglist
: mailing list application
The mailing list software needs the mailserver to transport incoming mails to the mailing list software's "virtual inbox". This requires some configuration of the mail server. But the mailserver does not know about the mailing list role, nor other roles with similar configuration requirements.
What I would like to do is this:
mailinglist
(and other similar roles) stores the transport configuration in a variabletransport_config
. This could be a "transport map" like $email => $spool.mailinglist
depends on themailserver
role.mailserver
configures it's "transport" using the variabletransport_config
.
Is there a way to do something like this in Ansible? Or another solution to this problem? It's not possible to use role variables like {role: mailserver, transport_config: ...}
, as there may be more than one role depending on the mailserver.
What I can think of is a workaround: The mailserver reads/parses a configuration directory where transport maps are defined. mailinglist
and other roles add files to this directory. The problem here is that this often requires a "configuration builder" which reads such configuration directories and generates the main configuration file.