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

Last change on this file since 502 was 502, checked in by sebas, 13 years ago

dependencia a paquete slapd

File size: 2.5 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/ && /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   => 755,
69      owner  => root,
70      group  => root,
71      require => Package[slapd];
72    "/etc/ldap/schema/authldap.schema":
73      ensure => present,
74      mode   => 644,
75      owner  => root,
76      group  => root,
77      source  => "puppet:///openldap/etc/ldap/schema/authldap.schema",
78      require => File["/etc/ldap/schema"];
79  }
80
81  cron {"ldap-backup":
82    command => "/usr/local/sbin/ldap-backup.sh",
83    user    => "root",
84    hour    => 2,
85    minute  => 0,
86    require => File["/var/backups/ldap"],
87  }
88}
Note: See TracBrowser for help on using the repository browser.