Hi,
I am using camptocamp/postfix for my postfix configuration. I originally
defined all my configs manifests but now I would like to change to using
hiera. Unfortunately, this module doesn't support hiera for some of the
configs, so I must define many parameters in the manifests. I wanted to
use hiera for simplicity, but also because I have a very nice use case: I
have one SMTP front-end with its own specific configs (anti-spam/virus),
and a series of regular hosts. Traditionally, all hosts that are in the
same subnet as the Exchange server would use it as relayhost and all the
other hosts use the smtp front-ends. Therefore, here's what I did:
hiera.yaml:
---
:backends:
# - regex
- yaml
:yaml:
:datadir: /etc/puppet/hiera
#:regex:
# :datadir: /var/lib/hiera
:hierarchy:
- "host/%{fqdn}"
- "domain/%{domain}"
- "env/%{::environment}"
- "os/%{operatingsystem}"
- "osfamily/%{osfamily}"
- "networks/%{network_ens192}"
- "virtual/%{::virtual}"
- common
This way, I define the exchange server as relayhost for the exchange
network in /etc/puppet/hiera/networks/192.168.155.0.yaml, and set the smtp
frontend as relayhost in /etc/puppet/hiera/common.yaml.
However, since I can't put all the settings in hiera, I must put some in
the class declaration for the smtp frontends. When I declare the postfix
class in both my default profile and in the smtp frontend profile, I get an
error saying that the class cannot be declared twice (Class[Postfix] is
already declared; cannot redeclare at
/etc/puppet/manifests/nodes/smtp_postfix_servers.pp:19)
Another solution would be to declare the profile in all my roles, but it's
far from perfect.
Is there a simple solution?
I guess that I could do an if based on ipaddress in my default profile, but
I wanted to use hiera as much as possible. Yes I created an issue to ask
for full hiera support.
Thanks,
Ugo
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/932fe21c-1980-478e-976d-31fe7835eeec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.