aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jahn <ajjahn@gmail.com>2015-04-13 15:14:36 -0400
committerAdam Jahn <ajjahn@gmail.com>2015-04-13 15:14:36 -0400
commit8e332dafba6c6a1975d942801c98467723988fb7 (patch)
tree69238d8af21d7a2ad9246d19df78a37c912da4c2
parente47f9cba618d9b1891836b3d9dfa6d7e09f40e49 (diff)
downloadpuppet-samba-8e332dafba6c6a1975d942801c98467723988fb7.tar.gz
puppet-samba-8e332dafba6c6a1975d942801c98467723988fb7.tar.bz2
extract os params to params class
-rw-r--r--manifests/server/params.pp30
-rw-r--r--manifests/server/service.pp32
2 files changed, 34 insertions, 28 deletions
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 <http://projects.puppetlabs.com/issues/17029>, 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 <http://projects.puppetlabs.com/issues/17029>, 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']
}
-
}