[651] | 1 | class openldap::server::slave::dev { |
---|
| 2 | |
---|
| 3 | # TODO |
---|
| 4 | # ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/cosine.ldif |
---|
| 5 | # ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/inetorgperson.ldif |
---|
| 6 | # ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/rfc2307bis.ldif |
---|
| 7 | # ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/evolutionperson.ldif |
---|
| 8 | # ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/mozillaabpersonalpha.ldif |
---|
| 9 | # ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/consumer-init.ldif |
---|
| 10 | # ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/consumer-sync.ldif |
---|
| 11 | |
---|
| 12 | package { [ |
---|
| 13 | "slapd", |
---|
| 14 | "ldap-utils" |
---|
| 15 | ]: ensure => installed |
---|
| 16 | } |
---|
| 17 | |
---|
| 18 | service { "slapd": |
---|
| 19 | enable => true, |
---|
| 20 | ensure => running, |
---|
| 21 | subscribe => [ Package["slapd"] ], |
---|
| 22 | } |
---|
| 23 | |
---|
| 24 | file { |
---|
| 25 | "/etc/ldap/schema": |
---|
| 26 | ensure => directory, |
---|
| 27 | mode => 644, |
---|
| 28 | owner => root, |
---|
| 29 | group => root, |
---|
| 30 | source => "puppet:///openldap/etc/ldap/schema/", |
---|
| 31 | recurse => "true", |
---|
| 32 | require => Package[slapd]; |
---|
| 33 | "/var/backups/ldap": |
---|
| 34 | ensure => directory, |
---|
| 35 | owner => root, |
---|
| 36 | group => root, |
---|
| 37 | mode => 750; |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | file { |
---|
| 41 | "/etc/ldap/consumer-init.ldif": |
---|
| 42 | content => template("openldap/consumer-init.ldif.erb"), |
---|
| 43 | mode => 0600, |
---|
| 44 | owner => root, |
---|
| 45 | group => root; |
---|
| 46 | "/etc/ldap/consumer-sync.ldif": |
---|
| 47 | content => template("openldap/consumer-sync.ldif.erb"), |
---|
| 48 | mode => 0600, |
---|
| 49 | owner => root, |
---|
| 50 | group => root; |
---|
| 51 | } |
---|
| 52 | } |
---|
| 53 | |
---|
[446] | 54 | class openldap::server::slave { |
---|
| 55 | |
---|
| 56 | debug ("configuring openldap::server::slave with dn '$ldap_base'") |
---|
| 57 | |
---|
| 58 | package {"slapd": |
---|
| 59 | ensure => installed, |
---|
| 60 | responsefile => "/var/cache/debconf/slapd.preseed", |
---|
| 61 | require => File["/var/cache/debconf/slapd.preseed"], |
---|
| 62 | } |
---|
| 63 | # if defined(Package["ldap-utils"]) { } else { |
---|
| 64 | # package {"ldap-utils": ensure => present, } |
---|
| 65 | # } |
---|
| 66 | |
---|
| 67 | service {"slapd": |
---|
| 68 | ensure => running, |
---|
| 69 | require => Package[slapd], |
---|
| 70 | } |
---|
| 71 | |
---|
| 72 | # if ($ldap_ssl_only) { |
---|
| 73 | # $line = 'SLAPD_SERVICES="ldaps:///"' |
---|
| 74 | # } else { |
---|
| 75 | $line = 'SLAPD_SERVICES="ldap:/// ldaps:/// ldapi:///"' |
---|
| 76 | # } |
---|
| 77 | line {"listen_locally": |
---|
| 78 | # line => 'SLAPD_SERVICES="ldap:/// ldaps:/// ldapi:///"', |
---|
| 79 | line => $line, |
---|
| 80 | file => "/etc/default/slapd", |
---|
| 81 | ensure => present, |
---|
| 82 | require => Package[slapd], |
---|
| 83 | notify => Service[slapd], |
---|
| 84 | } |
---|
| 85 | |
---|
| 86 | file { |
---|
| 87 | "/etc/ldap/slapd.conf": |
---|
[449] | 88 | content => template("openldap/slapd.conf_slave.erb"), |
---|
[446] | 89 | mode => 0600, |
---|
| 90 | owner => root, |
---|
| 91 | group => root; |
---|
| 92 | "/var/cache/debconf/slapd.preseed": |
---|
| 93 | content => template("openldap/slapd.preseed.erb"), |
---|
| 94 | mode => 0600, |
---|
| 95 | owner => root, |
---|
| 96 | group => root; |
---|
| 97 | "/var/backups/ldap": |
---|
| 98 | ensure => directory, |
---|
| 99 | owner => root, |
---|
| 100 | group => root, |
---|
| 101 | mode => 750; |
---|
| 102 | } |
---|
[501] | 103 | |
---|
| 104 | exec{"slap_conf_update": |
---|
[503] | 105 | 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] | 106 | refreshonly => true, |
---|
| 107 | subscribe => File["/etc/ldap/slapd.conf"], |
---|
[502] | 108 | require => [Package[slapd], File["/etc/ldap/slapd.conf"]], |
---|
[501] | 109 | } |
---|
| 110 | |
---|
[446] | 111 | |
---|
| 112 | file { |
---|
| 113 | "/etc/ldap/schema": |
---|
| 114 | ensure => directory, |
---|
[506] | 115 | mode => 644, |
---|
[446] | 116 | owner => root, |
---|
| 117 | group => root, |
---|
[506] | 118 | source => "puppet:///openldap/etc/ldap/schema/", |
---|
| 119 | recurse => "true", |
---|
[446] | 120 | require => Package[slapd]; |
---|
| 121 | } |
---|
| 122 | |
---|
| 123 | cron {"ldap-backup": |
---|
| 124 | command => "/usr/local/sbin/ldap-backup.sh", |
---|
| 125 | user => "root", |
---|
| 126 | hour => 2, |
---|
| 127 | minute => 0, |
---|
| 128 | require => File["/var/backups/ldap"], |
---|
| 129 | } |
---|
| 130 | } |
---|