Classes and define in HIERA

Hi,

Problem:
I have classes (defines) not import in Foreman but how use in hiera?

Examples
apache::vhosts ?

Howto use https://forge.puppet.com/camptocamp/openldap with hiera ?

openldap::server::database { ‘dc=example,dc=com’:
directory => ‘/var/lib/ldap’,
rootdn => ‘cn=admin,dc=example,dc=com’,
rootpw => ‘secret’,
}

Both the puppet ENC and hiera don’t allow instantiating defines via the ENC. Usually you introduce profile classes that wrap functionality:

class profiles::webserver(
  Hash[String, Hash] $vhosts = {},
) {
  include apache

  $vhosts.each |$vhost_name, $vhost_options| {
    apache::vhost { $vhost_name:
      * => $vhost_options,
    }
  }
}

You usually want some changed defaults, perhaps add in some monitoring, set up letsencrypt.

OK, thanks

There is also https://forge.puppet.com/stbenjam/hash_resources, although @ekohl’s suggestion is better if you can manage writing the profile classes.