hiera-ldap backend
This module allows hiera to look up entries in LDAP. It will return an array of every matching entry, with that entry represented as a hash of attribute => value. For multivalued attributes, they exist as multiattribute => [attrib1, attrib2, attrib3].
Installation
This module can be installed via rubygems:
$ gem install hiera-ldapprovider
Use
Ldap example:
objectClass: dNSDomain
objectClass: domain
objectClass: ipHost
objectClass: puppetClient
objectClass: top
cn: client1
dc: example.com
ipHostNumber: 10.0.0.1
aRecord: client1.example.com
environment: production
puppetclass: rbackup
puppetclass: ntp
puppetclass: apache2
puppetclass: snmpd
puppetvar: service_ensure=running
Configuration example
:ldap:
:base: ou=machines,dc=example,dc=com
:host: ldap.example.com
:port: 389 # Default: 389
:attribute: cn # Default: cn
:encryption: :simple_tls
:auth:
:method: :simple
:username: uid=network,ou=Netgroup,dc=example,dc=com
:password: PASSWORD
Puppet example
In this example a hierarchy will be used. See PuppetDoc on how to define a hierarchy:
:hierarchy:
- "%{::clientcert}"
- "common"
Get a String from LDAP
notify {'message':
message => hiera("ipHostNumber")
}
# => Notice: /Stage[main]/Main/Node[client1]/Notify[message]/message: defined 'message' as '10.0.0.1'
Get an Array of Elements from LDAP
notify {'message':
message => hiera_array("puppetclass")
}
Get a Hash from LDAP
notify {'message':
message => hiera_hash("puppetclass")
}
Details
- It wraps the pramaters to Net::LDAP.new so anything you can do there you can do here
Authors
- Hunter Haugen http://github.com/hunner
- Spencer Krum http://github.com/nibalizer
- Sage Imel http://github.com/nightfly
- Fabio Rauber http://github.com/fabiorauber