diff options
-rw-r--r-- | Rakefile | 2 | ||||
-rw-r--r-- | manifests/server/ads.pp | 6 | ||||
-rw-r--r-- | manifests/server/config.pp | 10 | ||||
-rw-r--r-- | manifests/server/params.pp | 12 | ||||
-rw-r--r-- | manifests/server/service.pp | 17 | ||||
-rw-r--r-- | manifests/server/share.pp | 84 | ||||
-rw-r--r-- | manifests/server/winbind.pp | 11 |
7 files changed, 58 insertions, 84 deletions
@@ -37,6 +37,6 @@ end desc "Run syntax, lint, and spec tests." task :test => [ :syntax, -# :lint, + :lint, :spec, ] diff --git a/manifests/server/ads.pp b/manifests/server/ads.pp index 1260fd1..7b496fe 100644 --- a/manifests/server/ads.pp +++ b/manifests/server/ads.pp @@ -23,13 +23,13 @@ class samba::server::ads($ensure = present, $map_readonly = 'no', $target_ou = 'Nix_Mashine') { - $krb5_user_package = $osfamily ? { + $krb5_user_package = $::osfamily ? { 'RedHat' => 'krb5-workstation', default => 'krb5-user', } - if $osfamily == 'RedHat' { - if $operatingsystemrelease =~ /^6\./ { + if $::osfamily == 'RedHat' { + if $::operatingsystemrelease =~ /^6\./ { $winbind_package = 'samba-winbind' } else { $winbind_package = 'samba-common' diff --git a/manifests/server/config.pp b/manifests/server/config.pp index 1ecb490..eb9b78e 100644 --- a/manifests/server/config.pp +++ b/manifests/server/config.pp @@ -1,12 +1,11 @@ # == Class samba::server::config # class samba::server::config { - file { '/etc/samba': - ensure => directory, - owner => 'root', - group => 'root', - mode => '0755', + ensure => directory, + owner => 'root', + group => 'root', + mode => '0755', } file { '/etc/samba/smb.conf': @@ -17,5 +16,4 @@ class samba::server::config { require => [File['/etc/samba'], Class['samba::server::install']], notify => Class['samba::server::service'] } - } diff --git a/manifests/server/params.pp b/manifests/server/params.pp index ba0c1be..be9e01b 100644 --- a/manifests/server/params.pp +++ b/manifests/server/params.pp @@ -11,14 +11,18 @@ class samba::server::params { default: { $service_name = 'samba' } } } - 'Ubuntu': { $service_name = 'smbd' - $nmbd_name = 'nmbd' } + 'Ubuntu': { + $service_name = 'smbd' + $nmbd_name = 'nmbd' + } default: { $service_name = 'samba' } } } 'Gentoo': { $service_name = 'samba' } - 'Archlinux': { $service_name = 'smbd' - $nmbd_name = 'nmbd' } + 'Archlinux': { + $service_name = 'smbd' + $nmbd_name = 'nmbd' + } # Currently Gentoo has $::osfamily = "Linux". This should change in # Factor 1.7.0 <http://projects.puppetlabs.com/issues/17029>, so diff --git a/manifests/server/service.pp b/manifests/server/service.pp index 1a9fbe7..68db2d6 100644 --- a/manifests/server/service.pp +++ b/manifests/server/service.pp @@ -5,21 +5,20 @@ class samba::server::service ( $enable = true ) inherits samba::server::params { - service { $service_name : - ensure => $ensure, - hasstatus => true, - hasrestart => true, - enable => $enable, - require => Class['samba::server::config'] + service { $samba::server::params::service_name : + ensure => $ensure, + hasstatus => true, + hasrestart => true, + enable => $enable, + require => Class['samba::server::config'] } - if $nmbd_name != undef { - service { $nmbd_name : + if $samba::server::params::nmbd_name != undef { + service { $samba::server::params::nmbd_name : ensure => $ensure, hasrestart => false, enable => $enable, require => Class['samba::server::config'], } } - } diff --git a/manifests/server/share.pp b/manifests/server/share.pp index 5a6667c..c682055 100644 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -36,14 +36,16 @@ define samba::server::share($ensure = present, $context = $samba::server::context $target = "target[. = '${name}']" + $section_changes = $ensure ? { + present => "set ${target} '${name}'", + default => "rm ${target} '${name}'", + } + augeas { "${name}-section": incl => $incl, lens => 'Samba.lns', context => $context, - changes => $ensure ? { - present => "set ${target} '${name}'", - default => "rm ${target} '${name}'", - }, + changes => $section_changes, require => Class['samba::server::config'], notify => Class['samba::server::service'] } @@ -51,22 +53,22 @@ define samba::server::share($ensure = present, if $ensure == 'present' { $changes = [ $available ? { - true => "set \"${target}/available\" yes", - false => "set \"${target}/available\" no", - default => "rm \"${target}/available\"", - }, + true => "set \"${target}/available\" yes", + false => "set \"${target}/available\" no", + default => "rm \"${target}/available\"", + }, $browsable ? { - true => "set \"${target}/browsable\" yes", - false => "set \"${target}/browsable\" no", - default => "rm \"${target}/browsable\"", + true => "set \"${target}/browsable\" yes", + false => "set \"${target}/browsable\" no", + default => "rm \"${target}/browsable\"", }, $comment ? { - default => "set \"${target}/comment\" '${comment}'", - '' => "rm \"${target}/comment\"", + default => "set \"${target}/comment\" '${comment}'", + '' => "rm \"${target}/comment\"", }, $copy ? { - '' => "rm \"${target}/copy\"", - default => "set \"${target}/copy\" '${copy}'", + '' => "rm \"${target}/copy\"", + default => "set \"${target}/copy\" '${copy}'", }, $create_mask ? { '' => "rm \"${target}/create mask\"", @@ -160,63 +162,35 @@ define samba::server::share($ensure = present, false => "set \"${target}/strict allocate\" no", default => "rm \"${target}/strict allocate\"", }, - ] - - augeas { "${name}-changes": - incl => $incl, - lens => 'Samba.lns', - context => $context, - changes => $changes, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-valid_users": - context => $context, - changes => $valid_users ? { + $valid_users ? { '' => "rm \"${target}/valid users\"", default => "set \"${target}/valid users\" '${valid_users}'", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-op_locks": - context => $context, - changes => $op_locks ? { + $op_locks ? { '' => "rm \"${target}/oplocks\"", default => "set \"${target}/oplocks\" '${op_locks}'", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - augeas { "${name}-level2_oplocks": - context => $context, - changes => $level2_oplocks ? { + $level2_oplocks ? { '' => "rm \"${target}/level2 oplocks\"", default => "set \"${target}/level2 oplocks\" '${level2_oplocks}'", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - augeas { "${name}-veto_oplock_files": - context => $context, - changes => $veto_oplock_files ? { + $veto_oplock_files ? { '' => "rm \"${target}/veto oplock files\"", default => "set \"${target}/veto oplock files\" '${veto_oplock_files}'", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - augeas { "${name}-write_list": - context => $context, - changes => $write_list ? { + $write_list ? { '' => "rm \"${target}/write list\"", default => "set \"${target}/write list\" '${write_list}'", }, + ] + + augeas { "${name}-changes": + incl => $incl, + lens => 'Samba.lns', + context => $context, + changes => $changes, require => Augeas["${name}-section"], notify => Class['samba::server::service'] } - } } diff --git a/manifests/server/winbind.pp b/manifests/server/winbind.pp index 376fed6..a379bb7 100644 --- a/manifests/server/winbind.pp +++ b/manifests/server/winbind.pp @@ -4,11 +4,10 @@ class samba::server::winbind ($ensure = running, $enable = true) { $service_name = 'winbind' service { $service_name: - ensure => $ensure, - hasstatus => true, - hasrestart => true, - enable => $enable, - require => Class['samba::server::config'] + ensure => $ensure, + hasstatus => true, + hasrestart => true, + enable => $enable, + require => Class['samba::server::config'] } - } |