diff options
author | Marc <mmontgomery@pcch.org> | 2012-08-17 09:39:52 -0400 |
---|---|---|
committer | Marc <mmontgomery@pcch.org> | 2012-08-17 09:39:52 -0400 |
commit | e78a712e1152fd8981b87a6bb035777d0256f268 (patch) | |
tree | e832d32239fbbbec9d5cb584b836a5917cf788ce | |
download | puppet-samba-e78a712e1152fd8981b87a6bb035777d0256f268.tar.gz puppet-samba-e78a712e1152fd8981b87a6bb035777d0256f268.tar.bz2 |
initial commit current progress creates shares in ensures samba is installed and daemon is running, can add shares to smb.conf, and can set global variables
-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"] + } + +} |