aboutsummaryrefslogtreecommitdiff
path: root/manifests/server/ads.pp
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/server/ads.pp')
-rw-r--r--manifests/server/ads.pp81
1 files changed, 48 insertions, 33 deletions
diff --git a/manifests/server/ads.pp b/manifests/server/ads.pp
index 1f8e602..757d091 100644
--- a/manifests/server/ads.pp
+++ b/manifests/server/ads.pp
@@ -1,8 +1,6 @@
+# == Class samba::server::ads
# This module join samba server to Active Dirctory
#
-# Copyright (c) 2013 Lebedev Vadim, abraham1901 at g mail dot c o m
-# Licensed under the MIT License, http://opensource.org/licenses/MIT
-
class samba::server::ads($ensure = present,
$winbind_acct = 'admin',
$winbind_pass = 'SecretPass',
@@ -25,30 +23,47 @@ class samba::server::ads($ensure = present,
$map_readonly = 'no',
$target_ou = 'Nix_Mashine') {
+ $krb5_user_package = $::osfamily ? {
+ 'RedHat' => 'krb5-workstation',
+ default => 'krb5-user',
+ }
+
+ if $::osfamily == 'RedHat' {
+ if $::operatingsystemrelease =~ /^6\./ {
+ $winbind_package = 'samba-winbind'
+ } else {
+ $winbind_package = 'samba-common'
+ }
+ } else {
+ $winbind_package = 'winbind'
+ }
+
package{
- 'krb5-user': ensure => installed;
- 'winbind': ensure => installed;
- 'expect': ensure => installed;
+ $krb5_user_package: ensure => installed;
+ $winbind_package: ensure => installed;
+ 'expect': ensure => installed;
}
include samba::server::config
include samba::server::winbind
- $signal = 'samba::server::winbind'
+ # notify winbind
+ samba::server::option {
+ 'realm': value => $realm,
+ notify => Class['Samba::Server::Winbind'];
+ 'winbind uid': value => $winbind_uid,
+ notify => Class['Samba::Server::Winbind'];
+ 'winbind gid': value => $winbind_gid,
+ notify => Class['Samba::Server::Winbind'];
+ 'winbind enum groups': value => $winbind_enum_groups,
+ notify => Class['Samba::Server::Winbind'];
+ 'winbind enum users': value => $winbind_enum_users,
+ notify => Class['Samba::Server::Winbind'];
+ 'winbind use default domain': value => $winbind_use_default_domain,
+ notify => Class['Samba::Server::Winbind'];
+ }
- set_samba_option {
- 'realm': value => $realm,
- signal => $signal;
- 'winbind uid': value => $winbind_uid,
- signal => $signal;
- 'winbind gid': value => $winbind_gid,
- signal => $signal;
- 'winbind enum groups': value => $winbind_enum_groups,
- signal => $signal;
- 'winbind enum users': value => $winbind_enum_users,
- signal => $signal;
- 'winbind use default domain': value => $winbind_use_default_domain,
- signal => $signal;
+ samba::server::option {
'acl group control': value => $acl_group_control;
'map acl inherit': value => $map_acl_inherit;
'inherit acls': value => $inherit_acls;
@@ -61,14 +76,14 @@ class samba::server::ads($ensure = present,
'map readonly': value => $map_readonly;
}
- $nss_file='etc/nsswitch.conf'
+ $nss_file = 'etc/nsswitch.conf'
- $changes=$nsswitch ? {
+ $changes = $nsswitch ? {
true => [
- "set database[. = 'passwd']/service[1] compat",
- "set database[. = 'passwd']/service[2] winbind",
- "set database[. = 'group']/service[1] compat",
- "set database[. = 'group']/service[2] winbind",
+ 'set database[. = "passwd"]/service[1] compat',
+ 'set database[. = "passwd"]/service[2] winbind',
+ 'set database[. = "group"]/service[1] compat',
+ 'set database[. = "group"]/service[2] winbind',
],
false => [
"rm /files/${nss_file}/database[. = 'passwd']/service[. = 'winbind']",
@@ -86,12 +101,12 @@ class samba::server::ads($ensure = present,
path => '/sbin/verify_active_directory',
owner => root,
group => root,
- mode => "0755",
+ mode => '0755',
content => template("${module_name}/verify_active_directory.erb"),
- require => [ Package['krb5-user', 'winbind', 'expect'],
+ require => [ Package[$krb5_user_package, $winbind_package, 'expect'],
Augeas['samba-realm', 'samba-security', 'samba-winbind enum users',
'samba-winbind enum groups', 'samba-winbind uid', 'samba-winbind gid',
- 'samba-winbind use default domain'] ],
+ 'samba-winbind use default domain'], Service['winbind'] ],
}
file {'configure_active_directory':
@@ -99,18 +114,18 @@ class samba::server::ads($ensure = present,
path => '/sbin/configure_active_directory',
owner => root,
group => root,
- mode => "0755",
+ mode => '0755',
content => template("${module_name}/configure_active_directory.erb"),
- require => [ Package['krb5-user', 'winbind', 'expect'],
+ require => [ Package[$krb5_user_package, $winbind_package, 'expect'],
Augeas['samba-realm', 'samba-security', 'samba-winbind enum users',
'samba-winbind enum groups', 'samba-winbind uid', 'samba-winbind gid',
- 'samba-winbind use default domain'] ],
+ 'samba-winbind use default domain'], Service['winbind'] ],
}
exec {'join-active-directory':
# join the domain configured in samba.conf
command => '/sbin/configure_active_directory -j',
unless => '/sbin/verify_active_directory',
- require => [ File['configure_active_directory', 'verify_active_directory'], Class['samba::server::winbind'] ],
+ require => [ File['configure_active_directory', 'verify_active_directory'], Service['winbind'] ],
}
}