Add boolean flag to disable the PaxOsgi appender
[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 and southbound OVSDB/OpenFlow 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/carbon,
19 #   ppa:odl-team/nitrogen, ...).
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 ''.
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 # [*log_rollover_fileindex*]
43 #   File index to use for OpenDaylight log rollovers
44 #   Defaults to 'min'.
45 #   Other possible values: 'max', 'nomax'
46 #   see https://logging.apache.org/log4j/2.x/manual/appenders.html#FileAppender for more info
47 # [*log_pattern*]
48 #   Pattern to use for logging
49 # [*enable_paxosgi_logger*]
50 #   (Boolean) Enables the PaxOsgi appender in the logging capabilities.
51 #   Note that enabling this will also require to modify the log pattern to
52 #   make use of the added capabilities.
53 #   Defaults to false
54 # [*snat_mechanism*]
55 #   Sets the mechanism to be used for SNAT (conntrack, controller)
56 # [*enable_tls*]
57 #   (Boolean) Enables TLS for REST and OpenFlow/OVSDB with OpenDaylight.
58 #   Defaults to false
59 # [*tls_keystore_password*]
60 #   TLS keystore password.  Required when enabling TLS.
61 # [*tls_trusted_certs*]
62 #   An array of cert files to be added to OpenDaylight's trusted keystore.
63 #   Optional.  Defaults to None.
64 # [*tls_key_file*]
65 #   Full path to a private key file to be used for OpenDaylight.
66 #   Optional.  Defaults to undef.  Requires setting tls_cert_file.
67 # [*tls_cert_file*]
68 #   Full path to a public certificate file to be used for OpenDaylight.
69 #   Optional.  Defaults to undef.  Requires setting tls_key_file.
70 # [*tls_ca_cert_file*]
71 #   Full path to a public CA authority certificate file which signed
72 #   OpenDaylight's certificate.  Not needed if ODL certificate is self-signed.
73 #   Optional.  Defaults to undef.
74 # [*log_mechanism*]
75 #   Sets logging mechanism for karaf logs
76 # [*inherit_dscp_marking*]
77 #   Sets tos option to enable QoS DSCP marking
78 #   Defaults to false
79 # [*stats_polling_enabled*]
80 #   Enables statistics polling of OpenFlow entities like table, groups.
81 #   Defaults to false
82 # [*inactivity_probe*]
83 #   Time in millseconds before an inactivity probe is sent via OVSDB
84 #   to OVS. Defaults to undef.
85 #
86 # === Deprecated Parameters
87 #
88 # [*ha_node_index*]
89 #   Index of ha_node_ips for this node.
90 #
91 class opendaylight (
92   $default_features       = $::opendaylight::params::default_features,
93   $extra_features         = $::opendaylight::params::extra_features,
94   $odl_rest_port          = $::opendaylight::params::odl_rest_port,
95   $odl_bind_ip            = $::opendaylight::params::odl_bind_ip,
96   $rpm_repo               = $::opendaylight::params::rpm_repo,
97   $deb_repo               = $::opendaylight::params::deb_repo,
98   $log_levels             = $::opendaylight::params::log_levels,
99   $enable_ha              = $::opendaylight::params::enable_ha,
100   $ha_node_ips            = $::opendaylight::params::ha_node_ips,
101   $ha_node_index          = $::opendaylight::params::ha_node_index,
102   $java_opts              = $::opendaylight::params::java_opts,
103   $ha_db_modules          = $::opendaylight::params::ha_db_modules,
104   $vpp_routing_node       = $::opendaylight::params::vpp_routing_node,
105   $manage_repositories    = $::opendaylight::params::manage_repositories,
106   $username               = $::opendaylight::params::username,
107   $password               = $::opendaylight::params::password,
108   $log_max_size           = $::opendaylight::params::log_max_size,
109   $log_max_rollover       = $::opendaylight::params::log_max_rollover,
110   $log_rollover_fileindex = $::opendaylight::params::log_rollover_fileindex,
111   $log_pattern            = $::opendaylight::params::log_pattern,
112   $enable_paxosgi_logger  = $::opendaylight::params::enable_paxosgi_logger,
113   $snat_mechanism         = $::opendaylight::params::snat_mechanism,
114   $enable_tls             = $::opendaylight::params::enable_tls,
115   $tls_keystore_password  = $::opendaylight::params::tls_keystore_password,
116   $tls_trusted_certs      = $::opendaylight::params::tls_trusted_certs,
117   $tls_key_file           = $::opendaylight::params::tls_key_file,
118   $tls_cert_file          = $::opendaylight::params::tls_cert_file,
119   $tls_ca_cert_file       = $::opendaylight::params::tls_ca_cert_file,
120   $log_mechanism          = $::opendaylight::params::log_mechanism,
121   $inherit_dscp_marking   = $::opendaylight::params::inherit_dscp_marking,
122   $stats_polling_enabled  = $::opendaylight::params::stats_polling_enabled,
123   $inactivity_probe       = $::opendaylight::params::inactivity_probe,
124 ) inherits ::opendaylight::params {
125
126   # Validate OS family
127   case $::osfamily {
128     'RedHat': {}
129     'Debian': {
130         warning('Debian has limited support, is less stable, less tested.')
131     }
132     default: {
133         fail("Unsupported OS family: ${::osfamily}")
134     }
135   }
136
137   # Validate OS
138   case $::operatingsystem {
139     centos, redhat: {
140       if $::operatingsystemmajrelease != '7' {
141         # RHEL/CentOS versions < 7 not supported as they lack systemd
142         fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemmajrelease}")
143       }
144     }
145     fedora: {
146       # Fedora distros < 24 are EOL as of 2016-12-20
147       # https://fedoraproject.org/wiki/End_of_life
148       if $::operatingsystemmajrelease < '24' {
149         fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemmajrelease}")
150       } else {
151         warning('Fedora is not as well tested as CentOS.')
152       }
153     }
154     ubuntu: {
155       if $::operatingsystemrelease < '16.04' {
156         # Only tested on 16.04
157         fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemrelease}")
158       }
159     }
160     default: {
161       fail("Unsupported OS: ${::operatingsystem}")
162     }
163   }
164   # Build full list of features to install
165   $features = union($default_features, $extra_features)
166
167   if $opendaylight::odl_bind_ip =~ Stdlib::Compat::Ipv6 {
168     $enable_ipv6 = true
169     $java_options = strip(join(union(['-Djava.net.preferIPv6Addresses=true'], any2array($opendaylight::java_opts)), ' '))
170   }
171   else {
172     $enable_ipv6 = false
173     $java_options = strip(join(union(['-Djava.net.preferIPv4Stack=true'], any2array($opendaylight::java_opts)), ' '))
174   }
175
176   class { '::opendaylight::install': }
177   -> class { '::opendaylight::config': }
178   ~> class { '::opendaylight::service': }
179   -> class { '::opendaylight::post_config': }
180   -> Class['::opendaylight']
181 }