add ubuntu support
[integration/packaging/puppet-opendaylight.git] / manifests / init.pp
index 43b159705af766a9af3c2af8f949f82015310cb2..e1ce45600255b374f7ebf8f113b5adbc244953ab 100644 (file)
@@ -3,37 +3,68 @@
 # OpenDaylight SDN Controller
 #
 # === Parameters
-#
-# [*sample_parameter*]
-#   Explanation of what this parameter affects and what it defaults to.
+# [*default_features*]
+#   Features that should normally be installed by default, but can be overridden.
+# [*extra_features*]
+#   List of features to install in addition to the default ones.
+# [*odl_rest_port *]
+#   Port for ODL northbound REST interface to listen on.
+# [*install_method *]
+#   How to install OpenDaylight. Current options are "rpm" and "tarball", default is RPM.
+# [*tarball_url*]
+#   If installing from a tarball, use this one. Defaults to latest ODL.
+# [*unitfile_url*]
+#   OpenDaylight .service file to use for tarball installs. Defaults to one used by ODL RPM.
 #
 class opendaylight (
-  $package_name = $::opendaylight::params::package_name,
-  $service_name = $::opendaylight::params::service_name,
+  $default_features = $::opendaylight::params::default_features,
+  $extra_features = $::opendaylight::params::extra_features,
+  $install_method = $::opendaylight::params::install_method,
+  $tarball_url = $::opendaylight::params::tarball_url,
+  $unitfile_url = $::opendaylight::params::unitfile_url,
+  $odl_rest_port = $::opendaylight::params::odl_rest_port,
 ) inherits ::opendaylight::params {
 
+  # Validate OS family
+  case $::osfamily {
+    Debian: {
+        warning('Debian family is valid but only installable with tarball method')
+    }
+    RedHat: {}
+    default: {
+        fail("Unsupported OS family: ${::osfamily}")
+    }
+  }
+
   # Validate OS
   case $::operatingsystem {
     centos, redhat: {
-      if $::lsbmajdistrelease != 7 {
+      if $::operatingsystemmajrelease != 7 {
         # RHEL/CentOS versions < 7 not supported as they lack systemd
-        fail("Unsupported OS: ${::operatingsystem} ${::lsbmajdistrelease}")
+        fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemmajrelease}")
       }
     }
     fedora: {
-      # TODO: Only need >= 15 for systemd if move to tarball or full yum repo
-      if ! ($::lsbmajdistrelease in [19, 20, 21]) {
-        # Fedora versions < 19 can't be build on Copr, >21 don't exist
-        fail("Unsupported OS: ${::operatingsystem} ${::lsbmajdistrelease}")
+      # Fedora distros < 20 are EOL as of Jan 6th 2015
+      if ! ($::operatingsystemmajrelease in [20, 21]) {
+        fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemmajrelease}")
+      }
+    }
+    Ubuntu: {
+      if $::operatingsystemmajrelease != '14.04' {
+        # Only tested on 14.04
+        fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemmajrelease}")
       }
     }
     default: {
       fail("Unsupported OS: ${::operatingsystem}")
     }
   }
+  # Build full list of features to install
+  $features = union($default_features, $extra_features)
 
   class { '::opendaylight::install': } ->
-  class { '::opendaylight::config': } ~>
+  class { '::opendaylight::config': odl_rest_port => $odl_rest_port} ~>
   class { '::opendaylight::service': } ->
   Class['::opendaylight']
 }