diff --git a/manifests/server.pp b/manifests/server.pp index 31589e0..6741842 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -10,11 +10,18 @@ $printing = '', $printcap_name = '', $disable_spoolss = '', - $bind_interfaces_only = 'yes',) { + $bind_interfaces_only = 'yes', + $manage_service = true,) { include samba::server::install include samba::server::config - include samba::server::service + + # in case this is a service on a clustered node which is managed by - for + # example - pacemaker you can set this to + if str2bool($manage_service) { + include samba::server::service + $notify_service = Class['samba::server::service'] + } $incl = '/etc/samba/smb.conf' $context = "/files/etc/samba/smb.conf" @@ -26,7 +33,7 @@ context => $context, changes => "set ${target} global", require => Class['samba::server::config'], - notify => Class['samba::server::service'] + notify => $notify_service, } samba::server::option { diff --git a/manifests/server/config.pp b/manifests/server/config.pp index d51e432..cfa299d 100644 --- a/manifests/server/config.pp +++ b/manifests/server/config.pp @@ -13,7 +13,7 @@ group => 'root', mode => '0644', require => [File['/etc/samba'], Class['samba::server::install']], - notify => Class['samba::server::service'] + notify => $::samba::server::notify_service, } } diff --git a/manifests/server/option.pp b/manifests/server/option.pp index 36968fc..7881468 100644 --- a/manifests/server/option.pp +++ b/manifests/server/option.pp @@ -4,16 +4,16 @@ $target = $samba::server::target $changes = $value ? { - default => "set \"${target}/$name\" \"$value\"", - '' => "rm ${target}/$name", + default => "set \"${target}/${name}\" \"${value}\"", + '' => "rm ${target}/${name}", } - augeas { "samba-$name": + augeas { "samba-${name}": incl => $incl, lens => 'Samba.lns', context => $context, changes => $changes, require => Augeas['global-section'], - notify => Class['Samba::Server::Service'] + notify => $::samba::server::notify_service, } } \ No newline at end of file diff --git a/manifests/server/share.pp b/manifests/server/share.pp index b7d451f..2130c7f 100644 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -37,7 +37,7 @@ default => "rm ${target} '${name}'", }, require => Class['samba::server::config'], - notify => Class['samba::server::service'] + notify => $::samba::server::notify_service, } if $ensure == 'present' { @@ -130,7 +130,7 @@ context => $context, changes => $changes, require => Augeas["${name}-section"], - notify => Class['samba::server::service'] + notify => $notify_service, } augeas { "${name}-valid_users": @@ -140,7 +140,7 @@ '' => "rm \"${target}/valid users\"", }, require => Augeas["${name}-section"], - notify => Class['samba::server::service'] + notify => $notify_service } augeas { "${name}-op_locks": @@ -150,7 +150,7 @@ '' => "rm \"${target}/oplocks\"", }, require => Augeas["${name}-section"], - notify => Class['samba::server::service'] + notify => $notify_service, } augeas { "${name}-level2_oplocks": context => $context, @@ -159,7 +159,7 @@ '' => "rm \"${target}/level2 oplocks\"", }, require => Augeas["${name}-section"], - notify => Class['samba::server::service'] + notify => $notify_service, } augeas { "${name}-veto_oplock_files": context => $context, @@ -168,7 +168,7 @@ '' => "rm \"${target}/veto oplock files\"", }, require => Augeas["${name}-section"], - notify => Class['samba::server::service'] + notify => $notify_service, } augeas { "${name}-write_list": context => $context, @@ -177,7 +177,7 @@ '' => "rm \"${target}/write list\"", }, require => Augeas["${name}-section"], - notify => Class['samba::server::service'] + notify => $notify_service, } } diff --git a/manifests/server/user.pp b/manifests/server/user.pp index 2cffe3b..38cf3cb 100644 --- a/manifests/server/user.pp +++ b/manifests/server/user.pp @@ -1,13 +1,12 @@ define samba::server::user( - $user_name = $name , - $password , - ) { - exec { "add smb account for ${user_name}": - command => "/sbin/add_samba_user '${user_name}' '${password}'" , - unless => "/sbin/check_samba_user '${user_name}'" , - require => [ - User["${user_name}"] - ] , - notify => Class['samba::server::service'] - } + $user_name = $name, + $password, +) { + + exec { "add smb account for ${user_name}": + command => "/sbin/add_samba_user '${user_name}' '${password}'" , + unless => "/sbin/check_samba_user '${user_name}'" , + require => User[$user_name], + notify => $::samba::server::notify_service, + } }