[icinga-checkins] icinga.org: icingaweb2/feature/deduplicate-puppet-code-6842: icingaweb2_dev: populate openldap

git at icinga.org git at icinga.org
Tue Nov 25 18:09:54 CET 2014


Module: icingaweb2
Branch: feature/deduplicate-puppet-code-6842
Commit: ef2758125b4ce15f507f823b88093dc86d3342bd
URL:    https://git.icinga.org/?p=icingaweb2.git;a=commit;h=ef2758125b4ce15f507f823b88093dc86d3342bd

Author: Alexander Klimov <alexander.klimov at netways.de>
Date:   Tue Nov 25 17:46:29 2014 +0100

icingaweb2_dev: populate openldap

---

 .../icingaweb2_dev/files/openldap}/db.ldif         |    0
 .../icingaweb2_dev/files/openldap}/dit.ldif        |    0
 .../icingaweb2_dev/files/openldap}/users.ldif      |    0
 .../profiles/icingaweb2_dev/manifests/init.pp      |   26 ++++++++++++++++++++
 4 files changed, 26 insertions(+)

diff --git a/.vagrant-puppet/modules/openldap/files/db.ldif b/.vagrant-puppet/profiles/icingaweb2_dev/files/openldap/db.ldif
similarity index 100%
rename from .vagrant-puppet/modules/openldap/files/db.ldif
rename to .vagrant-puppet/profiles/icingaweb2_dev/files/openldap/db.ldif
diff --git a/.vagrant-puppet/modules/openldap/files/dit.ldif b/.vagrant-puppet/profiles/icingaweb2_dev/files/openldap/dit.ldif
similarity index 100%
rename from .vagrant-puppet/modules/openldap/files/dit.ldif
rename to .vagrant-puppet/profiles/icingaweb2_dev/files/openldap/dit.ldif
diff --git a/.vagrant-puppet/modules/openldap/files/users.ldif b/.vagrant-puppet/profiles/icingaweb2_dev/files/openldap/users.ldif
similarity index 100%
rename from .vagrant-puppet/modules/openldap/files/users.ldif
rename to .vagrant-puppet/profiles/icingaweb2_dev/files/openldap/users.ldif
diff --git a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp
index c655689..1d9435c 100644
--- a/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp
+++ b/.vagrant-puppet/profiles/icingaweb2_dev/manifests/init.pp
@@ -4,6 +4,7 @@ class icingaweb2_dev {
   include icingaweb2
   include icingacli
   include icinga_packages
+  include openldap
 
   class { 'zend_framework':
     notify => Service['apache'],
@@ -94,4 +95,29 @@ class icingaweb2_dev {
     unless  => 'grep -Fxqe "-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT" /etc/sysconfig/iptables',
     command => '/sbin/iptables -I INPUT 1 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT && /sbin/iptables-save > /etc/sysconfig/iptables'
   }
+
+  define openldap_file {
+    file { "openldap/${name}.ldif":
+      path    => "/usr/share/openldap-servers/${name}.ldif",
+      source  => "puppet:///modules/icingaweb2_dev/openldap/${name}.ldif",
+      require => Class['openldap'],
+    }
+  }
+
+  openldap_file { [ 'db', 'dit', 'users' ]: }
+
+  exec { 'populate-openldap':
+    # TODO: Split the command and use unless instead of trying to populate openldap everytime
+    command => 'sudo ldapadd -c -Y EXTERNAL -H ldapi:/// -f /usr/share/openldap-servers/db.ldif || true && \
+                sudo ldapadd -c -D cn=admin,dc=icinga,dc=org -x -w admin -f /usr/share/openldap-servers/dit.ldif || true && \
+                sudo ldapadd -c -D cn=admin,dc=icinga,dc=org -x -w admin -f /usr/share/openldap-servers/users.ldif || true',
+    require => [
+      Service['slapd'],
+      File[[
+        'openldap/db.ldif',
+        'openldap/dit.ldif',
+        'openldap/users.ldif'
+      ]]
+    ],
+  }
 }



More information about the icinga-checkins mailing list