Puppet Class: openldap::server::service
- Defined in:
- manifests/server/service.pp
Overview
Class: openldap::server::service
This class manages the OpenLDAP service.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'manifests/server/service.pp', line 6
class openldap::server::service (
$slapd_svc = 'slapd'
){
assert_private()
include '::openldap::server::fix_bad_upgrade'
# This is a very crude attempt to not bootstrap if the executing
# node is a slave node. Bootstrapping slave nodes causes the
# 'administrators' group to become unable to sync if it doesn't
# start identical to the master.
exec { 'bootstrap_ldap':
command => "/sbin/service ${slapd_svc} stop; \
/bin/find /var/lib/ldap -type f -name \"__db*\" -exec /bin/rm {} \\;; \
/bin/find /var/lib/ldap/db -type f -name \"*bdb\" -exec /bin/rm {} \\;; \
/usr/sbin/slapadd -l /etc/openldap/default.ldif -f /etc/openldap/slapd.conf; \
/bin/chown -h -R ldap.ldap /var/lib/ldap/*; \
/bin/touch /etc/openldap/puppet_bootstrapped.lock; \
/bin/chown root:ldap /etc/openldap/puppet_bootstrapped.lock; \
/bin/echo 'Bootstrapped LDAP';",
onlyif => '/usr/local/sbin/ldap_bootstrap_check.sh',
logoutput => true,
require => [
File['/etc/openldap/schema'],
File['/usr/local/sbin/ldap_bootstrap_check.sh'],
],
creates => '/etc/openldap/puppet_bootstrapped.lock',
notify => Service[$slapd_svc],
before => Exec['fixperms']
}
# Ensure all of /var/lib/ldap is owned by ldap.
exec { 'fixperms':
command => '/bin/chown -h -R ldap.ldap /var/lib/ldap/*;',
onlyif => '/usr/bin/test `/bin/find /var/lib/ldap -printf "%u\n" | \
/bin/grep -v ldap | \
/usr/bin/wc -l` -ne 0',
notify => Service[$slapd_svc]
}
service { $slapd_svc:
ensure => 'running',
enable => true,
hasrestart => true,
hasstatus => true,
require => [
Package["openldap-servers.${::hardwaremodel}"],
Class['openldap::server::fix_bad_upgrade']
]
}
}
|