From 78ae7344a797d22336a646824761919c0b1947ba Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Mon, 19 Mar 2012 14:09:31 +0000 Subject: split most class and define from main openldap init.pp file --- modules/openldap/manifests/common.pp | 30 ++++++++++++++++ modules/openldap/manifests/config.pp | 7 ++++ modules/openldap/manifests/exported_slave.pp | 3 ++ modules/openldap/manifests/init.pp | 54 +--------------------------- modules/openldap/manifests/slave_instance.pp | 11 ++++++ 5 files changed, 52 insertions(+), 53 deletions(-) create mode 100644 modules/openldap/manifests/common.pp create mode 100644 modules/openldap/manifests/config.pp create mode 100644 modules/openldap/manifests/exported_slave.pp create mode 100644 modules/openldap/manifests/slave_instance.pp (limited to 'modules/openldap') diff --git a/modules/openldap/manifests/common.pp b/modules/openldap/manifests/common.pp new file mode 100644 index 00000000..f625f0a4 --- /dev/null +++ b/modules/openldap/manifests/common.pp @@ -0,0 +1,30 @@ +class openldap::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'], + } + + file { '/etc/ssl/openldap/': + ensure => directory, + } + + 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 => ''; + } +} diff --git a/modules/openldap/manifests/config.pp b/modules/openldap/manifests/config.pp new file mode 100644 index 00000000..6f364ffc --- /dev/null +++ b/modules/openldap/manifests/config.pp @@ -0,0 +1,7 @@ +define openldap::config($content) { + file { $name: + require => Package['openldap-servers'], + content => $content, + notify => Exec['/etc/init.d/ldap check'], + } +} diff --git a/modules/openldap/manifests/exported_slave.pp b/modules/openldap/manifests/exported_slave.pp new file mode 100644 index 00000000..5b9f6b87 --- /dev/null +++ b/modules/openldap/manifests/exported_slave.pp @@ -0,0 +1,3 @@ +# this define is here only to be exported by slave +# and later used by get_ldap_servers +define openldap::exported_slave { } diff --git a/modules/openldap/manifests/init.pp b/modules/openldap/manifests/init.pp index 4f2c2d33..23971eb2 100644 --- a/modules/openldap/manifests/init.pp +++ b/modules/openldap/manifests/init.pp @@ -1,41 +1,5 @@ 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"], - } - - file {"/etc/ssl/openldap/": - ensure => directory, - } - - 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 => ""; - } - } - - class master inherits common { + class master inherits common { Openldap::Config['/etc/openldap/mandriva-dit-access.conf'] { content => template("openldap/mandriva-dit-access.conf"), } @@ -76,22 +40,6 @@ class openldap { } } - # this define is here only to be exported by slave - # and later used by get_ldap_servers - define exported_slave { - - } - - # 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, - } - } - class slave($rid) inherits common { @@openldap::exported_slave { $rid: } diff --git a/modules/openldap/manifests/slave_instance.pp b/modules/openldap/manifests/slave_instance.pp new file mode 100644 index 00000000..a0eb71e2 --- /dev/null +++ b/modules/openldap/manifests/slave_instance.pp @@ -0,0 +1,11 @@ +# TODO create the user for sync in ldap +# this define is mainly syntaxic sugar +define openldap::slave_instance($rid) { + # seems the inheritance do not work as I believe + include openldap::common + class { 'openldap::slave': + rid => $rid, + } +} + + -- cgit v1.2.1