From aebc0b33952b2f2f49edac76482c5b5d848c7d67 Mon Sep 17 00:00:00 2001 From: Artem Sidorenko Date: Sun, 7 Jul 2013 13:22:36 +0100 Subject: Added archlinux --- manifests/server/service.pp | 1 + 1 file changed, 1 insertion(+) (limited to 'manifests') diff --git a/manifests/server/service.pp b/manifests/server/service.pp index 4bbe47f..55ccb06 100644 --- a/manifests/server/service.pp +++ b/manifests/server/service.pp @@ -3,6 +3,7 @@ class samba::server::service ($ensure = running, $enable = true) { Redhat: { $service_name = 'smb' } Debian: { $service_name = 'smbd' } Gentoo: { $service_name = 'samba' } + Archlinux: { $service_name = 'smbd' } # Currently Gentoo has $::osfamily = "Linux". This should change in # Factor 1.7.0 , so -- cgit v1.2.3 From db21d4cdaedbe63674bb837ce7a70c310919cd0a Mon Sep 17 00:00:00 2001 From: Tomas Edwardsson Date: Tue, 30 Jul 2013 15:13:49 +0000 Subject: Fix package names for rhel/centos using ads security RHEL/CentOS use krb5-workstation instead of krb5-user as well as samba-winbind instead of winbind package names. --- manifests/server/ads.pp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'manifests') diff --git a/manifests/server/ads.pp b/manifests/server/ads.pp index 1f8e602..ea6523d 100644 --- a/manifests/server/ads.pp +++ b/manifests/server/ads.pp @@ -25,10 +25,19 @@ class samba::server::ads($ensure = present, $map_readonly = 'no', $target_ou = 'Nix_Mashine') { + $krb5_user_package = $osfamily ? { + 'RedHat' => 'krb5-workstation', + default => 'krb5-user', + } + $winbind_package = $osfamily ? { + 'RedHat' => 'samba-winbind', + default => '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 @@ -88,7 +97,7 @@ class samba::server::ads($ensure = present, group => root, 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'] ], @@ -101,7 +110,7 @@ class samba::server::ads($ensure = present, group => root, 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'] ], -- cgit v1.2.3 From 6878e0a98ed5922b2a76f2e6f5bfb4d0df611762 Mon Sep 17 00:00:00 2001 From: Tomas Edwardsson Date: Sun, 1 Sep 2013 10:10:15 +0000 Subject: samba-common winbind package for rhel5 --- manifests/server/ads.pp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'manifests') diff --git a/manifests/server/ads.pp b/manifests/server/ads.pp index ea6523d..8ca8d45 100644 --- a/manifests/server/ads.pp +++ b/manifests/server/ads.pp @@ -29,9 +29,15 @@ class samba::server::ads($ensure = present, 'RedHat' => 'krb5-workstation', default => 'krb5-user', } - $winbind_package = $osfamily ? { - 'RedHat' => 'samba-winbind', - default => 'winbind', + + if $osfamily == "RedHat" { + if $operatingsystemrelease =~ /^6\./) { + $winbind_package = 'samba-winbind' + } else { + $winbind_package = 'samba-common' + } + } else { + $winbind_package = 'winbind' } package{ -- cgit v1.2.3 From 5ffe04fc605044cf0037a67c334121c68cc0608e Mon Sep 17 00:00:00 2001 From: Tomas Edwardsson Date: Sun, 1 Sep 2013 10:11:23 +0000 Subject: Removed extreneous closing parenthesis --- manifests/server/ads.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/server/ads.pp b/manifests/server/ads.pp index 8ca8d45..16be9ad 100644 --- a/manifests/server/ads.pp +++ b/manifests/server/ads.pp @@ -31,7 +31,7 @@ class samba::server::ads($ensure = present, } if $osfamily == "RedHat" { - if $operatingsystemrelease =~ /^6\./) { + if $operatingsystemrelease =~ /^6\./ { $winbind_package = 'samba-winbind' } else { $winbind_package = 'samba-common' -- cgit v1.2.3 From 96d0b2a097be28971c9441989f0d1a04315e4936 Mon Sep 17 00:00:00 2001 From: gnieark Date: Thu, 26 Sep 2013 11:04:56 +0200 Subject: Update service.pp On debian 7 samba service name is 'samba' --- manifests/server/service.pp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/server/service.pp b/manifests/server/service.pp index 4bbe47f..3731381 100644 --- a/manifests/server/service.pp +++ b/manifests/server/service.pp @@ -1,7 +1,15 @@ class samba::server::service ($ensure = running, $enable = true) { case $::osfamily { Redhat: { $service_name = 'smb' } - Debian: { $service_name = 'smbd' } + + #On Debian family: Debian 7 => samba , Ubuntu => smb + #Others, I don't know, hope 'samba' will works + Debian: { + case $::operatingsystem{ + Debian: { $service_name = 'samba' } + Ubuntu: { $service_name = 'smb'} + default: { $service_name='samba'} + } Gentoo: { $service_name = 'samba' } # Currently Gentoo has $::osfamily = "Linux". This should change in -- cgit v1.2.3 From 5398d2c96c38d2a920d52c5caba06fbdf2888229 Mon Sep 17 00:00:00 2001 From: gnieark Date: Thu, 26 Sep 2013 11:13:38 +0200 Subject: Update service.pp --- manifests/server/service.pp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'manifests') diff --git a/manifests/server/service.pp b/manifests/server/service.pp index 3731381..5450437 100644 --- a/manifests/server/service.pp +++ b/manifests/server/service.pp @@ -2,14 +2,15 @@ class samba::server::service ($ensure = running, $enable = true) { case $::osfamily { Redhat: { $service_name = 'smb' } - #On Debian family: Debian 7 => samba , Ubuntu => smb + #On Debian family: Debian 7 => samba , Ubuntu => smbd #Others, I don't know, hope 'samba' will works Debian: { case $::operatingsystem{ Debian: { $service_name = 'samba' } - Ubuntu: { $service_name = 'smb'} + Ubuntu: { $service_name = 'smbd'} default: { $service_name='samba'} } + } Gentoo: { $service_name = 'samba' } # Currently Gentoo has $::osfamily = "Linux". This should change in -- cgit v1.2.3 From 08c7b8dfbb4297fabfc9a15619ff4461a871eac2 Mon Sep 17 00:00:00 2001 From: Christian Depner Date: Mon, 11 Nov 2013 09:24:01 +0100 Subject: The parameter is now settable --- manifests/server.pp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'manifests') diff --git a/manifests/server.pp b/manifests/server.pp index bc1e3d7..9e5ee2e 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -2,7 +2,8 @@ class samba::server($interfaces = '', $security = '', $server_string = '', $unix_password_sync = '', - $workgroup = '') { + $workgroup = '', + $bind_interfaces_only = 'yes',) { include samba::server::install include samba::server::config @@ -21,7 +22,7 @@ class samba::server($interfaces = '', set_samba_option { 'interfaces': value => $interfaces; - 'bind interfaces only': value => 'yes'; + 'bind interfaces only': value => $bind_interfaces_only; 'security': value => $security; 'server string': value => $server_string; 'unix password sync': value => $unix_password_sync; -- cgit v1.2.3 From e9be6b324468dd380c501ba71fe297d9d92da50a Mon Sep 17 00:00:00 2001 From: Vladislav Nazarenko Date: Fri, 3 Jan 2014 14:31:55 +0100 Subject: FIX: augeas runtime optimization (~4 sec per augeas resource) --- manifests/server.pp | 13 +++- manifests/server/share.pp | 188 ++++++++++++---------------------------------- 2 files changed, 60 insertions(+), 141 deletions(-) (limited to 'manifests') diff --git a/manifests/server.pp b/manifests/server.pp index bc1e3d7..0dfda00 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -8,10 +8,13 @@ class samba::server($interfaces = '', include samba::server::config include samba::server::service - $context = '/files/etc/samba/smb.conf' - $target = "target[. = 'global']" + $incl = '/etc/samba/smb.conf' + $context = "/files/etc/samba/smb.conf" + $target = "target[. = 'global']" augeas { 'global-section': + incl => $incl, + lens => 'Samba.lns', context => $context, changes => "set ${target} global", require => Class['samba::server::config'], @@ -30,14 +33,18 @@ class samba::server($interfaces = '', } define set_samba_option ( $value = '', $signal = 'samba::server::service' ) { + $incl = $samba::server::incl $context = $samba::server::context - $target = $samba::server::target + $target = $samba::server::target + $changes = $value ? { default => "set \"${target}/$name\" \"$value\"", '' => "rm ${target}/$name", } augeas { "samba-$name": + incl => $incl, + lens => 'Samba.lns', context => $context, changes => $changes, require => Augeas['global-section'], diff --git a/manifests/server/share.pp b/manifests/server/share.pp index b4eb02f..b8e508c 100644 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -16,11 +16,13 @@ define samba::server::share($ensure = present, $public = '', $writable = '', $printable = '') { - + $incl = $samba::server::incl $context = $samba::server::context - $target = "target[. = '${name}']" + $target = "target[. = '${name}']" augeas { "${name}-section": + incl => $incl, + lens => 'Samba.lns', context => $context, changes => $ensure ? { present => "set ${target} '${name}'", @@ -31,179 +33,89 @@ define samba::server::share($ensure = present, } if $ensure == 'present' { - augeas { "${name}-browsable": - context => $context, - changes => $browsable ? { - true => "set ${target}/browsable yes", - false => "set ${target}/browsable no", - default => "rm ${target}/browsable", + $changes = [ + $browsable ? { + true => "set \"${target}/browsable\" yes", + false => "set \"${target}/browsable\" no", + default => "rm \"${target}/browsable\"", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-comment": - context => $context, - changes => $comment ? { - default => "set ${target}/comment '${comment}'", - '' => "rm ${target}/comment", + $comment ? { + default => "set \"${target}/comment\" '${comment}'", + '' => "rm \"${target}/comment\"", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-copy": - context => $context, - changes => $copy ? { - default => "set ${target}/copy '${copy}'", - '' => "rm ${target}/copy", + $copy ? { + default => "set \"${target}/copy\" '${copy}'", + '' => "rm \"${target}/copy\"", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-create_mask": - context => $context, - changes => $create_mask ? { + $create_mask ? { default => "set \"${target}/create mask\" '${create_mask}'", - '' => "rm \"${target}/create mask\"", + '' => "rm \"${target}/create mask\"", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-directory_mask": - context => $context, - changes => $directory_mask ? { + $directory_mask ? { default => "set \"${target}/directory mask\" '${directory_mask}'", - '' => "rm \"${target}/directory mask\"", + '' => "rm \"${target}/directory mask\"", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-force_create_mask": - context => $context, - changes => $force_create_mask ? { + $force_create_mask ? { default => "set \"${target}/force create mask\" '${force_create_mask}'", - '' => "rm \"${target}/force create mask\"", + '' => "rm \"${target}/force create mask\"", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-force_directory_mask": - context => $context, - changes => $force_directory_mask ? { + $force_directory_mask ? { default => "set \"${target}/force directory mask\" '${force_directory_mask}'", - '' => "rm \"${target}/force directory mask\"", + '' => "rm \"${target}/force directory mask\"", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-force_group": - context => $context, - changes => $force_group ? { + $force_group ? { default => "set \"${target}/force group\" '${force_group}'", - '' => "rm \"${target}/force group\"", + '' => "rm \"${target}/force group\"", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-force_user": - context => $context, - changes => $force_user ? { + $force_user ? { default => "set \"${target}/force user\" '${force_user}'", - '' => "rm \"${target}/force user\"", + '' => "rm \"${target}/force user\"", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-guest_account": - context => $context, - changes => $guest_account ? { + $guest_account ? { default => "set \"${target}/guest account\" '${guest_account}'", - '' => "rm \"${target}/guest account\"", + '' => "rm \"${target}/guest account\"", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-guest_ok": - context => $context, - changes => $guest_ok ? { + $guest_ok ? { true => "set \"${target}/guest ok\" yes", false => "set \"${target}/guest ok\" no", - default => "rm \"${target}/guest ok\"", + default => "rm \"${target}/guest ok\"", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-guest_only": - context => $context, - changes => $guest_only ? { + $guest_only ? { true => "set \"${target}/guest only\" yes", false => "set \"${target}/guest only\" no", - default => "rm \"${target}/guest only\"", + default => "rm \"${target}/guest only\"", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-path": - context => $context, - changes => $path ? { + $path ? { default => "set ${target}/path '${path}'", - '' => "rm ${target}/path", + '' => "rm ${target}/path", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-read_only": - context => $context, - changes => $read_only ? { + $read_only ? { true => "set \"${target}/read only\" yes", false => "set \"${target}/read only\" no", - default => "rm \"${target}/read_only\"", + default => "rm \"${target}/read_only\"", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-public": - context => $context, - changes => $public ? { + $public ? { true => "set \"${target}/public\" yes", false => "set \"${target}/public\" no", - default => "rm \"${target}/public\"", + default => "rm \"${target}/public\"", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-writable": - context => $context, - changes => $writable ? { + $writable ? { true => "set \"${target}/writable\" yes", false => "set \"${target}/writable\" no", - default => "rm \"${target}/writable\"", + default => "rm \"${target}/writable\"", }, - require => Augeas["${name}-section"], - notify => Class['samba::server::service'] - } - - augeas { "${name}-printable": - context => $context, - changes => $printable ? { + $printable ? { true => "set \"${target}/printable\" yes", false => "set \"${target}/printable\" no", - default => "rm \"${target}/printable\"", + default => "rm \"${target}/printable\"", }, + ] + + augeas { "${name}-changes": + incl => $incl, + lens => 'Samba.lns', + context => $context, + changes => $changes, require => Augeas["${name}-section"], notify => Class['samba::server::service'] } -- cgit v1.2.3 From 8bf623bca5a1e9d5da1ed05a8a9cb2a773ee55fb Mon Sep 17 00:00:00 2001 From: jonoterc Date: Thu, 10 Oct 2013 17:26:29 -0400 Subject: enabling installation of samba account checking/creation shell scripts --- manifests/server.pp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'manifests') diff --git a/manifests/server.pp b/manifests/server.pp index 0dfda00..996149f 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -30,6 +30,24 @@ class samba::server($interfaces = '', 'unix password sync': value => $unix_password_sync; 'workgroup': value => $workgroup; } + + file {'check_samba_user': + # script checks to see if a samba account exists for a given user + path => '/sbin/check_samba_user', + owner => root, + group => root, + mode => "0755", + content => template("${module_name}/check_samba_user"), + } + + file {'add_samba_user': + # script creates a new samba account for a given user and password + path => '/sbin/add_samba_user', + owner => root, + group => root, + mode => "0755", + content => template("${module_name}/add_samba_user"), + } } define set_samba_option ( $value = '', $signal = 'samba::server::service' ) { -- cgit v1.2.3 From e8be6764c89c7670e950db74551f94b138661ae2 Mon Sep 17 00:00:00 2001 From: jonoterc Date: Thu, 10 Oct 2013 17:29:14 -0400 Subject: enabling configuration to enumerate users who can access a given share adding support for "valid users" smbd.conf configuration option to samba::server::share --- manifests/server/share.pp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/server/share.pp b/manifests/server/share.pp index b8e508c..2e0c0ba 100644 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -15,7 +15,10 @@ define samba::server::share($ensure = present, $read_only = '', $public = '', $writable = '', - $printable = '') { + $printable = '', + $valid_users = '', + ) { + $incl = $samba::server::incl $context = $samba::server::context $target = "target[. = '${name}']" @@ -119,5 +122,15 @@ define samba::server::share($ensure = present, require => Augeas["${name}-section"], notify => Class['samba::server::service'] } + + augeas { "${name}-valid_users": + context => $context, + changes => $printable ? { + default => "set ${target}/valid users '${valid_users}'", + '' => "rm ${target}/valid users", + }, + require => Augeas["${name}-section"], + notify => Class['samba::server::service'] + } } } -- cgit v1.2.3 From e22aac5672174c77500e32984b7a139a1d0ac931 Mon Sep 17 00:00:00 2001 From: jonoterc Date: Thu, 10 Oct 2013 17:30:15 -0400 Subject: correcting read_only configuration application "read only" option was not removable due to "read_only" misspelling --- manifests/server/share.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/server/share.pp b/manifests/server/share.pp index 2e0c0ba..d9eb331 100644 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -95,7 +95,7 @@ define samba::server::share($ensure = present, $read_only ? { true => "set \"${target}/read only\" yes", false => "set \"${target}/read only\" no", - default => "rm \"${target}/read_only\"", + default => "rm \"${target}/read only\"", }, $public ? { true => "set \"${target}/public\" yes", -- cgit v1.2.3 From 821bb50151990f57461b29e19027d971e5842e4a Mon Sep 17 00:00:00 2001 From: jonoterc Date: Thu, 10 Oct 2013 17:34:49 -0400 Subject: adding defined type for ensuring presence of a samba account for a given user user is identified by name, and a password must be given in its current state this can only create a user (with a given password), but will not update passwords (would need to figure out how to introspect on whether an in-place password differs from plaintext password input) also, this currently assumes/requires that a Unix user account with a matching name exists --- manifests/server/user.pp | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 manifests/server/user.pp (limited to 'manifests') diff --git a/manifests/server/user.pp b/manifests/server/user.pp new file mode 100644 index 0000000..2cffe3b --- /dev/null +++ b/manifests/server/user.pp @@ -0,0 +1,13 @@ +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'] + } +} -- cgit v1.2.3 From 04d58f4e21e3f877b279f4a615c6059b13d277ce Mon Sep 17 00:00:00 2001 From: jonoterc Date: Fri, 1 Nov 2013 02:55:57 -0400 Subject: correcting variable tested for presence of valid_users input --- manifests/server/share.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/server/share.pp b/manifests/server/share.pp index d9eb331..4925247 100644 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -125,7 +125,7 @@ define samba::server::share($ensure = present, augeas { "${name}-valid_users": context => $context, - changes => $printable ? { + changes => $valid_users ? { default => "set ${target}/valid users '${valid_users}'", '' => "rm ${target}/valid users", }, -- cgit v1.2.3 From 4a7cf3fc220c3a3501b5d9df65011065828df98f Mon Sep 17 00:00:00 2001 From: jonoterc Date: Fri, 1 Nov 2013 03:05:15 -0400 Subject: correcting syntax used to apply "valid users" share configuration --- manifests/server/share.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'manifests') diff --git a/manifests/server/share.pp b/manifests/server/share.pp index 4925247..2c73f7b 100644 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -126,8 +126,8 @@ define samba::server::share($ensure = present, augeas { "${name}-valid_users": context => $context, changes => $valid_users ? { - default => "set ${target}/valid users '${valid_users}'", - '' => "rm ${target}/valid users", + default => "set \"${target}/valid users\" '${valid_users}'", + '' => "rm \"${target}/valid users\"", }, require => Augeas["${name}-section"], notify => Class['samba::server::service'] -- cgit v1.2.3 From 1a41738f8e7860a9993ec12d2e4daa85112d1239 Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Fri, 10 Jan 2014 18:17:06 -0500 Subject: clean up whitespace --- manifests/server/share.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/server/share.pp b/manifests/server/share.pp index 2c73f7b..b7274f9 100644 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -95,7 +95,7 @@ define samba::server::share($ensure = present, $read_only ? { true => "set \"${target}/read only\" yes", false => "set \"${target}/read only\" no", - default => "rm \"${target}/read only\"", + default => "rm \"${target}/read only\"", }, $public ? { true => "set \"${target}/public\" yes", -- cgit v1.2.3 From 7d0c9a893efae039252e754ed7750b4bcdf25f9a Mon Sep 17 00:00:00 2001 From: Lebedev Vadim Date: Sun, 31 Mar 2013 20:50:57 +0400 Subject: Dependencies were corrected --- manifests/server/ads.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'manifests') diff --git a/manifests/server/ads.pp b/manifests/server/ads.pp index 16be9ad..cadfee0 100644 --- a/manifests/server/ads.pp +++ b/manifests/server/ads.pp @@ -106,7 +106,7 @@ class samba::server::ads($ensure = present, 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': @@ -119,13 +119,13 @@ class samba::server::ads($ensure = present, 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'] ], } } -- cgit v1.2.3 From f321b3a1e0fbed665ef92776dffb1abb064a9f84 Mon Sep 17 00:00:00 2001 From: Vladislav Nazarenko Date: Fri, 17 Jan 2014 13:55:55 +0100 Subject: moved set_samba_option to own file an renamed it to samba::server::option --- manifests/server.pp | 22 +--------------------- manifests/server/ads.pp | 30 ++++++++++++++++-------------- manifests/server/option.pp | 19 +++++++++++++++++++ 3 files changed, 36 insertions(+), 35 deletions(-) create mode 100644 manifests/server/option.pp (limited to 'manifests') diff --git a/manifests/server.pp b/manifests/server.pp index 2e4c2d9..7003057 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -22,8 +22,7 @@ class samba::server($interfaces = '', notify => Class['samba::server::service'] } - - set_samba_option { + samba::server::option { 'interfaces': value => $interfaces; 'bind interfaces only': value => $bind_interfaces_only; 'security': value => $security; @@ -49,24 +48,5 @@ class samba::server($interfaces = '', mode => "0755", content => template("${module_name}/add_samba_user"), } -} - -define set_samba_option ( $value = '', $signal = 'samba::server::service' ) { - $incl = $samba::server::incl - $context = $samba::server::context - $target = $samba::server::target - - $changes = $value ? { - default => "set \"${target}/$name\" \"$value\"", - '' => "rm ${target}/$name", - } - augeas { "samba-$name": - incl => $incl, - lens => 'Samba.lns', - context => $context, - changes => $changes, - require => Augeas['global-section'], - notify => Class[$signal] - } } diff --git a/manifests/server/ads.pp b/manifests/server/ads.pp index cadfee0..3d44af6 100644 --- a/manifests/server/ads.pp +++ b/manifests/server/ads.pp @@ -49,21 +49,23 @@ class samba::server::ads($ensure = present, 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; diff --git a/manifests/server/option.pp b/manifests/server/option.pp new file mode 100644 index 0000000..36968fc --- /dev/null +++ b/manifests/server/option.pp @@ -0,0 +1,19 @@ +define samba::server::option ( $value = '' ) { + $incl = $samba::server::incl + $context = $samba::server::context + $target = $samba::server::target + + $changes = $value ? { + default => "set \"${target}/$name\" \"$value\"", + '' => "rm ${target}/$name", + } + + augeas { "samba-$name": + incl => $incl, + lens => 'Samba.lns', + context => $context, + changes => $changes, + require => Augeas['global-section'], + notify => Class['Samba::Server::Service'] + } +} \ No newline at end of file -- cgit v1.2.3 From fbe99d36b98a131df70923894896e01caae75ada Mon Sep 17 00:00:00 2001 From: Niklaus Giger Date: Sun, 19 Jan 2014 16:39:14 +0100 Subject: Support op_locks and write_lists --- manifests/server/share.pp | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'manifests') diff --git a/manifests/server/share.pp b/manifests/server/share.pp index b7274f9..2233d45 100644 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -12,8 +12,12 @@ define samba::server::share($ensure = present, $guest_ok = '', $guest_only = '', $path = '', + $op_locks = '', + $level2_oplocks = '', + $veto_oplock_files = '', $read_only = '', $public = '', + $write_list = '', $writable = '', $printable = '', $valid_users = '', @@ -132,5 +136,43 @@ define samba::server::share($ensure = present, require => Augeas["${name}-section"], notify => Class['samba::server::service'] } + + augeas { "${name}-op_locks": + context => $context, + changes => $op_locks ? { + default => "set \"${target}/oplocks\" '${op_locks}'", + '' => "rm \"${target}/oplocks\"", + }, + require => Augeas["${name}-section"], + notify => Class['samba::server::service'] + } + augeas { "${name}-level2_oplocks": + context => $context, + changes => $level2_oplocks ? { + default => "set \"${target}/level2 oplocks\" '${level2_oplocks}'", + '' => "rm \"${target}/level2 oplocks\"", + }, + require => Augeas["${name}-section"], + notify => Class['samba::server::service'] + } + augeas { "${name}-veto_oplock_files": + context => $context, + changes => $veto_oplock_files ? { + default => "set \"${target}/veto oplock files\" '${veto_oplock_files}'", + '' => "rm \"${target}/veto oplock files\"", + }, + require => Augeas["${name}-section"], + notify => Class['samba::server::service'] + } + augeas { "${name}-write_list": + context => $context, + changes => $write_list ? { + default => "set \"${target}/write list\" '${write_list}'", + '' => "rm \"${target}/write list\"", + }, + require => Augeas["${name}-section"], + notify => Class['samba::server::service'] + } + } } -- cgit v1.2.3 From e369e9879f82dc455b6cc5c116768f21606fab8b Mon Sep 17 00:00:00 2001 From: Adrian Joian Date: Sun, 26 Jan 2014 10:43:19 +0100 Subject: adding several minor options to server.pp and shares.pp --- manifests/server.pp | 14 ++++++++++++++ manifests/server/share.pp | 8 +++++++- 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/server.pp b/manifests/server.pp index 7003057..31589e0 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -3,6 +3,13 @@ class samba::server($interfaces = '', $server_string = '', $unix_password_sync = '', $workgroup = '', + $socket_options = '', + $deadtime = '', + $keepalive = '', + $load_printers = '', + $printing = '', + $printcap_name = '', + $disable_spoolss = '', $bind_interfaces_only = 'yes',) { include samba::server::install @@ -29,6 +36,13 @@ class samba::server($interfaces = '', 'server string': value => $server_string; 'unix password sync': value => $unix_password_sync; 'workgroup': value => $workgroup; + 'socket_options': value => $socket_options; + 'deadtime': value => $deadtime; + 'keepalive': value => $keepalive; + 'load_printers': value => $load_printers; + 'printing': value => $printing; + 'printcap_name': value => $printcap_name; + 'disable_spoolss': value => $disable_spoolss; } file {'check_samba_user': diff --git a/manifests/server/share.pp b/manifests/server/share.pp index 2233d45..b7d451f 100644 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -1,4 +1,5 @@ define samba::server::share($ensure = present, + $available = '', $browsable = '', $comment = '', $copy = '', @@ -22,7 +23,7 @@ define samba::server::share($ensure = present, $printable = '', $valid_users = '', ) { - + $incl = $samba::server::incl $context = $samba::server::context $target = "target[. = '${name}']" @@ -41,6 +42,11 @@ 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\"", + }, $browsable ? { true => "set \"${target}/browsable\" yes", false => "set \"${target}/browsable\" no", -- cgit v1.2.3 From ac0ec8147c582ec7c693ab3e310f941a3a28290a Mon Sep 17 00:00:00 2001 From: Jan Čapek Date: Thu, 14 Aug 2014 11:08:49 +0200 Subject: samba::server::service - added missing quotes - the quotes are required for future parser that doesn't automatically stringify any tokens --- manifests/server/service.pp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'manifests') diff --git a/manifests/server/service.pp b/manifests/server/service.pp index 6f26a6d..9ad5fb0 100644 --- a/manifests/server/service.pp +++ b/manifests/server/service.pp @@ -1,25 +1,25 @@ class samba::server::service ($ensure = running, $enable = true) { case $::osfamily { - Redhat: { $service_name = 'smb' } + 'Redhat': { $service_name = 'smb' } #On Debian family: Debian 7 => samba , Ubuntu => smbd #Others, I don't know, hope 'samba' will works - Debian: { + 'Debian': { case $::operatingsystem{ - Debian: { $service_name = 'samba' } - Ubuntu: { $service_name = 'smbd'} + 'Debian': { $service_name = 'samba' } + 'Ubuntu': { $service_name = 'smbd'} default: { $service_name='samba'} } } - Gentoo: { $service_name = 'samba' } - Archlinux: { $service_name = 'smbd' } + 'Gentoo': { $service_name = 'samba' } + 'Archlinux': { $service_name = 'smbd' } # Currently Gentoo has $::osfamily = "Linux". This should change in # Factor 1.7.0 , so # adding workaround. - Linux: { + 'Linux': { case $::operatingsystem { - Gentoo: { $service_name = 'samba' } + 'Gentoo': { $service_name = 'samba' } default: { fail("$::operatingsystem is not supported by this module.") } } } -- cgit v1.2.3 From 1790f0f59f824638f5baf77c1c899c7084ebe861 Mon Sep 17 00:00:00 2001 From: Jan Čapek Date: Thu, 14 Aug 2014 11:11:02 +0200 Subject: default statements ordering fixed for future parser - the default statements have to be always last otherwise they would get always picked by the future parser --- manifests/server/option.pp | 4 ++-- manifests/server/share.pp | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'manifests') diff --git a/manifests/server/option.pp b/manifests/server/option.pp index 36968fc..699985d 100644 --- a/manifests/server/option.pp +++ b/manifests/server/option.pp @@ -4,8 +4,8 @@ define samba::server::option ( $value = '' ) { $target = $samba::server::target $changes = $value ? { - default => "set \"${target}/$name\" \"$value\"", '' => "rm ${target}/$name", + default => "set \"${target}/$name\" \"$value\"", } augeas { "samba-$name": @@ -16,4 +16,4 @@ define samba::server::option ( $value = '' ) { require => Augeas['global-section'], notify => Class['Samba::Server::Service'] } -} \ No newline at end of file +} diff --git a/manifests/server/share.pp b/manifests/server/share.pp index b7d451f..b228818 100644 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -57,36 +57,36 @@ define samba::server::share($ensure = present, '' => "rm \"${target}/comment\"", }, $copy ? { - default => "set \"${target}/copy\" '${copy}'", '' => "rm \"${target}/copy\"", + default => "set \"${target}/copy\" '${copy}'", }, $create_mask ? { - default => "set \"${target}/create mask\" '${create_mask}'", '' => "rm \"${target}/create mask\"", + default => "set \"${target}/create mask\" '${create_mask}'", }, $directory_mask ? { - default => "set \"${target}/directory mask\" '${directory_mask}'", '' => "rm \"${target}/directory mask\"", + default => "set \"${target}/directory mask\" '${directory_mask}'", }, $force_create_mask ? { - default => "set \"${target}/force create mask\" '${force_create_mask}'", '' => "rm \"${target}/force create mask\"", + default => "set \"${target}/force create mask\" '${force_create_mask}'", }, $force_directory_mask ? { - default => "set \"${target}/force directory mask\" '${force_directory_mask}'", '' => "rm \"${target}/force directory mask\"", + default => "set \"${target}/force directory mask\" '${force_directory_mask}'", }, $force_group ? { - default => "set \"${target}/force group\" '${force_group}'", '' => "rm \"${target}/force group\"", + default => "set \"${target}/force group\" '${force_group}'", }, $force_user ? { - default => "set \"${target}/force user\" '${force_user}'", '' => "rm \"${target}/force user\"", + default => "set \"${target}/force user\" '${force_user}'", }, $guest_account ? { - default => "set \"${target}/guest account\" '${guest_account}'", '' => "rm \"${target}/guest account\"", + default => "set \"${target}/guest account\" '${guest_account}'", }, $guest_ok ? { true => "set \"${target}/guest ok\" yes", @@ -136,8 +136,8 @@ define samba::server::share($ensure = present, augeas { "${name}-valid_users": context => $context, changes => $valid_users ? { - default => "set \"${target}/valid users\" '${valid_users}'", '' => "rm \"${target}/valid users\"", + default => "set \"${target}/valid users\" '${valid_users}'", }, require => Augeas["${name}-section"], notify => Class['samba::server::service'] @@ -146,8 +146,8 @@ define samba::server::share($ensure = present, augeas { "${name}-op_locks": context => $context, changes => $op_locks ? { - default => "set \"${target}/oplocks\" '${op_locks}'", '' => "rm \"${target}/oplocks\"", + default => "set \"${target}/oplocks\" '${op_locks}'", }, require => Augeas["${name}-section"], notify => Class['samba::server::service'] @@ -155,8 +155,8 @@ define samba::server::share($ensure = present, augeas { "${name}-level2_oplocks": context => $context, changes => $level2_oplocks ? { - default => "set \"${target}/level2 oplocks\" '${level2_oplocks}'", '' => "rm \"${target}/level2 oplocks\"", + default => "set \"${target}/level2 oplocks\" '${level2_oplocks}'", }, require => Augeas["${name}-section"], notify => Class['samba::server::service'] @@ -164,8 +164,8 @@ define samba::server::share($ensure = present, augeas { "${name}-veto_oplock_files": context => $context, changes => $veto_oplock_files ? { - default => "set \"${target}/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'] @@ -173,8 +173,8 @@ define samba::server::share($ensure = present, augeas { "${name}-write_list": context => $context, changes => $write_list ? { - default => "set \"${target}/write list\" '${write_list}'", '' => "rm \"${target}/write list\"", + default => "set \"${target}/write list\" '${write_list}'", }, require => Augeas["${name}-section"], notify => Class['samba::server::service'] -- cgit v1.2.3 From 1ca68124d544ec6e222263400775f127e8111f46 Mon Sep 17 00:00:00 2001 From: "sauce@freenode" Date: Tue, 2 Dec 2014 15:57:30 -0500 Subject: Remove "Check winbind service" from log output I really like to keep log output very clean.. This seems unnecessary and it's sticking out like a sore thumb when doing "puppet agent -t" --- manifests/server/winbind.pp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'manifests') diff --git a/manifests/server/winbind.pp b/manifests/server/winbind.pp index 76136b9..b3fe1a9 100644 --- a/manifests/server/winbind.pp +++ b/manifests/server/winbind.pp @@ -1,10 +1,6 @@ class samba::server::winbind ($ensure = running, $enable = true) { $service_name = 'winbind' - notify { 'winbind-service': - message => 'Check winbind service', - } - service { $service_name: ensure => $ensure, hasstatus => true, -- cgit v1.2.3 From 1da5b2a495a5b5857accb6cf1d904c1ec68a0ebe Mon Sep 17 00:00:00 2001 From: Kai Stian Olstad Date: Wed, 3 Dec 2014 08:41:59 +0100 Subject: Added hide unreadable option to shares --- manifests/server/share.pp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'manifests') diff --git a/manifests/server/share.pp b/manifests/server/share.pp index b228818..eacd5b7 100644 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -12,6 +12,7 @@ define samba::server::share($ensure = present, $guest_account = '', $guest_ok = '', $guest_only = '', + $hide_unreadable = '', $path = '', $op_locks = '', $level2_oplocks = '', @@ -98,6 +99,11 @@ define samba::server::share($ensure = present, false => "set \"${target}/guest only\" no", default => "rm \"${target}/guest only\"", }, + $hide_unreadable ? { + true => "set \"${target}/hide unreadable\" yes", + false => "set \"${target}/hide unreadable\" no", + default => "rm \"${target}/hide unreadable\"", + }, $path ? { default => "set ${target}/path '${path}'", '' => "rm ${target}/path", -- cgit v1.2.3 From 30ba71f6c8316e7f8f2336949a4d40c2b00c5989 Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Sat, 11 Apr 2015 13:32:43 -0400 Subject: lint formatting --- manifests/server.pp | 8 ++++---- manifests/server/ads.pp | 14 +++++++------- manifests/server/option.pp | 6 +++--- manifests/server/service.pp | 10 +++++----- manifests/server/user.pp | 20 +++++++++----------- 5 files changed, 28 insertions(+), 30 deletions(-) (limited to 'manifests') diff --git a/manifests/server.pp b/manifests/server.pp index 31589e0..09a1b27 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -17,8 +17,8 @@ class samba::server($interfaces = '', include samba::server::service $incl = '/etc/samba/smb.conf' - $context = "/files/etc/samba/smb.conf" - $target = "target[. = 'global']" + $context = '/files/etc/samba/smb.conf' + $target = 'target[. = 'global']' augeas { 'global-section': incl => $incl, @@ -50,7 +50,7 @@ class samba::server($interfaces = '', path => '/sbin/check_samba_user', owner => root, group => root, - mode => "0755", + mode => '0755', content => template("${module_name}/check_samba_user"), } @@ -59,7 +59,7 @@ class samba::server($interfaces = '', path => '/sbin/add_samba_user', owner => root, group => root, - mode => "0755", + mode => '0755', content => template("${module_name}/add_samba_user"), } diff --git a/manifests/server/ads.pp b/manifests/server/ads.pp index 3d44af6..0b7e2a7 100644 --- a/manifests/server/ads.pp +++ b/manifests/server/ads.pp @@ -30,7 +30,7 @@ class samba::server::ads($ensure = present, default => 'krb5-user', } - if $osfamily == "RedHat" { + if $osfamily == 'RedHat' { if $operatingsystemrelease =~ /^6\./ { $winbind_package = 'samba-winbind' } else { @@ -82,10 +82,10 @@ class samba::server::ads($ensure = present, $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']", @@ -103,7 +103,7 @@ 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_package, $winbind_package, 'expect'], Augeas['samba-realm', 'samba-security', 'samba-winbind enum users', @@ -116,7 +116,7 @@ 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_package, $winbind_package, 'expect'], Augeas['samba-realm', 'samba-security', 'samba-winbind enum users', diff --git a/manifests/server/option.pp b/manifests/server/option.pp index 699985d..0b34edb 100644 --- a/manifests/server/option.pp +++ b/manifests/server/option.pp @@ -4,11 +4,11 @@ define samba::server::option ( $value = '' ) { $target = $samba::server::target $changes = $value ? { - '' => "rm ${target}/$name", - default => "set \"${target}/$name\" \"$value\"", + '' => "rm ${target}/${name}", + default => "set \"${target}/${name}\" \"${value}\"", } - augeas { "samba-$name": + augeas { "samba-${name}": incl => $incl, lens => 'Samba.lns', context => $context, diff --git a/manifests/server/service.pp b/manifests/server/service.pp index 9ad5fb0..fdd9104 100644 --- a/manifests/server/service.pp +++ b/manifests/server/service.pp @@ -7,8 +7,8 @@ class samba::server::service ($ensure = running, $enable = true) { 'Debian': { case $::operatingsystem{ 'Debian': { $service_name = 'samba' } - 'Ubuntu': { $service_name = 'smbd'} - default: { $service_name='samba'} + 'Ubuntu': { $service_name = 'smbd' } + default: { $service_name = 'samba' } } } 'Gentoo': { $service_name = 'samba' } @@ -20,13 +20,13 @@ class samba::server::service ($ensure = running, $enable = true) { 'Linux': { case $::operatingsystem { 'Gentoo': { $service_name = 'samba' } - default: { fail("$::operatingsystem is not supported by this module.") } + default: { fail("${::operatingsystem} is not supported by this module.") } } } - default: { fail("$::osfamily is not supported by this module.") } + default: { fail("${::osfamily} is not supported by this module.") } } - service { "$service_name" : + service { $service_name : ensure => $ensure, hasstatus => true, hasrestart => true, diff --git a/manifests/server/user.pp b/manifests/server/user.pp index 2cffe3b..e3d84cc 100644 --- a/manifests/server/user.pp +++ b/manifests/server/user.pp @@ -1,13 +1,11 @@ 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'] - } + $password, + $user_name = $name, +) { + 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'] + } } -- cgit v1.2.3 From 0b8794e9a6b01d018cf81f7500f07891e66c9220 Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Sat, 11 Apr 2015 15:51:50 -0400 Subject: fix syntax error --- manifests/server.pp | 2 +- manifests/server/ads.pp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'manifests') diff --git a/manifests/server.pp b/manifests/server.pp index 09a1b27..9eace3d 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -18,7 +18,7 @@ class samba::server($interfaces = '', $incl = '/etc/samba/smb.conf' $context = '/files/etc/samba/smb.conf' - $target = 'target[. = 'global']' + $target = 'target[. = "global"]' augeas { 'global-section': incl => $incl, diff --git a/manifests/server/ads.pp b/manifests/server/ads.pp index 0b7e2a7..781a6a9 100644 --- a/manifests/server/ads.pp +++ b/manifests/server/ads.pp @@ -82,10 +82,10 @@ class samba::server::ads($ensure = present, $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']", -- cgit v1.2.3 From b4e4a92ff4da6e34a8707ffb49c8ccf6ce316d2b Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Mon, 13 Apr 2015 13:28:45 -0400 Subject: more specs for samba::server use short hand for path to get specs passing --- manifests/server.pp | 6 ++---- spec/classes/samba__server_spec.rb | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) (limited to 'manifests') diff --git a/manifests/server.pp b/manifests/server.pp index 9eace3d..65ea660 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -45,18 +45,16 @@ class samba::server($interfaces = '', 'disable_spoolss': value => $disable_spoolss; } - file {'check_samba_user': + file {'/sbin/check_samba_user': # script checks to see if a samba account exists for a given user - path => '/sbin/check_samba_user', owner => root, group => root, mode => '0755', content => template("${module_name}/check_samba_user"), } - file {'add_samba_user': + file {'/sbin/add_samba_user': # script creates a new samba account for a given user and password - path => '/sbin/add_samba_user', owner => root, group => root, mode => '0755', diff --git a/spec/classes/samba__server_spec.rb b/spec/classes/samba__server_spec.rb index 89d994f..fce10bb 100644 --- a/spec/classes/samba__server_spec.rb +++ b/spec/classes/samba__server_spec.rb @@ -6,4 +6,21 @@ describe 'samba::server' do it { should contain_class('samba::server::install') } it { should contain_class('samba::server::config') } it { should contain_class('samba::server::service') } + + it { should contain_samba__server__option('interfaces') } + it { should contain_samba__server__option('bind interfaces only') } + it { should contain_samba__server__option('security') } + it { should contain_samba__server__option('server string') } + it { should contain_samba__server__option('unix password sync') } + it { should contain_samba__server__option('workgroup') } + it { should contain_samba__server__option('socket_options') } + it { should contain_samba__server__option('deadtime') } + it { should contain_samba__server__option('keepalive') } + it { should contain_samba__server__option('load_printers') } + it { should contain_samba__server__option('printing') } + it { should contain_samba__server__option('printcap_name') } + it { should contain_samba__server__option('disable_spoolss') } + + it { should contain_file('/sbin/check_samba_user').with_owner('root') } + it { should contain_file('/sbin/add_samba_user').with_owner('root') } end -- cgit v1.2.3 From e47f9cba618d9b1891836b3d9dfa6d7e09f40e49 Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Mon, 13 Apr 2015 15:14:00 -0400 Subject: document classes to satisfy linting --- manifests/init.pp | 4 +++- manifests/server.pp | 2 ++ manifests/server/ads.pp | 4 +--- manifests/server/config.pp | 2 ++ manifests/server/install.pp | 4 +++- manifests/server/option.pp | 2 ++ manifests/server/service.pp | 2 ++ manifests/server/share.pp | 2 ++ manifests/server/user.pp | 4 +++- manifests/server/winbind.pp | 2 ++ 10 files changed, 22 insertions(+), 6 deletions(-) (limited to 'manifests') diff --git a/manifests/init.pp b/manifests/init.pp index 8a914a4..4fbac9a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,7 +1,9 @@ +# == Class samba +# class samba { include samba::server if samba::server::security == 'ads' { include samba::server::ads } -} \ No newline at end of file +} diff --git a/manifests/server.pp b/manifests/server.pp index 65ea660..d4af927 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -1,3 +1,5 @@ +# == Class samba::server +# class samba::server($interfaces = '', $security = '', $server_string = '', diff --git a/manifests/server/ads.pp b/manifests/server/ads.pp index 781a6a9..1260fd1 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', diff --git a/manifests/server/config.pp b/manifests/server/config.pp index d51e432..1ecb490 100644 --- a/manifests/server/config.pp +++ b/manifests/server/config.pp @@ -1,3 +1,5 @@ +# == Class samba::server::config +# class samba::server::config { file { '/etc/samba': diff --git a/manifests/server/install.pp b/manifests/server/install.pp index 1454bfe..ec98a49 100644 --- a/manifests/server/install.pp +++ b/manifests/server/install.pp @@ -1,5 +1,7 @@ +# == Class samba::server::install +# class samba::server::install { package { 'samba': ensure => installed } -} \ No newline at end of file +} diff --git a/manifests/server/option.pp b/manifests/server/option.pp index 0b34edb..bf491e8 100644 --- a/manifests/server/option.pp +++ b/manifests/server/option.pp @@ -1,3 +1,5 @@ +# == Define samba::server::option +# define samba::server::option ( $value = '' ) { $incl = $samba::server::incl $context = $samba::server::context diff --git a/manifests/server/service.pp b/manifests/server/service.pp index fdd9104..2226497 100644 --- a/manifests/server/service.pp +++ b/manifests/server/service.pp @@ -25,6 +25,8 @@ class samba::server::service ($ensure = running, $enable = true) { } default: { fail("${::osfamily} is not supported by this module.") } } +# == Class samba::server::server +# service { $service_name : ensure => $ensure, diff --git a/manifests/server/share.pp b/manifests/server/share.pp index eacd5b7..d86e8c5 100644 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -1,3 +1,5 @@ +# == Define samba::server::share +# define samba::server::share($ensure = present, $available = '', $browsable = '', diff --git a/manifests/server/user.pp b/manifests/server/user.pp index e3d84cc..b8f2e61 100644 --- a/manifests/server/user.pp +++ b/manifests/server/user.pp @@ -1,4 +1,6 @@ -define samba::server::user( +# == Class samba::server::user +# +define samba::server::user ( $password, $user_name = $name, ) { diff --git a/manifests/server/winbind.pp b/manifests/server/winbind.pp index 76136b9..68128e5 100644 --- a/manifests/server/winbind.pp +++ b/manifests/server/winbind.pp @@ -1,3 +1,5 @@ +# == Class samba::server::winbind +# class samba::server::winbind ($ensure = running, $enable = true) { $service_name = 'winbind' -- cgit v1.2.3 From 8e332dafba6c6a1975d942801c98467723988fb7 Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Mon, 13 Apr 2015 15:14:36 -0400 Subject: extract os params to params class --- manifests/server/params.pp | 30 ++++++++++++++++++++++++++++++ manifests/server/service.pp | 32 ++++---------------------------- 2 files changed, 34 insertions(+), 28 deletions(-) create mode 100644 manifests/server/params.pp (limited to 'manifests') diff --git a/manifests/server/params.pp b/manifests/server/params.pp new file mode 100644 index 0000000..aa9674e --- /dev/null +++ b/manifests/server/params.pp @@ -0,0 +1,30 @@ +# == Class samba::server::params +# +class samba::server::params { + case $::osfamily { + 'Redhat': { $service_name = 'smb' } + + #On Debian family: Debian 7 => samba , Ubuntu => smbd + #Others, I don't know, hope 'samba' will works + 'Debian': { + case $::operatingsystem{ + 'Debian': { $service_name = 'samba' } + 'Ubuntu': { $service_name = 'smbd' } + default: { $service_name = 'samba' } + } + } + 'Gentoo': { $service_name = 'samba' } + 'Archlinux': { $service_name = 'smbd' } + + # Currently Gentoo has $::osfamily = "Linux". This should change in + # Factor 1.7.0 , so + # adding workaround. + 'Linux': { + case $::operatingsystem { + 'Gentoo': { $service_name = 'samba' } + default: { fail("${::operatingsystem} is not supported by this module.") } + } + } + default: { fail("${::osfamily} is not supported by this module.") } + } +} diff --git a/manifests/server/service.pp b/manifests/server/service.pp index 2226497..a8797de 100644 --- a/manifests/server/service.pp +++ b/manifests/server/service.pp @@ -1,32 +1,9 @@ -class samba::server::service ($ensure = running, $enable = true) { - case $::osfamily { - 'Redhat': { $service_name = 'smb' } - - #On Debian family: Debian 7 => samba , Ubuntu => smbd - #Others, I don't know, hope 'samba' will works - 'Debian': { - case $::operatingsystem{ - 'Debian': { $service_name = 'samba' } - 'Ubuntu': { $service_name = 'smbd' } - default: { $service_name = 'samba' } - } - } - 'Gentoo': { $service_name = 'samba' } - 'Archlinux': { $service_name = 'smbd' } - - # Currently Gentoo has $::osfamily = "Linux". This should change in - # Factor 1.7.0 , so - # adding workaround. - 'Linux': { - case $::operatingsystem { - 'Gentoo': { $service_name = 'samba' } - default: { fail("${::operatingsystem} is not supported by this module.") } - } - } - default: { fail("${::osfamily} is not supported by this module.") } - } # == Class samba::server::server # +class samba::server::service ( + $ensure = running, + $enable = true +) inherits samba::server::params { service { $service_name : ensure => $ensure, @@ -35,5 +12,4 @@ class samba::server::service ($ensure = running, $enable = true) { enable => $enable, require => Class['samba::server::config'] } - } -- cgit v1.2.3 From cd964f57431a55ee9e043570e77b3df157a97bd3 Mon Sep 17 00:00:00 2001 From: Timothy M Pollard Date: Mon, 13 Oct 2014 09:46:21 +1000 Subject: Adding follow symlinks and wide links to the options for shares --- manifests/server/share.pp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'manifests') diff --git a/manifests/server/share.pp b/manifests/server/share.pp index d86e8c5..e6f5504 100644 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -25,6 +25,8 @@ define samba::server::share($ensure = present, $writable = '', $printable = '', $valid_users = '', + $follow_symlinks = '', + $wide_links = '', ) { $incl = $samba::server::incl @@ -130,6 +132,16 @@ define samba::server::share($ensure = present, false => "set \"${target}/printable\" no", default => "rm \"${target}/printable\"", }, + $follow_symlinks ? { + true => "set \"${target}/follow symlinks\" yes", + false => "set \"${target}/follow symlinks\" no", + default => "rm \"${target}/follow symlinks\"", + }, + $wide_links ? { + true => "set \"${target}/wide links\" yes", + false => "set \"${target}/wide links\" no", + default => "rm \"${target}/wide links\"", + }, ] augeas { "${name}-changes": -- cgit v1.2.3 From 68ada05411e87629b0f0b435ca35e5f1e44353e3 Mon Sep 17 00:00:00 2001 From: Jan Kanis Date: Tue, 14 Jul 2015 11:42:25 +0200 Subject: Add kernel oplocks and pam password change options --- manifests/server.pp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'manifests') diff --git a/manifests/server.pp b/manifests/server.pp index d4af927..2b261f9 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -12,6 +12,8 @@ class samba::server($interfaces = '', $printing = '', $printcap_name = '', $disable_spoolss = '', + $kernel_oplocks = '', + $pam_password_change = '', $bind_interfaces_only = 'yes',) { include samba::server::install @@ -45,6 +47,8 @@ class samba::server($interfaces = '', 'printing': value => $printing; 'printcap_name': value => $printcap_name; 'disable_spoolss': value => $disable_spoolss; + 'kernel oplocks': value => $kernel_oplocks; + 'pam password change': value => $pam_password_change, } file {'/sbin/check_samba_user': -- cgit v1.2.3 From 647254932e323869e972310fcbb1c1ecda6d4d3e Mon Sep 17 00:00:00 2001 From: Jan Kanis Date: Wed, 22 Jul 2015 10:53:52 +0200 Subject: Add 'os level' and 'preferred master' global options --- manifests/server.pp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/server.pp b/manifests/server.pp index 2b261f9..1c58f28 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -14,6 +14,8 @@ class samba::server($interfaces = '', $disable_spoolss = '', $kernel_oplocks = '', $pam_password_change = '', + $os_level = '', + $preferred_master = '', $bind_interfaces_only = 'yes',) { include samba::server::install @@ -48,7 +50,9 @@ class samba::server($interfaces = '', 'printcap_name': value => $printcap_name; 'disable_spoolss': value => $disable_spoolss; 'kernel oplocks': value => $kernel_oplocks; - 'pam password change': value => $pam_password_change, + 'pam password change': value => $pam_password_change; + 'os level': value => $os_level; + 'preferred master': value => $preferred_master; } file {'/sbin/check_samba_user': -- cgit v1.2.3 From ea83802dcbe0f3fafc37907e6e9a57179b122234 Mon Sep 17 00:00:00 2001 From: Jan Kanis Date: Wed, 22 Jul 2015 11:33:05 +0200 Subject: Also start nmbd on ubuntu (and other systems that split out smbd and nmbd service configuration files) --- manifests/server/params.pp | 6 ++++-- manifests/server/service.pp | 10 ++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'manifests') diff --git a/manifests/server/params.pp b/manifests/server/params.pp index aa9674e..5f2fc3e 100644 --- a/manifests/server/params.pp +++ b/manifests/server/params.pp @@ -9,12 +9,14 @@ class samba::server::params { 'Debian': { case $::operatingsystem{ 'Debian': { $service_name = 'samba' } - 'Ubuntu': { $service_name = 'smbd' } + 'Ubuntu': { $service_name = 'smbd' + $nmbd_name = 'nmbd' } default: { $service_name = 'samba' } } } 'Gentoo': { $service_name = 'samba' } - 'Archlinux': { $service_name = 'smbd' } + 'Archlinux': { $service_name = 'smbd' + $nmbd_name = 'nmbd' } # Currently Gentoo has $::osfamily = "Linux". This should change in # Factor 1.7.0 , so diff --git a/manifests/server/service.pp b/manifests/server/service.pp index a8797de..1a9fbe7 100644 --- a/manifests/server/service.pp +++ b/manifests/server/service.pp @@ -12,4 +12,14 @@ class samba::server::service ( enable => $enable, require => Class['samba::server::config'] } + + if $nmbd_name != undef { + service { $nmbd_name : + ensure => $ensure, + hasrestart => false, + enable => $enable, + require => Class['samba::server::config'], + } + } + } -- cgit v1.2.3 From 5c4eed67cf85f2ee4a652d21f649228d80f7c262 Mon Sep 17 00:00:00 2001 From: Jan Kanis Date: Thu, 30 Jul 2015 12:41:20 +0200 Subject: Add 'netbios name' option --- manifests/server.pp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'manifests') diff --git a/manifests/server.pp b/manifests/server.pp index 1c58f28..641384f 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -4,6 +4,7 @@ class samba::server($interfaces = '', $security = '', $server_string = '', $unix_password_sync = '', + $netbios_name = '', $workgroup = '', $socket_options = '', $deadtime = '', @@ -41,6 +42,7 @@ class samba::server($interfaces = '', 'security': value => $security; 'server string': value => $server_string; 'unix password sync': value => $unix_password_sync; + 'netbios name': value => $netbios_name; 'workgroup': value => $workgroup; 'socket_options': value => $socket_options; 'deadtime': value => $deadtime; -- cgit v1.2.3 From 539f0af2699d4286146884f9a9ba0983b966779a Mon Sep 17 00:00:00 2001 From: Jan Kanis Date: Mon, 17 Aug 2015 16:34:33 +0200 Subject: Add 'map acl inherit', 'store dos attributes' and 'strict allocate' options --- manifests/server/share.pp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'manifests') diff --git a/manifests/server/share.pp b/manifests/server/share.pp index e6f5504..5a6667c 100644 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -27,6 +27,9 @@ define samba::server::share($ensure = present, $valid_users = '', $follow_symlinks = '', $wide_links = '', + $map_acl_inherit = '', + $store_dos_attributes = '', + $strict_allocate = '', ) { $incl = $samba::server::incl @@ -142,6 +145,21 @@ define samba::server::share($ensure = present, false => "set \"${target}/wide links\" no", default => "rm \"${target}/wide links\"", }, + $map_acl_inherit ? { + true => "set \"${target}/map acl inherit\" yes", + false => "set \"${target}/map acl inherit\" no", + default => "rm \"${target}/map acl inherit\"", + }, + $store_dos_attributes ? { + true => "set \"${target}/store dos attributes\" yes", + false => "set \"${target}/store dos attributes\" no", + default => "rm \"${target}/store dos attributes\"", + }, + $strict_allocate ? { + true => "set \"${target}/strict allocate\" yes", + false => "set \"${target}/strict allocate\" no", + default => "rm \"${target}/strict allocate\"", + }, ] augeas { "${name}-changes": -- cgit v1.2.3 From 6352e26538d0fe33badce2eb54c9f0ba66af310f Mon Sep 17 00:00:00 2001 From: Iban Nieto Date: Tue, 6 Oct 2015 11:24:30 +0200 Subject: Add 'map to guest' global option --- README.md | 3 +++ manifests/server.pp | 2 ++ 2 files changed, 5 insertions(+) (limited to 'manifests') diff --git a/README.md b/README.md index a0595f7..468a783 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,9 @@ Most configuration options are optional. 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request +## Module modified +Added "map to guest" in samba::server + ## License This module is released under the MIT license: diff --git a/manifests/server.pp b/manifests/server.pp index 641384f..4120154 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -12,6 +12,7 @@ class samba::server($interfaces = '', $load_printers = '', $printing = '', $printcap_name = '', + $map_to_guest = '', $disable_spoolss = '', $kernel_oplocks = '', $pam_password_change = '', @@ -50,6 +51,7 @@ class samba::server($interfaces = '', 'load_printers': value => $load_printers; 'printing': value => $printing; 'printcap_name': value => $printcap_name; + 'map to guest': value => $map_to_guest; 'disable_spoolss': value => $disable_spoolss; 'kernel oplocks': value => $kernel_oplocks; 'pam password change': value => $pam_password_change; -- cgit v1.2.3 From b2d5840ca565eb79672b152bcd74a24127929808 Mon Sep 17 00:00:00 2001 From: David Sheldon Date: Fri, 9 Oct 2015 17:31:30 +0100 Subject: Fix "load printers" setting name Samba doesn't seem to understand "load_printers", it's "load printers" instead. Ignoring unknown parameter "load_printers" --- manifests/server.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/server.pp b/manifests/server.pp index 4120154..b4e9955 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -48,7 +48,7 @@ class samba::server($interfaces = '', 'socket_options': value => $socket_options; 'deadtime': value => $deadtime; 'keepalive': value => $keepalive; - 'load_printers': value => $load_printers; + 'load printers': value => $load_printers; 'printing': value => $printing; 'printcap_name': value => $printcap_name; 'map to guest': value => $map_to_guest; -- cgit v1.2.3 From 47c02047d9924bf2a62d8f099e28e6366b60b5fb Mon Sep 17 00:00:00 2001 From: David Sheldon Date: Fri, 9 Oct 2015 18:25:29 +0100 Subject: Fix the rest of the options with _ in Having read man smb.conf, none of these options should have _ in the resulting option name. --- manifests/server.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'manifests') diff --git a/manifests/server.pp b/manifests/server.pp index b4e9955..a73ad99 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -45,14 +45,14 @@ class samba::server($interfaces = '', 'unix password sync': value => $unix_password_sync; 'netbios name': value => $netbios_name; 'workgroup': value => $workgroup; - 'socket_options': value => $socket_options; + 'socket options': value => $socket_options; 'deadtime': value => $deadtime; 'keepalive': value => $keepalive; 'load printers': value => $load_printers; 'printing': value => $printing; - 'printcap_name': value => $printcap_name; + 'printcap name': value => $printcap_name; 'map to guest': value => $map_to_guest; - 'disable_spoolss': value => $disable_spoolss; + 'disable spoolss': value => $disable_spoolss; 'kernel oplocks': value => $kernel_oplocks; 'pam password change': value => $pam_password_change; 'os level': value => $os_level; -- cgit v1.2.3 From 95cb988077ec2f5c79e4a2bd67d4b252fdc8739c Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Mon, 7 Dec 2015 16:17:25 -0500 Subject: clean whitespace --- manifests/server.pp | 1 - spec/fixtures/manifests/init.pp | 2 -- 2 files changed, 3 deletions(-) (limited to 'manifests') diff --git a/manifests/server.pp b/manifests/server.pp index a73ad99..550659c 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -74,5 +74,4 @@ class samba::server($interfaces = '', mode => '0755', content => template("${module_name}/add_samba_user"), } - } diff --git a/spec/fixtures/manifests/init.pp b/spec/fixtures/manifests/init.pp index 0f64360..94005cd 100644 --- a/spec/fixtures/manifests/init.pp +++ b/spec/fixtures/manifests/init.pp @@ -1,7 +1,5 @@ node 'testhost.example.com' { - include samba::server - } node default {} -- cgit v1.2.3 From f2e9e5f32e0af0d83d8380b94decc522ff87fa30 Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Mon, 7 Dec 2015 16:18:42 -0500 Subject: Add support for Debian 8. closes #47 --- manifests/server/params.pp | 12 +++++++----- spec/acceptance/nodesets/debian-81-x64.yml | 12 ++++++++++++ spec/classes/samba__server__service_spec.rb | 14 ++++++++++++-- 3 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 spec/acceptance/nodesets/debian-81-x64.yml (limited to 'manifests') diff --git a/manifests/server/params.pp b/manifests/server/params.pp index 5f2fc3e..ba0c1be 100644 --- a/manifests/server/params.pp +++ b/manifests/server/params.pp @@ -3,12 +3,14 @@ class samba::server::params { case $::osfamily { 'Redhat': { $service_name = 'smb' } - - #On Debian family: Debian 7 => samba , Ubuntu => smbd - #Others, I don't know, hope 'samba' will works 'Debian': { - case $::operatingsystem{ - 'Debian': { $service_name = 'samba' } + case $::operatingsystem { + 'Debian': { + case $::operatingsystemmajrelease { + '8' : { $service_name = 'smbd' } + default: { $service_name = 'samba' } + } + } 'Ubuntu': { $service_name = 'smbd' $nmbd_name = 'nmbd' } default: { $service_name = 'samba' } diff --git a/spec/acceptance/nodesets/debian-81-x64.yml b/spec/acceptance/nodesets/debian-81-x64.yml new file mode 100644 index 0000000..3b1d8aa --- /dev/null +++ b/spec/acceptance/nodesets/debian-81-x64.yml @@ -0,0 +1,12 @@ +HOSTS: + debian-81-x64: + roles: + - master + platform: debian-8-amd64 + box: lazyfrosch/debian-8-jessie-amd64-puppet + box_url: https://vagrantcloud.com/lazyfrosch/boxes/debian-8-jessie-amd64-puppet + hypervisor: vagrant + +CONFIG: + log_level: verbose + type: foss diff --git a/spec/classes/samba__server__service_spec.rb b/spec/classes/samba__server__service_spec.rb index ada7f21..4352ec2 100644 --- a/spec/classes/samba__server__service_spec.rb +++ b/spec/classes/samba__server__service_spec.rb @@ -7,8 +7,18 @@ describe 'samba::server::service' do it { should contain_service('samba').with_require('Class[Samba::Server::Config]') } context 'Debian' do - let(:facts) {{ :osfamily => 'Debian', :operatingsystem => 'Debian' }} - it { should contain_service('samba') } + context 'wheezy' do + let(:facts) {{ :osfamily => 'Debian', + :operatingsystem => 'Debian', + :operatingsystemmajrelease => '7' }} + it { should contain_service('samba') } + end + context 'jessie' do + let(:facts) {{ :osfamily => 'Debian', + :operatingsystem => 'Debian', + :operatingsystemmajrelease => '8' }} + it { should contain_service('smbd') } + end end context 'Ubuntu' do -- cgit v1.2.3 From 41660aec9c7e8a43f029b31d6f1ef9374487dac9 Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Mon, 7 Dec 2015 18:32:33 -0500 Subject: lint! --- Rakefile | 2 +- manifests/server/ads.pp | 6 ++-- manifests/server/config.pp | 10 +++--- manifests/server/params.pp | 12 ++++--- manifests/server/service.pp | 17 +++++---- manifests/server/share.pp | 84 ++++++++++++++++----------------------------- manifests/server/winbind.pp | 11 +++--- 7 files changed, 58 insertions(+), 84 deletions(-) (limited to 'manifests') diff --git a/Rakefile b/Rakefile index 908647f..92f4578 100644 --- a/Rakefile +++ b/Rakefile @@ -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 , 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'] } - } -- cgit v1.2.3 From d4f5516542de1ecd16b8b773c8ca2844922a41e2 Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Mon, 7 Dec 2015 18:52:58 -0500 Subject: lint ads --- manifests/server/ads.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'manifests') diff --git a/manifests/server/ads.pp b/manifests/server/ads.pp index 7b496fe..757d091 100644 --- a/manifests/server/ads.pp +++ b/manifests/server/ads.pp @@ -76,9 +76,9 @@ 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', -- cgit v1.2.3 From 9d63c7be3fa57e4af93c787f8b740658ec14f1f6 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Fri, 22 Jan 2016 15:32:28 +0000 Subject: Remove check_samba_user and add_samba_user scripts Call the pdbedit commands directly from samba::server::user instead --- manifests/server.pp | 16 ---------------- manifests/server/user.pp | 8 +++++--- spec/classes/samba__server_spec.rb | 3 --- spec/defines/samba__server__user_spec.rb | 14 ++++++++++++++ templates/add_samba_user | 16 ---------------- templates/check_samba_user | 16 ---------------- 6 files changed, 19 insertions(+), 54 deletions(-) create mode 100644 spec/defines/samba__server__user_spec.rb delete mode 100644 templates/add_samba_user delete mode 100644 templates/check_samba_user (limited to 'manifests') diff --git a/manifests/server.pp b/manifests/server.pp index 550659c..8a5853c 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -58,20 +58,4 @@ class samba::server($interfaces = '', 'os level': value => $os_level; 'preferred master': value => $preferred_master; } - - file {'/sbin/check_samba_user': - # script checks to see if a samba account exists for a given user - owner => root, - group => root, - mode => '0755', - content => template("${module_name}/check_samba_user"), - } - - file {'/sbin/add_samba_user': - # script creates a new samba account for a given user and password - owner => root, - group => root, - mode => '0755', - content => template("${module_name}/add_samba_user"), - } } diff --git a/manifests/server/user.pp b/manifests/server/user.pp index b8f2e61..d10a602 100644 --- a/manifests/server/user.pp +++ b/manifests/server/user.pp @@ -4,10 +4,12 @@ define samba::server::user ( $password, $user_name = $name, ) { + require ::samba::server::install + exec { "add smb account for ${user_name}": - command => "/sbin/add_samba_user '${user_name}' '${password}'" , - unless => "/sbin/check_samba_user '${user_name}'" , + command => "/bin/echo -e '${password}\\n${password}\\n' | /usr/bin/pdbedit --password-from-stdin -a '${user_name}'", + unless => "/usr/bin/pdbedit '${user_name}'", require => [ User[$user_name] ], - notify => Class['samba::server::service'] + notify => Class['samba::server::service'] #TODO: Is this really required?? } } diff --git a/spec/classes/samba__server_spec.rb b/spec/classes/samba__server_spec.rb index 69fa0ec..dbf840a 100644 --- a/spec/classes/samba__server_spec.rb +++ b/spec/classes/samba__server_spec.rb @@ -20,7 +20,4 @@ describe 'samba::server' do it { should contain_samba__server__option('printing') } it { should contain_samba__server__option('printcap name') } it { should contain_samba__server__option('disable spoolss') } - - it { should contain_file('/sbin/check_samba_user').with_owner('root') } - it { should contain_file('/sbin/add_samba_user').with_owner('root') } end diff --git a/spec/defines/samba__server__user_spec.rb b/spec/defines/samba__server__user_spec.rb new file mode 100644 index 0000000..c7ae00c --- /dev/null +++ b/spec/defines/samba__server__user_spec.rb @@ -0,0 +1,14 @@ +require 'spec_helper' + +describe 'samba::server::user', :type => :define do + let(:title) { 'test_user' } + let(:params) {{ :password => 'secret' }} + + it { is_expected.to contain_samba__server__user('test_user') } + it { is_expected.to contain_exec('add smb account for test_user').with( + :command => '/bin/echo -e \'secret\nsecret\n\' | /usr/bin/pdbedit --password-from-stdin -a \'test_user\'', + :unless => '/usr/bin/pdbedit \'test_user\'', + :require => 'User[test_user]', + :notify => 'Class[Samba::Server::Service]' + ) } +end diff --git a/templates/add_samba_user b/templates/add_samba_user deleted file mode 100644 index cc1d56b..0000000 --- a/templates/add_samba_user +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -# This script adds a samba account for a given user and password -# call as: -# > add_samba_user "USERNAME" "PASSWORD" - -/bin/echo -e "$2\n$2\n" | sudo /usr/bin/pdbedit -a "$1" -t 1>/dev/null -results=$? - -if [ $results = 0 ]; then - echo "added samba account for '$1'" -else - echo "could not add samba account for '$1'" -fi - -exit $results diff --git a/templates/check_samba_user b/templates/check_samba_user deleted file mode 100644 index 431c3c4..0000000 --- a/templates/check_samba_user +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -# This script checks to see if a given user account exists on samba -# if so, it returns 0 -# otherwise it returns 1 - -sudo /usr/bin/pdbedit -L | egrep -q "^$1:" -exists=$? - -if [ $exists = 0 ]; then - echo "'$1' is a samba user" -else - echo "no samba account matching '$1'" -fi - -exit $exists -- cgit v1.2.3 From 9c84eb144deeeb67001e9cc95101f48d77e43501 Mon Sep 17 00:00:00 2001 From: Christian Döring Date: Tue, 2 Feb 2016 17:45:52 +0100 Subject: Enable global guest-account setting --- manifests/server.pp | 4 +++- manifests/server/share.pp | 5 ----- 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'manifests') diff --git a/manifests/server.pp b/manifests/server.pp index 8a5853c..027471c 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -12,7 +12,8 @@ class samba::server($interfaces = '', $load_printers = '', $printing = '', $printcap_name = '', - $map_to_guest = '', + $map_to_guest = 'Never', + $guest_account = '', $disable_spoolss = '', $kernel_oplocks = '', $pam_password_change = '', @@ -52,6 +53,7 @@ class samba::server($interfaces = '', 'printing': value => $printing; 'printcap name': value => $printcap_name; 'map to guest': value => $map_to_guest; + 'guest account': value => $guest_account; 'disable spoolss': value => $disable_spoolss; 'kernel oplocks': value => $kernel_oplocks; 'pam password change': value => $pam_password_change; diff --git a/manifests/server/share.pp b/manifests/server/share.pp index c682055..e5e23f1 100644 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -11,7 +11,6 @@ define samba::server::share($ensure = present, $force_directory_mask = '', $force_group = '', $force_user = '', - $guest_account = '', $guest_ok = '', $guest_only = '', $hide_unreadable = '', @@ -94,10 +93,6 @@ define samba::server::share($ensure = present, '' => "rm \"${target}/force user\"", default => "set \"${target}/force user\" '${force_user}'", }, - $guest_account ? { - '' => "rm \"${target}/guest account\"", - default => "set \"${target}/guest account\" '${guest_account}'", - }, $guest_ok ? { true => "set \"${target}/guest ok\" yes", false => "set \"${target}/guest ok\" no", -- cgit v1.2.3 From 430054887e7894690524bcd7d4a629280f18479f Mon Sep 17 00:00:00 2001 From: Christian Döring Date: Fri, 5 Feb 2016 17:23:32 +0100 Subject: Convert tabs to spaces to comply style-guide --- manifests/server.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'manifests') diff --git a/manifests/server.pp b/manifests/server.pp index 027471c..8d6a214 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -13,7 +13,7 @@ class samba::server($interfaces = '', $printing = '', $printcap_name = '', $map_to_guest = 'Never', - $guest_account = '', + $guest_account = '', $disable_spoolss = '', $kernel_oplocks = '', $pam_password_change = '', @@ -53,7 +53,7 @@ class samba::server($interfaces = '', 'printing': value => $printing; 'printcap name': value => $printcap_name; 'map to guest': value => $map_to_guest; - 'guest account': value => $guest_account; + 'guest account': value => $guest_account; 'disable spoolss': value => $disable_spoolss; 'kernel oplocks': value => $kernel_oplocks; 'pam password change': value => $pam_password_change; -- cgit v1.2.3 From d8c319fb569977afcd54f72ddfe3c6aa2b61a9f1 Mon Sep 17 00:00:00 2001 From: Jirgn Mssnr Date: Tue, 9 Feb 2016 17:51:12 +0100 Subject: added share config via hiera --- manifests/server.pp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/server.pp b/manifests/server.pp index 8d6a214..59d5d51 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -19,7 +19,8 @@ class samba::server($interfaces = '', $pam_password_change = '', $os_level = '', $preferred_master = '', - $bind_interfaces_only = 'yes',) { + $bind_interfaces_only = 'yes', + $shares = {},) { include samba::server::install include samba::server::config @@ -60,4 +61,6 @@ class samba::server($interfaces = '', 'os level': value => $os_level; 'preferred master': value => $preferred_master; } + + create_resources(samba::server::share, $shares) } -- cgit v1.2.3 From 2e78387a530b2c987bf3c26712f30a641abd2081 Mon Sep 17 00:00:00 2001 From: Daniel Sung Date: Mon, 15 Feb 2016 15:50:43 +0000 Subject: Fix name of 'force directory mode' option Previously the class was setting a value for 'force directory mask' which was getting ignored by samba. Running testparm -v would give: Unknown parameter encountered: "force directory mask" Ignoring unknown parameter "force directory mask" The correct option name is 'force directory mode' according to the man page. --- manifests/server/share.pp | 8 ++++---- spec/acceptance/basic_samba_spec.rb | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'manifests') diff --git a/manifests/server/share.pp b/manifests/server/share.pp index e5e23f1..7f8191c 100644 --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -8,7 +8,7 @@ define samba::server::share($ensure = present, $create_mask = '', $directory_mask = '', $force_create_mask = '', - $force_directory_mask = '', + $force_directory_mode = '', $force_group = '', $force_user = '', $guest_ok = '', @@ -81,9 +81,9 @@ define samba::server::share($ensure = present, '' => "rm \"${target}/force create mask\"", default => "set \"${target}/force create mask\" '${force_create_mask}'", }, - $force_directory_mask ? { - '' => "rm \"${target}/force directory mask\"", - default => "set \"${target}/force directory mask\" '${force_directory_mask}'", + $force_directory_mode ? { + '' => "rm \"${target}/force directory mode\"", + default => "set \"${target}/force directory mode\" '${force_directory_mode}'", }, $force_group ? { '' => "rm \"${target}/force group\"", diff --git a/spec/acceptance/basic_samba_spec.rb b/spec/acceptance/basic_samba_spec.rb index 0dd6ac6..76e7f9f 100644 --- a/spec/acceptance/basic_samba_spec.rb +++ b/spec/acceptance/basic_samba_spec.rb @@ -18,7 +18,7 @@ describe 'basic samba' do create_mask => 0777, force_create_mask => 0777, directory_mask => 0777, - force_directory_mask => 0777, + force_directory_mode => 0777, force_group => 'group', force_user => 'user', } -- cgit v1.2.3 From 0385193ee30c830e81be53b1d7484ae27cdd2b85 Mon Sep 17 00:00:00 2001 From: Jirgn Mssnr Date: Mon, 22 Feb 2016 13:47:19 +0100 Subject: added param users for use in hiera added tests for samba::server::users --- manifests/server.pp | 4 +++- spec/classes/samba__server_spec.rb | 27 +++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) (limited to 'manifests') diff --git a/manifests/server.pp b/manifests/server.pp index 59d5d51..cbc61a9 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -20,7 +20,8 @@ class samba::server($interfaces = '', $os_level = '', $preferred_master = '', $bind_interfaces_only = 'yes', - $shares = {},) { + $shares = {}, + $users = {}, ) { include samba::server::install include samba::server::config @@ -63,4 +64,5 @@ class samba::server($interfaces = '', } create_resources(samba::server::share, $shares) + create_resources(samba::server::user, $users) } diff --git a/spec/classes/samba__server_spec.rb b/spec/classes/samba__server_spec.rb index d19fe6a..46c5b15 100644 --- a/spec/classes/samba__server_spec.rb +++ b/spec/classes/samba__server_spec.rb @@ -36,8 +36,31 @@ describe 'samba::server' do } } }} - it { should contain_samba__server__share( 'testShare' ) } - it { should contain_samba__server__share( 'testShare2' ) } + it { + should contain_samba__server__share( 'testShare' ).with({ + 'path' => '/path/to/some/share', + 'browsable' => true, + 'writable' => true, + 'guest_ok' => true, + 'guest_only' => true, + }) + } + it { should contain_samba__server__share( 'testShare2' ).with_path('/some/other/path') } + end + + context 'with hiera users hash' do + let(:params) {{ + 'users' => { + 'testUser' => { + 'password' => 'testpass01' + }, + 'testUser2' => { + 'password' => 'testpass02' + } + } + }} + it { should contain_samba__server__user( 'testUser' ).with_password('testpass01') } + it { should contain_samba__server__user( 'testUser2' ).with_password('testpass02') } end end -- cgit v1.2.3 From 87232b5f0aef4d25e1438dc11000d7c1be205842 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 5 Mar 2016 21:56:29 +0100 Subject: Add option hide dot files to share. --- manifests/server/share.pp | 6 ++++++ 1 file changed, 6 insertions(+) mode change 100644 => 100755 manifests/server/share.pp (limited to 'manifests') diff --git a/manifests/server/share.pp b/manifests/server/share.pp old mode 100644 new mode 100755 index 7f8191c..b0690bb --- a/manifests/server/share.pp +++ b/manifests/server/share.pp @@ -29,6 +29,7 @@ define samba::server::share($ensure = present, $map_acl_inherit = '', $store_dos_attributes = '', $strict_allocate = '', + $hide_dot_files = '', ) { $incl = $samba::server::incl @@ -177,6 +178,11 @@ define samba::server::share($ensure = present, '' => "rm \"${target}/write list\"", default => "set \"${target}/write list\" '${write_list}'", }, + $hide_dot_files ? { + true => "set \"${target}/hide dot files\" yes", + false => "set \"${target}/hide dot files\" no", + default => "rm \"${target}/hide dot files\"", + }, ] augeas { "${name}-changes": -- cgit v1.2.3