source: trunk/puppet/modules/puppet-openldap/manifests/classes/server-slave.pp @ 546

Last change on this file since 546 was 506, checked in by sebas, 15 years ago

agregamos los schemas al repertorio /etc/ldap/schema/

File size: 2.4 KB
Line 
1class 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   "/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  }
56
57  exec{"slap_conf_update":
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",
59      refreshonly => true,
60      subscribe => File["/etc/ldap/slapd.conf"],
61      require => [Package[slapd], File["/etc/ldap/slapd.conf"]],
62  }
63
64 
65  file {
66    "/etc/ldap/schema":
67      ensure => directory,
68      mode   => 644,
69      owner  => root,
70      group  => root,
71      source  => "puppet:///openldap/etc/ldap/schema/",
72      recurse => "true",
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}
Note: See TracBrowser for help on using the repository browser.