diff options
Diffstat (limited to 'modules/openldap/manifests/init.pp')
| -rw-r--r-- | modules/openldap/manifests/init.pp | 122 |
1 files changed, 21 insertions, 101 deletions
diff --git a/modules/openldap/manifests/init.pp b/modules/openldap/manifests/init.pp index 4f2c2d33..34a214a2 100644 --- a/modules/openldap/manifests/init.pp +++ b/modules/openldap/manifests/init.pp @@ -1,114 +1,34 @@ class openldap { - define config($content) { - file { $name: - require => Package["openldap-servers"], - content => $content, - notify => Exec["/etc/init.d/ldap check"], - } - } - - class common { - package { 'openldap-servers': } - - service { ldap: - subscribe => Package['openldap-servers'], - require => Openssl::Self_signed_cert["ldap.$domain"], - } - - exec { "/etc/init.d/ldap check": - refreshonly => true, - notify => Service["ldap"], - } + include openldap::var - file {"/etc/ssl/openldap/": - ensure => directory, - } + package { 'openldap-servers': } - openssl::self_signed_cert{ "ldap.$domain": - directory => "/etc/ssl/openldap/" - } - - openldap::config { - '/etc/openldap/slapd.conf': content => ""; - '/etc/openldap/mandriva-dit-access.conf': content => ""; - '/etc/sysconfig/ldap': content => ""; - } + service { $openldap::var::service: + subscribe => Package['openldap-servers'], + require => Openssl::Self_signed_cert["ldap.${::domain}"], } - 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"], - } - } + exec { "slaptest": + refreshonly => true, + notify => Service[$openldap::var::service], } - # this define is here only to be exported by slave - # and later used by get_ldap_servers - define exported_slave { - + file { '/etc/ssl/openldap/': + ensure => directory, } - # TODO create the user for sync in ldap - # syntaxic sugar - define slave_instance($rid) { - # seems the inheritance do not work as I believe - include openldap::common - class { 'openldap::slave': - rid => $rid, - } + openssl::self_signed_cert{ "ldap.${::domain}": + directory => '/etc/ssl/openldap/', } - 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"), - } + openldap::config { + '/etc/openldap/slapd.conf': + content => ''; + '/etc/openldap/mandriva-dit-access.conf': + content => ''; + '/etc/sysconfig/ldap': + content => ''; + '/etc/sysconfig/slapd': + content => ''; } } |
