Puppet & Satellite , the ENC explained.

Satellite has the capability to make facts available to puppet-clients through its ENC.

This process however is not documented well on Satellite’s , nor on Puppets documentation.

Take for example a class on the puppet-forge that requires some input for optional couplings:

maestrodev/archiva

This class has some optional parameters:

#
# $ldap = {
#   hostname      => 'ldap.example.com',
#   ssl           => true,
#   port          => '636',
#   dn            => 'o=example',
#   bind_dn       => "cn=admin,ou=system,o=example",
#   bind_password => "admin123",
#   admin_user    => "sysadmin",
#   guest_user    => "guest"
# }

Many blocks on the puppet forge have code like this, its a hash with values that should be enabled.

The puppet-initiates who have not yet fully grasped satellite, might implement it as following.

Create a new class, for instance:

  class oliekoets_archiva { 'archiva::ldap' :
    hostname => 'ldap.oliekoets.nl',
    ssl      => true,
    dn       => 'cn=users,cn=accounts,dc=oliekoets,dc=nl'
....

This however, is completely unnessecary in Satellite with the ENC.

Within satellite,  override the archiva::ldap variable and change its type from ‘string’ to ‘hash’

Now the hash-type accepts any valid json or yaml input, as long as it validates to a legal puppet object.

Here we go:

ldap: 
  hostname: 
    - ldap.oliekoets.nl
    - ldap2.oliekoets.nl
ssl: true
port: 636
dn: cn=users,cn=accounts,dc=oliekoets,dc=nl
....

Doublecheck by asking satellite to display its YAML enc:

---
classes:
  archiva:
    ldap:
      hostname:
        - ldap.oliekoets.nl
        - ldap2.oliekoets.nl
    ssl: true port: 636
    dn: cn=users,cn=accounts,dc=oliekoets,dc=nl
....

And thats all there is to it.

Mark.

 


Comments are closed.