]> gitweb.fluxo.info Git - puppet-avahi.git/commitdiff
Adding params class
authorMichael Stahnke <stahnma@puppetlabs.com>
Fri, 19 Oct 2012 01:34:22 +0000 (18:34 -0700)
committerMichael Stahnke <stahnma@puppetlabs.com>
Fri, 19 Oct 2012 01:34:22 +0000 (18:34 -0700)
Signed-off-by: Michael Stahnke <stahnma@puppetlabs.com>
manifests/init.pp
manifests/params.pp [new file with mode: 0644]

index a9c71627fdf31433cf63ef935914c67af8b7c2b8..16980a4ebd5df2f8a3adb85bea412e346ddefe87 100644 (file)
 # Copyright 2012 Michael Stahnke
 
 
-class avahi {
+class avahi inherits avahi::params {
 
-    $avahi_pkgs = [ 'avahi', 'avahi-tools', 'nss-mdns' ]
-
-   package { $avahi_pkgs:
+#    $avahi_pkgs = [ 'avahi', 'avahi-tools', 'nss-mdns' ]
+#     $avahi_main    = 'avahi'
+#         $avahi_daemon  = 'avahi-daemon'
+#             $avahi_tools   = 'avahi_tools'
+#                 $avahi_mdns    = 'nss-mdns'
+# $avahi_dbus = 'dbus' or 'messagebus'
+#
+   package { $avahi_main:
+     ensure  => installed,
+   }
+   package { $avahi_tools:
+     ensure  => installed,
+     require => Package[$avahi_main]
+   }
+   package { $avahi_mdns:
      ensure  => installed,
+     require => Package[$avahi_main]
    }
 
-   service { 'avahi-daemon':
+   service { $avahi_daemon:
      ensure    => running,
      enable    => true,
      hasstatus => true,
-     require   => Service['messagebus'],
+     require   => Service[$avahi_dbus],
    }
 
-   service { 'messagebus':
+   service { $avahi_dbus:
      ensure  => running,
      enable  => true,
-     require => Package[$avahi_pkgs],
+     require => Package[$avahi_mdns],
    }
 
   ini_setting { "avahi-${::hostname}":
@@ -49,7 +62,8 @@ class avahi {
     setting => 'host-name',
     key_val_separator => '=',
     value   => $::hostname,
-    notify  => Service['avahi-daemon'],
+    notify  => Service[$avahi_daemon],
+    require => Package[$avahi_mdns],
   }
 
 }
diff --git a/manifests/params.pp b/manifests/params.pp
new file mode 100644 (file)
index 0000000..61a1753
--- /dev/null
@@ -0,0 +1,18 @@
+class avahi::params {
+
+  if $::osfamily == 'RedHat' {
+    $avahi_main    = 'avahi'
+    $avahi_daemon  = 'avahi-daemon'
+    $avahi_tools   = 'avahi-tools'
+    $avahi_mdns    = 'nss-mdns'
+    $avahi_dbus    = 'messagebus'
+  }
+  elsif $::osfamily == 'Debian' {
+    $avahi_main    = 'avahi'
+    $avahi_daemon  = 'avahi-daemon'
+    $avahi_tools   = 'avahi-tools'
+    $avahi_mdns    = 'nss-mdns'
+    $avahi_dbus    = 'dbus'
+  }
+
+}