aboutsummaryrefslogtreecommitdiffstats
path: root/modules/openldap/manifests/init.pp
blob: ebdf2a4f662bc04a6dd4744b44146df989b24107 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
class openldap {
    class base {
        package { 'openldap-servers':
            ensure => installed 
        }

        service { ldap:
            ensure => running,
            subscribe => [ Package['openldap-servers']],
            path => "/etc/init.d/ldap"
        }

        file {"/etc/ssl/openldap/":
            ensure => directory,
            owner => root,
            group => root,
            mode => 755,
        }

        $pem_file = 'ldap.pem'
        exec { "openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout $pem_file -out $pem_file -subj  '/CN=ldap.$domain'":
            cwd => "/etc/ssl/openldap/",
            creates => "/etc/ssl/openldap/$pem_file"
        }
    }

    # /etc/
    # 11:57:48|  blingme> misc: nothing special, just copy slapd.conf, mandriva-dit-access.conf across, slapcat one side, slapadd other side

    file { '/etc/openldap/slapd.conf':
        ensure => present,
        owner => root,
        group => root,
        mode => 644,
        require => Package["openldap-servers"],
        content => "",
        notify => [Service['ldap']]
    }

    file { '/etc/openldap/mandriva-dit-access.conf':
        ensure => present,
        owner => root,
        group => root,
        mode => 644,
        require => Package["openldap-servers"],
        content => "",
        notify => [Service['ldap']]
    }

    file { '/etc/sysconfig/ldap':
        ensure => present,
        owner => root,
        group => root,
        mode => 644,
        require => Package["openldap-servers"],
        content => "",
        notify => [Service['ldap']]
    } 

    class master inherits base {
        file { '/etc/openldap/mandriva-dit-access.conf':
            content => template("openldap/mandriva-dit-access.conf"),
        }

        file { '/etc/openldap/slapd.conf':
            content => template("openldap/slapd.conf"),
        }

        file { '/etc/sysconfig/ldap':
            content => template("openldap/ldap.sysconfig"),
        }
    }
}