diff options
-rw-r--r-- | manifests/init.pp | 3 | ||||
-rw-r--r-- | manifests/server.pp | 13 | ||||
-rw-r--r-- | manifests/server/config.pp | 11 | ||||
-rw-r--r-- | manifests/server/install.pp | 7 | ||||
-rw-r--r-- | manifests/server/service.pp | 11 | ||||
-rw-r--r-- | manifests/share.pp | 26 |
6 files changed, 71 insertions, 0 deletions
diff --git a/manifests/init.pp b/manifests/init.pp new file mode 100644 index 0000000..7498ede --- /dev/null +++ b/manifests/init.pp @@ -0,0 +1,3 @@ +class samba { + include samba::server +}
\ No newline at end of file diff --git a/manifests/server.pp b/manifests/server.pp new file mode 100644 index 0000000..172b132 --- /dev/null +++ b/manifests/server.pp @@ -0,0 +1,13 @@ +class samba::server($workgroup = PCCH) { + include samba::server::install + include samba::server::config + include samba::server::service + + augeas { global: + context => "/files/etc/samba/smb.conf", + changes => [ + "set target[. = 'global']/workgroup $workgroup" + ], + require => Class["samba::server::config"] + } +}
\ No newline at end of file diff --git a/manifests/server/config.pp b/manifests/server/config.pp new file mode 100644 index 0000000..e9b1ed9 --- /dev/null +++ b/manifests/server/config.pp @@ -0,0 +1,11 @@ +class samba::server::config { + + file { "/etc/samba/smb.conf": + ensure => $ensure, + owner => root, + group => root, + require => Class["samba::server::install"], + notify => Class["samba::server::service"] + } + +}
\ No newline at end of file diff --git a/manifests/server/install.pp b/manifests/server/install.pp new file mode 100644 index 0000000..6514626 --- /dev/null +++ b/manifests/server/install.pp @@ -0,0 +1,7 @@ +class samba::server::install { + + package { "samba": + ensure => installed, + } + +}
\ No newline at end of file diff --git a/manifests/server/service.pp b/manifests/server/service.pp new file mode 100644 index 0000000..8984841 --- /dev/null +++ b/manifests/server/service.pp @@ -0,0 +1,11 @@ +class samba::server::service { + + service { "smbd": + ensure => running, + hasstatus => true, + hasrestart => true, + enable => true, + require => Class["samba::server::config"] + } + +}
\ No newline at end of file diff --git a/manifests/share.pp b/manifests/share.pp new file mode 100644 index 0000000..7690fbc --- /dev/null +++ b/manifests/share.pp @@ -0,0 +1,26 @@ +define samba::share($ensure=present, + $description, + $path, + $browsable, + $mask, + $guestok="no", + $readonly="no" ) { + + $share = $name + $context = "/files/etc/samba/smb.conf" + $target = "target[. = '${name}']" + + augeas { "${share}": + context => $context, + changes => $ensure ? { + present => [ "set ${target} ${name}", + "set ${target}/comment ${description}", + "set ${target}/path ${path}", + "set ${target}/browsable ${browsable}", + "set ${target}/mask ${mask}" ], + default => ["rm ${target} ${name}"], + }, + require => Class["samba::server::config"] + } + +} |