1 | class openldap::server::slave { |
---|
2 | |
---|
3 | debug ("configuring openldap::server::slave with dn '$ldap_base'") |
---|
4 | |
---|
5 | package {"slapd": |
---|
6 | ensure => installed, |
---|
7 | responsefile => "/var/cache/debconf/slapd.preseed", |
---|
8 | require => File["/var/cache/debconf/slapd.preseed"], |
---|
9 | } |
---|
10 | # if defined(Package["ldap-utils"]) { } else { |
---|
11 | # package {"ldap-utils": ensure => present, } |
---|
12 | # } |
---|
13 | |
---|
14 | service {"slapd": |
---|
15 | ensure => running, |
---|
16 | require => Package[slapd], |
---|
17 | } |
---|
18 | |
---|
19 | # if ($ldap_ssl_only) { |
---|
20 | # $line = 'SLAPD_SERVICES="ldaps:///"' |
---|
21 | # } else { |
---|
22 | $line = 'SLAPD_SERVICES="ldap:/// ldaps:/// ldapi:///"' |
---|
23 | # } |
---|
24 | line {"listen_locally": |
---|
25 | # line => 'SLAPD_SERVICES="ldap:/// ldaps:/// ldapi:///"', |
---|
26 | line => $line, |
---|
27 | file => "/etc/default/slapd", |
---|
28 | ensure => present, |
---|
29 | require => Package[slapd], |
---|
30 | notify => Service[slapd], |
---|
31 | } |
---|
32 | |
---|
33 | file { |
---|
34 | "/etc/ldap/slapd.conf": |
---|
35 | content => template("openldap/slapd.conf_slave.erb"), |
---|
36 | mode => 0600, |
---|
37 | owner => root, |
---|
38 | group => root; |
---|
39 | "/var/cache/debconf/slapd.preseed": |
---|
40 | content => template("openldap/slapd.preseed.erb"), |
---|
41 | mode => 0600, |
---|
42 | owner => root, |
---|
43 | group => root; |
---|
44 | "/var/backups/ldap": |
---|
45 | ensure => directory, |
---|
46 | owner => root, |
---|
47 | group => root, |
---|
48 | mode => 750; |
---|
49 | } |
---|
50 | |
---|
51 | exec{"slap_conf_update": |
---|
52 | command => "/etc/init.d/slapd stop && /bin/rm -r /etc/ldap/slapd.d/ && /bin/mkdir /etc/ldap/slapd.d && /usr/sbin/slaptest -f /etc/ldap/slapd.conf -F /etc/ldap/slapd.d/ && /bin/chown -R openldap:openldap /etc/ldap/slapd.d/ && /bin/chmod -R o-rwx /etc/ldap/slapd.d/ && /etc/init.d/slapd start", |
---|
53 | refreshonly => true, |
---|
54 | subscribe => File["/etc/ldap/slapd.conf"], |
---|
55 | require => [Package[slapd], File["/etc/ldap/slapd.conf"]], |
---|
56 | } |
---|
57 | |
---|
58 | |
---|
59 | file { |
---|
60 | "/etc/ldap/schema": |
---|
61 | ensure => directory, |
---|
62 | mode => 644, |
---|
63 | owner => root, |
---|
64 | group => root, |
---|
65 | source => "puppet:///openldap/etc/ldap/schema/", |
---|
66 | recurse => "true", |
---|
67 | require => Package[slapd]; |
---|
68 | } |
---|
69 | |
---|
70 | cron {"ldap-backup": |
---|
71 | command => "/usr/local/sbin/ldap-backup.sh", |
---|
72 | user => "root", |
---|
73 | hour => 2, |
---|
74 | minute => 0, |
---|
75 | require => File["/var/backups/ldap"], |
---|
76 | } |
---|
77 | } |
---|