From 0ac18d517632fdf59f83e7184b8dd35a99909c30 Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Fri, 24 Aug 2012 11:32:00 -0400 Subject: var isn't needed in server config, but it's nice to require the config dir, and permisions --- manifests/server/config.pp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'manifests') diff --git a/manifests/server/config.pp b/manifests/server/config.pp index e9b1ed9..9699857 100644 --- a/manifests/server/config.pp +++ b/manifests/server/config.pp @@ -1,11 +1,19 @@ class samba::server::config { - + + file { "/etc/samba": + ensure => directory, + owner => "root", + group => "root", + mode => 0755, + } + file { "/etc/samba/smb.conf": - ensure => $ensure, - owner => root, - group => root, - require => Class["samba::server::install"], + ensure => present, + owner => "root", + group => "root", + mode => 0644, + require => [File["/etc/samba"], Class["samba::server::install"]], notify => Class["samba::server::service"] } - -} \ No newline at end of file + +} -- cgit v1.2.3 From 7afd35d5e78ab39ad0f237873991ec6b9cef4c18 Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Fri, 24 Aug 2012 11:44:36 -0400 Subject: use name instead of share for consistency --- manifests/share.pp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'manifests') diff --git a/manifests/share.pp b/manifests/share.pp index 7690fbc..30ba0b2 100644 --- a/manifests/share.pp +++ b/manifests/share.pp @@ -6,11 +6,10 @@ define samba::share($ensure=present, $guestok="no", $readonly="no" ) { - $share = $name $context = "/files/etc/samba/smb.conf" $target = "target[. = '${name}']" - augeas { "${share}": + augeas { "${name}": context => $context, changes => $ensure ? { present => [ "set ${target} ${name}", -- cgit v1.2.3 From b27da34ecdd31184b3123b8f023bee24155446f1 Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Fri, 24 Aug 2012 11:46:52 -0400 Subject: cleanup indentation --- manifests/server.pp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'manifests') diff --git a/manifests/server.pp b/manifests/server.pp index 172b132..811013d 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -4,10 +4,10 @@ class samba::server($workgroup = PCCH) { include samba::server::service augeas { global: - context => "/files/etc/samba/smb.conf", - changes => [ - "set target[. = 'global']/workgroup $workgroup" - ], - require => Class["samba::server::config"] - } + context => "/files/etc/samba/smb.conf", + changes => [ + "set target[. = 'global']/workgroup $workgroup" + ], + require => Class["samba::server::config"] + } } \ No newline at end of file -- cgit v1.2.3 From 9e16baf39baffc185f57df0227b0d3a314e50990 Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Fri, 24 Aug 2012 11:57:15 -0400 Subject: ensure global section exists in case of empty config file --- manifests/server.pp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'manifests') diff --git a/manifests/server.pp b/manifests/server.pp index 811013d..ce6f10c 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -2,12 +2,15 @@ class samba::server($workgroup = PCCH) { include samba::server::install include samba::server::config include samba::server::service - + + $target = "target[. = 'global']" + augeas { global: context => "/files/etc/samba/smb.conf", changes => [ - "set target[. = 'global']/workgroup $workgroup" - ], + "set ${target} global", + "set ${target}/workgroup $workgroup" + ], require => Class["samba::server::config"] } -} \ No newline at end of file +} -- cgit v1.2.3 From 7c10f82e1bf5e0d79283efdcffe154f3411486ee Mon Sep 17 00:00:00 2001 From: Adam Jahn Date: Fri, 24 Aug 2012 12:27:26 -0400 Subject: workgroup should be optional and generic --- manifests/server.pp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'manifests') diff --git a/manifests/server.pp b/manifests/server.pp index ce6f10c..6addab8 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -1,16 +1,24 @@ -class samba::server($workgroup = PCCH) { +class samba::server($workgroup = '') { include samba::server::install include samba::server::config include samba::server::service + $context = "/files/etc/samba/smb.conf" $target = "target[. = 'global']" - augeas { global: - context => "/files/etc/samba/smb.conf", - changes => [ - "set ${target} global", - "set ${target}/workgroup $workgroup" - ], + augeas { 'global-section': + context => $context, + changes => "set ${target} global", require => Class["samba::server::config"] } + + augeas { 'global-workgroup': + context => $context, + changes => $workgroup ? { + default => "set ${target}/workgroup $workgroup", + '' => "rm ${target}/workgroup", + }, + require => Augeas['global-section'], + } + } -- cgit v1.2.3