1 | # |
---|
2 | # used like this: |
---|
3 | # |
---|
4 | # $ldap_uri = 'ldap://ldap-server' |
---|
5 | # $ldap_base = 'dc=example,dc=com' |
---|
6 | # $ldap_ssl = 'true' |
---|
7 | # if ssl is not activated just don't put the line above. |
---|
8 | # include openldap::client |
---|
9 | |
---|
10 | class openldap::client { |
---|
11 | package { [ |
---|
12 | "base-files", |
---|
13 | "libnss-ldap", |
---|
14 | "libpam-ldap", |
---|
15 | "libpam-cracklib", |
---|
16 | "nscd" |
---|
17 | ]: ensure => installed |
---|
18 | } |
---|
19 | |
---|
20 | case $operatingsystem { |
---|
21 | Debian: { |
---|
22 | file { |
---|
23 | "/etc/pam_ldap.conf": |
---|
24 | require => Package["base-files"], |
---|
25 | ensure => present, |
---|
26 | content => template("openldap/pam_ldap.conf.erb"); |
---|
27 | "/etc/libnss-ldap.conf": |
---|
28 | require => Package["base-files"], |
---|
29 | ensure => present, |
---|
30 | content => template("openldap/ldap.conf.erb"); |
---|
31 | } |
---|
32 | } |
---|
33 | Ubuntu: { |
---|
34 | file { |
---|
35 | "/etc/ldap.conf": |
---|
36 | require => Package["base-files"], |
---|
37 | ensure => present, |
---|
38 | content => template("openldap/ldap.conf.erb"); |
---|
39 | "/etc/ldap/ldap.conf": |
---|
40 | require => Package["base-files"], |
---|
41 | ensure => present, |
---|
42 | content => template("openldap/ldap.conf.erb"); |
---|
43 | } |
---|
44 | } |
---|
45 | default: { |
---|
46 | err("Your $operatingsystem is not supported yet to configure openldap-client") |
---|
47 | } |
---|
48 | } |
---|
49 | |
---|
50 | file { |
---|
51 | "/etc/nsswitch.conf": |
---|
52 | source => "puppet:///openldap/etc/nsswitch.conf", |
---|
53 | ensure => present, |
---|
54 | require => Package["base-files"]; |
---|
55 | "/etc/pam.d": |
---|
56 | ensure => directory, |
---|
57 | mode => 644, |
---|
58 | owner => root, |
---|
59 | group => root, |
---|
60 | source => "puppet:///openldap/etc/pam.d/", |
---|
61 | recurse => "true", |
---|
62 | require => Package[base-files]; |
---|
63 | } |
---|
64 | } |
---|
65 | |
---|
66 | # |
---|
67 | # used like this for N mount points: |
---|
68 | # $mount1 = ['nfs','10.0.0.2','~','~'] |
---|
69 | # $mount2 = ['nfs','10.0.0.2','/home/shared','/home/shared'] |
---|
70 | # $pammount = [ $mount1, $mount2 ] |
---|
71 | # include openldap::client::pammount |
---|
72 | |
---|
73 | class openldap::client::pammount { |
---|
74 | package { [ |
---|
75 | "nfs-common", |
---|
76 | "libpam-mount" |
---|
77 | ]: ensure => installed |
---|
78 | } |
---|
79 | |
---|
80 | case $operatingsystem { |
---|
81 | Ubuntu: { |
---|
82 | file { |
---|
83 | "/etc/security/pam_mount.conf.xml": |
---|
84 | require => Package["libpam-mount"], |
---|
85 | ensure => present, |
---|
86 | content => template("openldap/pam_mount.conf.xml.erb"); |
---|
87 | } |
---|
88 | } |
---|
89 | default: { |
---|
90 | err("Your $operatingsystem is not supported yet to configure openldap-client") |
---|
91 | } |
---|
92 | } |
---|
93 | } |
---|