If my server has a subrole, how do i set the effective role so that the
correct class gets compiled? Please read through my setup before
answering, maybe what i want to do is incorrect for this setup.
The way I setup roles and profiles is like this:
Nodes are given a role and a subrole by custom facts.
role: mail
subrole: relay
I use hiera_include('classes') in my site.pp.
And each role has a file in hieradata. The hiera.yaml looks like this.
:hierarchy:
- "nodes/%{::trusted.certname}"
- "roles/%{::role}"
- common
The profiles for the role are defined in hieradata/roles/mail.yaml which
looks like this:
---
classes:
- profile::mail
The mail *profile* will have the different *subroles* classes in it. In
this example subroles internal or relay are possible
class profile::mail::internal {
class { 'postfix':
relayhost => '192.168.0.1',
}
}
class profile::mail::relay {
include amavisd
include something_else
class { 'postfix':
relayhost => 'external.mail.com',
mynetworks => '192.168.0.0/16',
}
}
I'm stumped at this point, where the subroles are defined. How do i set
the effective role to be mail::relay?
I have two ideas:
Put if statements around each subrole in the profile manifest.
or
Since you can't do logic in yaml, do the ENC stuff another way.
humm, is there a way to do this in hieradata/roles/mail.yaml?
This is a typical setup, I think. I just haven't found a working example
to this.
--
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/9d681a1d-ec7a-413f-9063-537504919ea4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.