moved config into def, added tree_suffix paramter for lam

This commit is contained in:
Tobias Herre 2020-08-25 12:21:03 +02:00
parent 604d1b6a71
commit 2c98e83332
3 changed files with 50 additions and 24 deletions

View File

@ -27,9 +27,9 @@ Examples:
configs => { configs => {
wmde => { wmde => {
password => "1234", password => "1234",
password_salt => "5678" password_salt => "5678",
tree_suffix => "dc=wikimedia,dc=de",
} }
} }
} }

View File

@ -101,26 +101,52 @@ class wmdeit_ldap::lam(
, '\n', "\n ")) , '\n', "\n "))
wmdeit_ldap::lam::config {$name:
encoded_password => $encoded_password,
file {"$docroot/config/$name.conf": encoded_password_salt => $encoded_password_salt,
ensure => file, suffix_user => $conf['suffix_user'],
content => template("wmdeit_ldap/wmde.conf.erb"), suffix_group => $conf['suffix_group'],
owner => "www-data", tree_suffix => $conf['tree_suffix'],
require => File["$docroot/config/pdf"],
} ->
file {"$docroot/config/profiles/$name":
ensure=>directory
}->
file{"$docroot/config/profiles/$name/default.user":
ensure=>file,
content => template("wmdeit_ldap/default.user.erb")
} ->
file{"$docroot/config/profiles/$name/default.group":
ensure=>file,
content => template("wmdeit_ldap/default.group.erb")
} }
} }
} }
define wmdeit_ldap::lam::config
(
$encoded_password,
$encoded_password_salt,
$tree_suffix,
$suffix_user = "ou=People,$tree_suffix",
$suffix_group = "ou=Groups,$tree_suffix",
$docroot = $::wmdeit_ldap::lam::docroot
){
if (!$suffix_user) or (!$suffix_group) {
fail("no suffix_user or suffix_group given")
}
file {"$docroot/config/$title.conf":
ensure => file,
content => template("wmdeit_ldap/wmde.conf.erb"),
owner => "www-data",
require => File["$docroot/config/pdf"],
} ->
file {"$docroot/config/profiles/$title":
ensure=>directory
}->
file{"$docroot/config/profiles/$title/default.user":
ensure=>file,
content => template("wmdeit_ldap/default.user.erb")
} ->
file{"$docroot/config/profiles/$title/default.group":
ensure=>file,
content => template("wmdeit_ldap/default.group.erb")
}
}

View File

@ -18,7 +18,7 @@ Passwd: {SSHA}<%= @encoded_password %> <%= @encoded_password_salt %>
# suffix of tree view # suffix of tree view
# e.g. dc=yourdomain,dc=org # e.g. dc=yourdomain,dc=org
treesuffix: dc=wikimedia,dc=de treesuffix: <%= @tree_suffix %>
# default language (a line from config/language) # default language (a line from config/language)
defaultLanguage: en_GB.utf8 defaultLanguage: en_GB.utf8
@ -50,11 +50,11 @@ modules: posixAccount_pwdHash: SSHA
activeTypes: user,group activeTypes: user,group
types: suffix_user: ou=People,dc=wikimedia,dc=de types: suffix_user: <%= @suffix_user %>
types: attr_user: #uid;#givenName;#sn;#uidNumber;#gidNumber types: attr_user: #uid;#givenName;#sn;#uidNumber;#gidNumber
types: modules_user: inetOrgPerson,posixAccount,shadowAccount types: modules_user: inetOrgPerson,posixAccount,shadowAccount
types: suffix_group: ou=group,dc=wikimedia,dc=de types: suffix_group: <%= @suffix_group %>
types: attr_group: #cn;#gidNumber;#memberUID;#description types: attr_group: #cn;#gidNumber;#memberUID;#description
types: modules_group: wmdeGroup types: modules_group: wmdeGroup