add ubuntu support
[integration/packaging/puppet-opendaylight.git] / manifests / init.pp
1 # == Class: opendaylight
2 #
3 # OpenDaylight SDN Controller
4 #
5 # === Parameters
6 # [*default_features*]
7 #   Features that should normally be installed by default, but can be overridden.
8 # [*extra_features*]
9 #   List of features to install in addition to the default ones.
10 # [*odl_rest_port *]
11 #   Port for ODL northbound REST interface to listen on.
12 # [*install_method *]
13 #   How to install OpenDaylight. Current options are "rpm" and "tarball", default is RPM.
14 # [*tarball_url*]
15 #   If installing from a tarball, use this one. Defaults to latest ODL.
16 # [*unitfile_url*]
17 #   OpenDaylight .service file to use for tarball installs. Defaults to one used by ODL RPM.
18 #
19 class opendaylight (
20   $default_features = $::opendaylight::params::default_features,
21   $extra_features = $::opendaylight::params::extra_features,
22   $install_method = $::opendaylight::params::install_method,
23   $tarball_url = $::opendaylight::params::tarball_url,
24   $unitfile_url = $::opendaylight::params::unitfile_url,
25   $odl_rest_port = $::opendaylight::params::odl_rest_port,
26 ) inherits ::opendaylight::params {
27
28   # Validate OS family
29   case $::osfamily {
30     Debian: {
31         warning('Debian family is valid but only installable with tarball method')
32     }
33     RedHat: {}
34     default: {
35         fail("Unsupported OS family: ${::osfamily}")
36     }
37   }
38
39   # Validate OS
40   case $::operatingsystem {
41     centos, redhat: {
42       if $::operatingsystemmajrelease != 7 {
43         # RHEL/CentOS versions < 7 not supported as they lack systemd
44         fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemmajrelease}")
45       }
46     }
47     fedora: {
48       # Fedora distros < 20 are EOL as of Jan 6th 2015
49       if ! ($::operatingsystemmajrelease in [20, 21]) {
50         fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemmajrelease}")
51       }
52     }
53     Ubuntu: {
54       if $::operatingsystemmajrelease != '14.04' {
55         # Only tested on 14.04
56         fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemmajrelease}")
57       }
58     }
59     default: {
60       fail("Unsupported OS: ${::operatingsystem}")
61     }
62   }
63   # Build full list of features to install
64   $features = union($default_features, $extra_features)
65
66   class { '::opendaylight::install': } ->
67   class { '::opendaylight::config': odl_rest_port => $odl_rest_port} ~>
68   class { '::opendaylight::service': } ->
69   Class['::opendaylight']
70 }