[446] | 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": |
---|
[449] | 35 | content => template("openldap/slapd.conf_slave.erb"), |
---|
[446] | 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 | "/usr/local/sbin/ldap-backup.sh": |
---|
| 45 | ensure => present, |
---|
| 46 | owner => root, |
---|
| 47 | group => root, |
---|
| 48 | mode => 755, |
---|
| 49 | source => "puppet:///openldap/usr/local/sbin/ldap-backup.sh"; |
---|
| 50 | "/var/backups/ldap": |
---|
| 51 | ensure => directory, |
---|
| 52 | owner => root, |
---|
| 53 | group => root, |
---|
| 54 | mode => 750; |
---|
| 55 | } |
---|
[501] | 56 | |
---|
| 57 | exec{"slap_conf_update": |
---|
[503] | 58 | 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", |
---|
[501] | 59 | refreshonly => true, |
---|
| 60 | subscribe => File["/etc/ldap/slapd.conf"], |
---|
[502] | 61 | require => [Package[slapd], File["/etc/ldap/slapd.conf"]], |
---|
[501] | 62 | } |
---|
| 63 | |
---|
[446] | 64 | |
---|
| 65 | file { |
---|
| 66 | "/etc/ldap/schema": |
---|
| 67 | ensure => directory, |
---|
[506] | 68 | mode => 644, |
---|
[446] | 69 | owner => root, |
---|
| 70 | group => root, |
---|
[506] | 71 | source => "puppet:///openldap/etc/ldap/schema/", |
---|
| 72 | recurse => "true", |
---|
[446] | 73 | require => Package[slapd]; |
---|
| 74 | } |
---|
| 75 | |
---|
| 76 | cron {"ldap-backup": |
---|
| 77 | command => "/usr/local/sbin/ldap-backup.sh", |
---|
| 78 | user => "root", |
---|
| 79 | hour => 2, |
---|
| 80 | minute => 0, |
---|
| 81 | require => File["/var/backups/ldap"], |
---|
| 82 | } |
---|
| 83 | } |
---|