Add carbon .deb to puppet-opendaylight
[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
8 #   overridden.
9 # [*extra_features*]
10 #   List of features to install in addition to the default ones.
11 # [*odl_rest_port *]
12 #   Port for ODL northbound REST interface to listen on.
13 # [*odl_bind_ip *]
14 #   IP for ODL northbound REST interface to bind to.
15 # [*rpm_repo*]
16 #   OpenDaylight CentOS CBS repo to install RPM from (opendaylight-4-testing,
17 #   opendaylight-40-release, ...).
18 # [*deb_repo*]
19 #   OpenDaylight Launchpad PPA repo to install .deb from (ppa:odl-team/boron,
20 #   ppa:odl-team/carbon, ...).
21 # [*log_levels*]
22 #   Custom OpenDaylight logger verbosity configuration (TRACE, DEBUG, INFO, WARN, ERROR).
23 # [*enable_ha*]
24 #   Enable or disable ODL OVSDB HA Clustering. Valid: true or false.
25 #   Default: false.
26 # [*ha_node_ips*]
27 #   Array of IPs for each node in the HA cluster.
28 # [*ha_node_index*]
29 #   Index of ha_node_ips for this node.
30 # [*security_group_mode*]
31 #   Sets the mode to use for security groups (stateful, learn, stateless, transparent)
32 # [*vpp_routing_node*]
33 #   Sets routing node for VPP deployments. Defaults to ''.
34 # [*java_opts*]
35 #   Sets Java options for ODL in a string format. Defaults to '-Djava.net.preferIPv4Stack=true'.
36 # [*manage_repositories*]
37 #   (Boolean) Should this module manage the apt or yum repositories for the
38 #   package installation.
39 #   Defaults to true
40 #
41 class opendaylight (
42   $default_features    = $::opendaylight::params::default_features,
43   $extra_features      = $::opendaylight::params::extra_features,
44   $odl_rest_port       = $::opendaylight::params::odl_rest_port,
45   $odl_bind_ip         = $::opendaylight::params::odl_bind_ip,
46   $rpm_repo            = $::opendaylight::params::rpm_repo,
47   $deb_repo            = $::opendaylight::params::deb_repo,
48   $log_levels          = $::opendaylight::params::log_levels,
49   $enable_ha           = $::opendaylight::params::enable_ha,
50   $ha_node_ips         = $::opendaylight::params::ha_node_ips,
51   $ha_node_index       = $::opendaylight::params::ha_node_index,
52   $security_group_mode = $::opendaylight::params::security_group_mode,
53   $vpp_routing_node    = $::opendaylight::params::vpp_routing_node,
54   $java_opts           = $::opendaylight::params::java_opts,
55   $manage_repositories = $::opendaylight::params::manage_repositories,
56   $username            = $::opendaylight::params::username,
57   $password            = $::opendaylight::params::password,
58 ) inherits ::opendaylight::params {
59
60   # Validate OS family
61   case $::osfamily {
62     'RedHat': {}
63     'Debian': {
64         warning('Debian has limited support, is less stable, less tested.')
65     }
66     default: {
67         fail("Unsupported OS family: ${::osfamily}")
68     }
69   }
70
71   # Validate OS
72   case $::operatingsystem {
73     centos, redhat: {
74       if $::operatingsystemmajrelease != '7' {
75         # RHEL/CentOS versions < 7 not supported as they lack systemd
76         fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemmajrelease}")
77       } elsif defined('$::operatingsystemrelease') {
78           if (versioncmp($::operatingsystemrelease, '7.3') < 0) {
79             # Versions < 7.3 do not support stateful security groups
80             $stateful_unsupported = true
81           }
82         }
83     }
84     fedora: {
85       # Fedora distros < 24 are EOL as of 2016-12-20
86       # https://fedoraproject.org/wiki/End_of_life
87       if $::operatingsystemmajrelease < '24' {
88         fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemmajrelease}")
89       } else {
90         warning('Fedora is not as well tested as CentOS.')
91       }
92     }
93     ubuntu: {
94       if $::operatingsystemrelease < '16.04' {
95         # Only tested on 16.04
96         fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemrelease}")
97       }
98     }
99     default: {
100       fail("Unsupported OS: ${::operatingsystem}")
101     }
102   }
103   # Build full list of features to install
104   $features = union($default_features, $extra_features)
105
106   class { '::opendaylight::install': }
107   -> class { '::opendaylight::config': }
108   ~> class { '::opendaylight::service': }
109   -> Class['::opendaylight']
110 }