diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-06-05 23:15:32 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-06-05 23:15:32 +0200 |
commit | c93847dc9d2f9dea6ed09ce5f0cca479131de86d (patch) | |
tree | 6677e8dc17cecd9e56b9c25a3c2a322cb622c378 /modules | |
parent | 2b056b37147c03869f1ca0a2f7909b1a9644c60c (diff) | |
parent | 851ca3c6f662e26e949e57669d7962abb6c22510 (diff) | |
download | Puppet-c93847dc9d2f9dea6ed09ce5f0cca479131de86d.tar.gz Puppet-c93847dc9d2f9dea6ed09ce5f0cca479131de86d.tar.zst Puppet-c93847dc9d2f9dea6ed09ce5f0cca479131de86d.zip |
Merge branch 'dev'
Diffstat (limited to 'modules')
-rw-r--r-- | modules/base_installation/lib/puppet/functions/ldap_data.rb | 16 | ||||
-rw-r--r-- | modules/base_installation/manifests/users.pp | 8 | ||||
-rw-r--r-- | modules/role/manifests/caldance.pp | 11 |
3 files changed, 32 insertions, 3 deletions
diff --git a/modules/base_installation/lib/puppet/functions/ldap_data.rb b/modules/base_installation/lib/puppet/functions/ldap_data.rb index 0c92d89..0a6d935 100644 --- a/modules/base_installation/lib/puppet/functions/ldap_data.rb +++ b/modules/base_installation/lib/puppet/functions/ldap_data.rb | |||
@@ -30,9 +30,19 @@ Puppet::Functions.create_function(:ldap_data) do | |||
30 | filter = "(objectclass=*)" | 30 | filter = "(objectclass=*)" |
31 | 31 | ||
32 | data = {} | 32 | data = {} |
33 | connection.search(base, scope, filter) do |entry| | 33 | data_array = connection.search2(base, scope, filter, attrs=["immaePuppetJson", "dn"]).map do |entry| |
34 | data_ = entry.to_hash | 34 | [entry["dn"].first, entry["immaePuppetJson"] || []] |
35 | jsons = data_["immaePuppetJson"] || [] | 35 | end.sort_by do |dn, json| |
36 | if dn == "ou=roles,ou=hosts,dc=immae,dc=eu" | ||
37 | [0, dn] | ||
38 | elsif dn.end_with?("ou=roles,ou=hosts,dc=immae,dc=eu") | ||
39 | [1, dn] | ||
40 | else | ||
41 | [2, dn] | ||
42 | end | ||
43 | end.to_h | ||
44 | |||
45 | data_array.each do |dn, jsons| | ||
36 | jsons.each do |json| | 46 | jsons.each do |json| |
37 | data.merge!(JSON.parse(json)) | 47 | data.merge!(JSON.parse(json)) |
38 | end | 48 | end |
diff --git a/modules/base_installation/manifests/users.pp b/modules/base_installation/manifests/users.pp index 34df4bd..d0ac449 100644 --- a/modules/base_installation/manifests/users.pp +++ b/modules/base_installation/manifests/users.pp | |||
@@ -22,6 +22,13 @@ class base_installation::users ( | |||
22 | 22 | ||
23 | $users.each |$user| { | 23 | $users.each |$user| { |
24 | if ($user["username"] != "root") { | 24 | if ($user["username"] != "root") { |
25 | unless $user["shell"] == undef or empty($user["shell"]) { | ||
26 | ensure_packages([$user["shell"]]) | ||
27 | $shell = "/bin/${user[shell]}" | ||
28 | } else { | ||
29 | $shell = undef | ||
30 | } | ||
31 | |||
25 | user { "${user[username]}:${user[userid]}": | 32 | user { "${user[username]}:${user[userid]}": |
26 | name => $user[username], | 33 | name => $user[username], |
27 | uid => $user[userid], | 34 | uid => $user[userid], |
@@ -30,6 +37,7 @@ class base_installation::users ( | |||
30 | managehome => true, | 37 | managehome => true, |
31 | system => !!$user[system], | 38 | system => !!$user[system], |
32 | home => "/home/${user[username]}", | 39 | home => "/home/${user[username]}", |
40 | shell => $shell, | ||
33 | notify => Exec["remove_password:${user[username]}:${user[userid]}"], | 41 | notify => Exec["remove_password:${user[username]}:${user[userid]}"], |
34 | purge_ssh_keys => true | 42 | purge_ssh_keys => true |
35 | } | 43 | } |
diff --git a/modules/role/manifests/caldance.pp b/modules/role/manifests/caldance.pp new file mode 100644 index 0000000..75d9dbd --- /dev/null +++ b/modules/role/manifests/caldance.pp | |||
@@ -0,0 +1,11 @@ | |||
1 | class role::caldance ( | ||
2 | ) { | ||
3 | include "base_installation" | ||
4 | |||
5 | include "profile::tools" | ||
6 | include "profile::postgresql" | ||
7 | include "profile::apache" | ||
8 | include "profile::redis" | ||
9 | |||
10 | ensure_packages(["python-pip", "python-virtualenv", "python-django"]) | ||
11 | } | ||