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:


#  - regex
  - yaml
  :datadir: /etc/puppet/hiera
#  :datadir: /var/lib/hiera
  - "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/, 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 

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.



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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
For more options, visit https://groups.google.com/d/optout.

Reply via email to