Allow full customization of ODL RPM repo
[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 #   Repo URL to install ODL RPM from, in .repo baseurl format.
17 # [*deb_repo*]
18 #   OpenDaylight Launchpad PPA repo to install .deb from (ppa:odl-team/boron,
19 #   ppa:odl-team/carbon, ...).
20 # [*log_levels*]
21 #   Custom OpenDaylight logger verbosity configuration (TRACE, DEBUG, INFO, WARN, ERROR).
22 # [*enable_ha*]
23 #   Enable or disable ODL OVSDB HA Clustering. Valid: true or false.
24 #   Default: false.
25 # [*ha_node_ips*]
26 #   Array of IPs for each node in the HA cluster.
27 # [*ha_db_modules*]
28 #   Hash of modules and Yang namespaces to create database shards.  Defaults to
29 #   { 'default' => false }.  "default" module does not need a namespace.
30 # [*vpp_routing_node*]
31 #   Sets routing node for VPP deployments. Defaults to ''.
32 # [*java_opts*]
33 #   Sets Java options for ODL in a string format. Defaults to '-Djava.net.preferIPv4Stack=true'.
34 # [*manage_repositories*]
35 #   (Boolean) Should this module manage the apt or yum repositories for the
36 #   package installation.
37 #   Defaults to true
38 # [*log_max_size*]
39 #   Maxium size of OpenDaylight's log file.
40 # [*log_max_rollover*]
41 #   Maxium number of OpenDaylight log rollovers to keep.
42 # [*snat_mechanism*]
43 #   Sets the mechanism to be used for SNAT (conntrack, controller)
44 #
45 # === Deprecated Parameters
46 #
47 # [*ha_node_index*]
48 #   Index of ha_node_ips for this node.
49 #
50 class opendaylight (
51   $default_features    = $::opendaylight::params::default_features,
52   $extra_features      = $::opendaylight::params::extra_features,
53   $odl_rest_port       = $::opendaylight::params::odl_rest_port,
54   $odl_bind_ip         = $::opendaylight::params::odl_bind_ip,
55   $rpm_repo            = $::opendaylight::params::rpm_repo,
56   $deb_repo            = $::opendaylight::params::deb_repo,
57   $log_levels          = $::opendaylight::params::log_levels,
58   $enable_ha           = $::opendaylight::params::enable_ha,
59   $ha_node_ips         = $::opendaylight::params::ha_node_ips,
60   $ha_node_index       = $::opendaylight::params::ha_node_index,
61   $ha_db_modules       = $::opendaylight::params::ha_db_modules,
62   $vpp_routing_node    = $::opendaylight::params::vpp_routing_node,
63   $java_opts           = $::opendaylight::params::java_opts,
64   $manage_repositories = $::opendaylight::params::manage_repositories,
65   $username            = $::opendaylight::params::username,
66   $password            = $::opendaylight::params::password,
67   $log_max_size        = $::opendaylight::params::log_max_size,
68   $log_max_rollover    = $::opendaylight::params::log_max_rollover,
69   $snat_mechanism      = $::opendaylight::params::snat_mechanism
70 ) inherits ::opendaylight::params {
71
72   # Validate OS family
73   case $::osfamily {
74     'RedHat': {}
75     'Debian': {
76         warning('Debian has limited support, is less stable, less tested.')
77     }
78     default: {
79         fail("Unsupported OS family: ${::osfamily}")
80     }
81   }
82
83   # Validate OS
84   case $::operatingsystem {
85     centos, redhat: {
86       if $::operatingsystemmajrelease != '7' {
87         # RHEL/CentOS versions < 7 not supported as they lack systemd
88         fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemmajrelease}")
89       }
90     }
91     fedora: {
92       # Fedora distros < 24 are EOL as of 2016-12-20
93       # https://fedoraproject.org/wiki/End_of_life
94       if $::operatingsystemmajrelease < '24' {
95         fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemmajrelease}")
96       } else {
97         warning('Fedora is not as well tested as CentOS.')
98       }
99     }
100     ubuntu: {
101       if $::operatingsystemrelease < '16.04' {
102         # Only tested on 16.04
103         fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemrelease}")
104       }
105     }
106     default: {
107       fail("Unsupported OS: ${::operatingsystem}")
108     }
109   }
110   # Build full list of features to install
111   $features = union($default_features, $extra_features)
112
113   class { '::opendaylight::install': }
114   -> class { '::opendaylight::config': }
115   ~> class { '::opendaylight::service': }
116   -> Class['::opendaylight']
117 }