aboutsummaryrefslogtreecommitdiffstats
path: root/modules/openldap/manifests/init.pp
blob: 23971eb29ab51948a02c3ae848a5da3f8c0f7836 (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
class openldap {
   class master inherits common {
        Openldap::Config['/etc/openldap/mandriva-dit-access.conf'] {
            content => template("openldap/mandriva-dit-access.conf"),
        }

        $ldap_test_password = extlookup("ldap_test_password",'x')
        $ldap_test_directory = "/var/lib/ldap/test"
        file { "$ldap_test_directory":
            ensure => directory,
            group => ldap,
            owner => ldap,
            require => Package["openldap-servers"],
            before => Service['ldap'],
        }       
 
        Openldap::Config['/etc/openldap/slapd.conf'] {
            content => template("openldap/slapd.conf", "openldap/slapd.test.conf"),
        }

        Openldap::Config['/etc/sysconfig/ldap'] {
            content => template("openldap/ldap.sysconfig"),
        }

        if $environment == "test" {
            # if we ae in a test vm, we need to fill the directory
            # with data
            package { "openldap-clients": }

            local_script { "init_ldap.sh":
                content => template('openldap/init_ldap.sh'),
                require => Package["openldap-clients"],
            }

            exec { "init_ldap.sh":
                # taken arbitrary among all possible files
                creates => "/var/lib/ldap/objectClass.bdb",
                require => Local_script["init_ldap.sh"],
            }
        }
    }

    class slave($rid) inherits common {

        @@openldap::exported_slave { $rid: }

        $sync_password = extlookup("ldap_syncuser-$hostname",'x')
        
        # same access rights as master
        Openldap::Config['/etc/openldap/mandriva-dit-access.conf'] {
            content => template("openldap/mandriva-dit-access.conf"),
        }

        Openldap::Config['/etc/openldap/slapd.conf'] {
            content => template("openldap/slapd.conf",'openldap/slapd.syncrepl.conf'),
        }

        Openldap::Config['/etc/sysconfig/ldap'] {
            content => template("openldap/ldap.sysconfig"),
        }
    }
}