|
class dirsrv(
|
|
$ensure = 'present',
|
|
$adminuser = 'admin',
|
|
$adminpass = '',
|
|
$adminport = '9830',
|
|
$ldapdomain = '',
|
|
$ldapsuffix = '',
|
|
$ldapport = '389',
|
|
$initldif = '',
|
|
$initschema = '',
|
|
) {
|
|
|
|
package { '389-ds':
|
|
ensure => installed,
|
|
}
|
|
|
|
file { '/etc/dirsrv':
|
|
ensure => directory,
|
|
owner => 'root',
|
|
group => 'nobody',
|
|
mode => '0775',
|
|
require => Package['389-ds'],
|
|
}
|
|
|
|
|
|
file { "/etc/dirsrv/setup-${name}.inf":
|
|
content => template('dirsrv/setup.inf.erb'),
|
|
owner => 'root',
|
|
group => 'root',
|
|
mode => '0600',
|
|
require => File['/etc/dirsrv'],
|
|
}
|
|
|
|
if $initschema != '' {
|
|
file { "/etc/dirsrv/schema-${name}.ldif":
|
|
source => $initschema,
|
|
owner => 'root',
|
|
group => 'root',
|
|
mode => '0664',
|
|
before => File["/etc/dirsrv/setup-${name}.inf"],
|
|
require => File['/etc/dirsrv'],
|
|
}
|
|
}
|
|
|
|
if $initldif != '' {
|
|
file { "/etc/dirsrv/initldap-${name}.ldif":
|
|
source => $initldif,
|
|
owner => 'root',
|
|
group => 'root',
|
|
mode => '0664',
|
|
before => File["/etc/dirsrv/setup-${name}.inf"],
|
|
require => File['/etc/dirsrv'],
|
|
}
|
|
}
|
|
|
|
if $ensure == 'present' {
|
|
exec { 'create_dirsrv':
|
|
command => "/usr/sbin/setup-ds-admin.pl -s -f /etc/dirsrv/setup-${name}.inf",
|
|
path => ['/sbin', '/bin', '/usr/sbin', '/usr/bin'],
|
|
require => File["/etc/dirsrv/setup-${name}.inf", '/etc/dirsrv'],
|
|
creates => "/etc/dirsrv/slapd-${name}"
|
|
}
|
|
}
|
|
|
|
if $ensure == 'absent' {
|
|
exec { 'delete_dirsrv':
|
|
command => '/usr/sbin/remove-ds-admin.pl -f -d -y',
|
|
path => ['/sbin', '/bin', '/usr/bin', '/usr/sbin'],
|
|
require => Package['389-ds'],
|
|
refreshonly => true,
|
|
}
|
|
}
|
|
}
|