1 #Copyright 2015 Open Platform for NFV Project, Inc. and its contributors
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 #Provides HA or non-HA setup for OpenStack Controller with ODL integration
16 #Mandatory common and HA variables are needed to setup each Controller
17 #ha_flag set to true will provide OpenStack HA of the following services:
18 #rabbitmq, galera mariadb, keystone, glance, nova, cinder, horizon, neutron
19 #includes all sub-services of those features (i.e. neutron-server, neutron-lg-agent, etc)
21 class opnfv::controller_networker {
22 if $odl_rest_port == '' { $odl_rest_port= '8081'}
23 if ($odl_flag != '') and str2bool($odl_flag) {
24 $ml2_mech_drivers = ['opendaylight']
25 $this_agent = 'opendaylight'
27 $ml2_mech_drivers = ['openvswitch','l2population']
31 ##Mandatory Common variables
32 if $admin_email == '' { fail('admin_email is empty') }
34 ##Most users will only care about a single user/password for all services
35 ##so lets create one variable that can be used instead of separate usernames/passwords
36 if !$single_username { $single_username = 'octopus' }
37 if !$single_password { $single_password = 'octopus' }
39 if !$keystone_admin_token { $keystone_admin_token = $single_password }
40 if !$neutron_metadata_shared_secret { $neutron_metadata_shared_secret = $single_password }
41 if !$mysql_root_password { $mysql_root_password = $single_password }
42 if !$admin_password { $admin_password = $single_password }
44 ##Check for HA, if not leave old functionality alone
45 if $ha_flag and str2bool($ha_flag) {
46 ##Mandatory HA variables
47 if !$controllers_ip_array { fail('controllers_ip_array is empty') }
48 $controllers_ip_array_str = $controllers_ip_array
49 $controllers_ip_array = split($controllers_ip_array, ',')
50 if !$controllers_hostnames_array { fail('controllers_hostnames_array is empty') }
51 $controllers_hostnames_array_str = $controllers_hostnames_array
52 $controllers_hostnames_array = split($controllers_hostnames_array, ',')
53 if !$amqp_vip { fail('amqp_vip is empty') }
54 if !$private_subnet { fail('private_subnet is empty')}
55 if !$cinder_admin_vip { fail('cinder_admin_vip is empty') }
56 if !$cinder_private_vip { fail('cinder_private_vip is empty') }
57 if !$cinder_public_vip { fail('cinder_public_vip is empty') }
58 if !$db_vip { fail('db_vip is empty') }
59 if !$glance_admin_vip { fail('glance_admin_vip is empty') }
60 if !$glance_private_vip { fail('glance_private_vip is empty') }
61 if !$glance_public_vip { fail('glance_public_vip is empty') }
62 if !$horizon_admin_vip { fail('horizon_admin_vip is empty') }
63 if !$horizon_private_vip { fail('horizon_private_vip is empty') }
64 if !$horizon_public_vip { fail('horizon_public_vip is empty') }
65 if !$keystone_admin_vip { fail('keystone_admin_vip is empty') }
66 if !$keystone_private_vip { fail('keystone_private_vip is empty') }
67 if !$keystone_public_vip { fail('keystone_public_vip is empty') }
68 if !$loadbalancer_vip { fail('loadbalancer_vip is empty') }
69 if !$neutron_admin_vip { fail('neutron_admin_vip is empty') }
70 if !$neutron_private_vip { fail('neutron_private_vip is empty') }
71 if !$neutron_public_vip { fail('neutron_public_vip is empty') }
72 if !$nova_admin_vip { fail('nova_admin_vip is empty') }
73 if !$nova_private_vip { fail('nova_private_vip is empty') }
74 if !$nova_public_vip { fail('nova_public_vip is empty') }
75 if $private_network == '' { fail('private_network is empty') }
76 if !$heat_admin_vip { fail('heat_admin_vip is empty') }
77 if !$heat_private_vip { fail('heat_private_vip is empty') }
78 if !$heat_public_vip { fail('heat_public_vip is empty') }
79 if !$heat_cfn_admin_vip { fail('heat_cfn_admin_vip is empty') }
80 if !$heat_cfn_private_vip { fail('heat_cfn_private_vip is empty') }
81 if !$heat_cfn_public_vip { fail('heat_cfn_public_vip is empty') }
83 ##Find private interface
84 $ovs_tunnel_if = get_nic_from_network("$private_network")
86 ##Optional HA variables
87 if !$amqp_username { $amqp_username = $single_username }
88 if !$amqp_password { $amqp_password = $single_password }
89 if !$ceph_fsid { $ceph_fsid = '904c8491-5c16-4dae-9cc3-6ce633a7f4cc' }
90 if !$ceph_images_key { $ceph_images_key = 'AQAfHBdUKLnUFxAAtO7WPKQZ8QfEoGqH0CLd7A==' }
91 if !$ceph_mon_host { $ceph_mon_host= $controllers_ip_array }
92 if !$ceph_mon_initial_members { $ceph_mon_initial_members = $controllers_hostnames_array}
93 if !$ceph_osd_journal_size { $ceph_osd_journal_size = '1000' }
94 if !$ceph_osd_pool_size { $ceph_osd_pool_size = '1' }
95 if !$ceph_public_network { $ceph_public_network = $private_subnet }
96 if !$ceph_volumes_key { $ceph_volumes_key = 'AQAfHBdUsFPTHhAAfqVqPq31FFCvyyO7oaOQXw==' }
97 if !$cinder_db_password { $cinder_db_password = $single_password }
98 if !$cinder_user_password { $cinder_user_password = $single_password }
99 if !$cluster_control_ip { $cluster_control_ip = $controllers_ip_array[0] }
100 if !$horizon_secret { $horizon_secret = $single_password }
101 if !$glance_db_password { $glance_db_password = $single_password }
102 if !$glance_user_password { $glance_user_password = $single_password }
103 if !$keystone_db_password { $keystone_db_password = $single_password }
104 if !$keystone_user_password { $keystone_user_password = $single_password }
105 if !$lb_backend_server_addrs { $lb_backend_server_addrs = $controllers_ip_array }
106 if !$lb_backend_server_names { $lb_backend_server_names = $controllers_hostnames_array }
107 if !$neutron_db_password { $neutron_db_password = $single_password }
108 if !$neutron_user_password { $neutron_user_password = $single_password }
109 if !$nova_db_password { $nova_db_password = $single_password }
110 if !$nova_user_password { $nova_user_password = $single_password }
111 if !$pcmk_server_addrs {$pcmk_server_addrs = $controllers_ip_array}
112 if !$pcmk_server_names {$pcmk_server_names = ["pcmk-${controllers_hostnames_array[0]}", "pcmk-${controllers_hostnames_array[1]}", "pcmk-${controllers_hostnames_array[2]}"] }
113 if !$rbd_secret_uuid { $rbd_secret_uuid = '3b519746-4021-4f72-957e-5b9d991723be' }
114 if !$heat_user_password { $heat_user_password = $single_password }
115 if !$heat_db_password { $heat_db_password = $single_password }
116 if !$heat_cfn_user_password { $heat_cfn_user_password = $single_password }
117 if !$heat_auth_encryption_key { $heat_auth_encryption_key = 'octopus1octopus1' }
118 if !$storage_network {
119 $storage_iface = $ovs_tunnel_if
121 $storage_iface = get_nic_from_network("$storage_network")
124 ##we assume here that if not provided, the first controller is where ODL will reside
125 ##this is fine for now as we will replace ODL with ODL HA when it is ready
126 if $odl_control_ip == '' { $odl_control_ip = $controllers_ip_array[0] }
128 ###find interface ip of storage network
129 $osd_ip = find_ip("",
133 if ($external_network_flag != '') and str2bool($external_network_flag) {
134 class { "opnfv::external_net_presetup":
136 require => Class['opnfv::repo'],
140 class { "opnfv::ceph_deploy":
142 osd_pool_default_size => $ceph_osd_pool_size,
143 osd_journal_size => $ceph_osd_journal_size,
144 mon_initial_members => $controllers_hostnames_array_str,
145 mon_host => $controllers_ip_array_str,
147 public_network => $ceph_public_network,
148 cluster_network => $ceph_public_network,
149 images_key => $ceph_images_key,
150 volumes_key => $ceph_volumes_key,
153 class { "quickstack::openstack_common": }
155 class { "quickstack::pacemaker::params":
156 amqp_password => $amqp_password,
157 amqp_username => $amqp_username,
158 amqp_vip => $amqp_vip,
159 ceph_cluster_network => $private_subnet,
160 ceph_fsid => $ceph_fsid,
161 ceph_images_key => $ceph_images_key,
162 ceph_mon_host => $ceph_mon_host,
163 ceph_mon_initial_members => $ceph_mon_initial_members,
164 ceph_osd_journal_size => $ceph_osd_journal_size,
165 ceph_osd_pool_size => $ceph_osd_pool_size,
166 ceph_public_network => $ceph_public_network,
167 ceph_volumes_key => $ceph_volumes_key,
168 cinder_admin_vip => $cinder_admin_vip,
169 cinder_db_password => $cinder_db_password,
170 cinder_private_vip => $cinder_private_vip,
171 cinder_public_vip => $cinder_public_vip,
172 cinder_user_password => $cinder_user_password,
173 cluster_control_ip => $cluster_control_ip,
175 glance_admin_vip => $glance_admin_vip,
176 glance_db_password => $glance_db_password,
177 glance_private_vip => $glance_private_vip,
178 glance_public_vip => $glance_public_vip,
179 glance_user_password => $glance_user_password,
180 heat_auth_encryption_key => $heat_auth_encryption_key,
181 heat_cfn_admin_vip => $heat_cfn_admin_vip,
182 heat_cfn_private_vip => $heat_cfn_private_vip,
183 heat_cfn_public_vip => $heat_cfn_public_vip,
184 heat_cfn_user_password => $heat_cfn_user_password,
185 heat_cloudwatch_enabled => 'true',
186 heat_cfn_enabled => 'true',
187 heat_db_password => $heat_db_password,
188 heat_admin_vip => $heat_admin_vip,
189 heat_private_vip => $heat_private_vip,
190 heat_public_vip => $heat_public_vip,
191 heat_user_password => $heat_user_password,
192 horizon_admin_vip => $horizon_admin_vip,
193 horizon_private_vip => $horizon_private_vip,
194 horizon_public_vip => $horizon_public_vip,
195 include_ceilometer => 'false',
196 include_cinder => 'true',
197 include_glance => 'true',
198 include_heat => 'true',
199 include_horizon => 'true',
200 include_keystone => 'true',
201 include_neutron => 'true',
202 include_nosql => 'false',
203 include_nova => 'true',
204 include_swift => 'false',
205 keystone_admin_vip => $keystone_admin_vip,
206 keystone_db_password => $keystone_db_password,
207 keystone_private_vip => $keystone_private_vip,
208 keystone_public_vip => $keystone_public_vip,
209 keystone_user_password => $keystone_user_password,
210 lb_backend_server_addrs => $lb_backend_server_addrs,
211 lb_backend_server_names => $lb_backend_server_names,
212 loadbalancer_vip => $loadbalancer_vip,
214 neutron_admin_vip => $neutron_admin_vip,
215 neutron_db_password => $neutron_db_password,
216 neutron_metadata_proxy_secret => $neutron_metadata_proxy_secret,
217 neutron_private_vip => $neutron_private_vip,
218 neutron_public_vip => $neutron_public_vip,
219 neutron_user_password => $neutron_user_password,
220 nova_admin_vip => $nova_admin_vip,
221 nova_db_password => $nova_db_password,
222 nova_private_vip => $nova_private_vip,
223 nova_public_vip => $nova_public_vip,
224 nova_user_password => $nova_user_password,
225 pcmk_iface => $ovs_tunnel_if,
226 pcmk_server_addrs => $pcmk_server_addrs,
227 pcmk_server_names => $pcmk_server_names,
228 private_iface => $ovs_tunnel_if,
231 class { "quickstack::pacemaker::common": }
233 class { "quickstack::pacemaker::load_balancer": }
235 class { "quickstack::pacemaker::galera":
236 mysql_root_password => $mysql_root_password,
237 wsrep_cluster_members => $controllers_ip_array,
240 class { "quickstack::pacemaker::qpid": }
242 class { "quickstack::pacemaker::rabbitmq": }
244 class { "quickstack::pacemaker::keystone":
245 admin_email => $admin_email,
246 admin_password => $admin_password,
247 admin_token => $keystone_admin_token,
251 keystonerc => 'true',
252 use_syslog => 'true',
256 class { "quickstack::pacemaker::swift": }
258 class { "quickstack::pacemaker::glance":
261 pcmk_fs_manage => 'false',
266 class { "quickstack::pacemaker::nova":
267 neutron_metadata_proxy_secret => $neutron_metadata_shared_secret,
270 class { "quickstack::pacemaker::cinder":
272 rbd_secret_uuid => $rbd_secret_uuid,
278 class { "quickstack::pacemaker::heat":
283 class { "quickstack::pacemaker::constraints": }
285 class { "quickstack::pacemaker::nosql": }
287 class { "quickstack::pacemaker::memcached": }
289 class { "quickstack::pacemaker::ceilometer":
290 ceilometer_metering_secret => $single_password,
293 class { "quickstack::pacemaker::horizon":
294 horizon_ca => '/etc/ipa/ca.crt',
295 horizon_cert => '/etc/pki/tls/certs/PUB_HOST-horizon.crt',
296 horizon_key => '/etc/pki/tls/private/PUB_HOST-horizon.key',
297 secret_key => $horizon_secret,
301 class { "quickstack::pacemaker::neutron":
302 agent_type => $this_agent,
303 enable_tunneling => 'true',
304 ml2_mechanism_drivers => $ml2_mech_drivers,
305 ml2_network_vlan_ranges => ["physnet1:10:50"],
306 odl_controller_ip => $odl_control_ip,
307 odl_controller_port => $odl_rest_port,
308 ovs_tunnel_iface => $ovs_tunnel_if,
309 ovs_tunnel_types => ["vxlan"],
313 if ($external_network_flag != '') and str2bool($external_network_flag) {
314 class { "opnfv::external_net_setup": }
318 if $ovs_tunnel_if == '' { fail('ovs_tunnel_if is empty') }
319 if $public_ip == '' { fail('public_ip is empty') }
320 if $private_ip == '' { fail('private_ip is empty') }
322 if $odl_control_ip == '' { $odl_control_ip = $private_ip }
324 if $mysql_ip == '' { fail('mysql_ip is empty') }
325 if $mysql_root_password == '' { fail('mysql_root_password is empty') }
326 if $amqp_ip == '' { fail('amqp_ip is empty') }
328 if $memcache_ip == '' { fail('memcache_ip is empty') }
329 if $neutron_ip == '' { fail('neutron_ip is empty') }
331 if $keystone_db_password == '' { fail('keystone_db_password is empty') }
333 if $horizon_secret_key == '' { fail('horizon_secret_key is empty') }
335 if $nova_user_password == '' { fail('nova_user_password is empty') }
336 if $nova_db_password == '' { fail('nova_db_password is empty') }
338 if $cinder_user_password == '' { fail('cinder_user_password is empty') }
339 if $cinder_db_password == '' { fail('cinder_db_password is empty') }
341 if $glance_user_password == '' { fail('glance_user_password is empty') }
342 if $glance_db_password == '' { fail('glance_db_password is empty') }
344 if $neutron_user_password == '' { fail('neutron_user_password is empty') }
345 if $neutron_db_password == '' { fail('neutron_db_password is empty') }
346 if $neutron_metadata_shared_secret == '' { fail('neutron_metadata_shared_secret is empty') }
348 if $ceilometer_user_password == '' { fail('ceilometer_user_password is empty') }
349 if $ceilometer_metering_secret == '' { fail('ceilometer_user_password is empty') }
351 if $heat_user_password == '' { fail('heat_user_password is empty') }
352 if $heat_db_password == '' { fail('heat_db_password is empty') }
353 if $heat_auth_encrypt_key == '' { fail('heat_auth_encrypt_key is empty') }
355 if $swift_user_password == '' { fail('swift_user_password is empty') }
356 if $swift_shared_secret == '' { fail('swift_shared_secret is empty') }
357 if $swift_admin_password == '' { fail('swift_admin_password is empty') }
359 if !$amqp_username { $amqp_username = $single_username }
360 if !$amqp_password { $amqp_password = $single_password }
363 class { "quickstack::neutron::controller_networker":
364 admin_email => $admin_email,
365 admin_password => $admin_password,
366 agent_type => $this_agent,
367 enable_tunneling => true,
368 ovs_tunnel_iface => $ovs_tunnel_if,
369 ovs_tunnel_network => '',
370 ovs_tunnel_types => ['vxlan'],
371 ovs_l2_population => 'True',
372 external_network_bridge => 'br-ex',
373 tenant_network_type => 'vxlan',
374 tunnel_id_ranges => '1:1000',
375 controller_admin_host => $private_ip,
376 controller_priv_host => $private_ip,
377 controller_pub_host => $public_ip,
379 #support_profile => $quickstack::params::support_profile,
380 #freeipa => $quickstack::params::freeipa,
382 mysql_host => $mysql_ip,
383 mysql_root_password => $mysql_root_password,
384 #amqp_provider => $amqp_provider,
385 amqp_host => $amqp_ip,
386 amqp_username => $amqp_username,
387 amqp_password => $amqp_password,
388 #amqp_nssdb_password => $quickstack::params::amqp_nssdb_password,
390 keystone_admin_token => $keystone_admin_token,
391 keystone_db_password => $keystone_db_password,
393 ceilometer_metering_secret => $ceilometer_metering_secret,
394 ceilometer_user_password => $ceilometer_user_password,
396 cinder_backend_gluster => $quickstack::params::cinder_backend_gluster,
397 cinder_backend_gluster_name => $quickstack::params::cinder_backend_gluster_name,
398 cinder_gluster_shares => $quickstack::params::cinder_gluster_shares,
399 cinder_user_password => $cinder_user_password,
400 cinder_db_password => $cinder_db_password,
402 glance_db_password => $glance_db_password,
403 glance_user_password => $glance_user_password,
406 heat_cloudwatch => true,
407 heat_db_password => $heat_db_password,
408 heat_user_password => $heat_user_password,
409 heat_auth_encrypt_key => $heat_auth_encrypt_key,
411 horizon_secret_key => $horizon_secret_key,
412 horizon_ca => $quickstack::params::horizon_ca,
413 horizon_cert => $quickstack::params::horizon_cert,
414 horizon_key => $quickstack::params::horizon_key,
416 ml2_mechanism_drivers => $ml2_mech_drivers,
419 neutron_metadata_proxy_secret => $neutron_metadata_shared_secret,
420 neutron_db_password => $neutron_db_password,
421 neutron_user_password => $neutron_user_password,
423 nova_db_password => $nova_db_password,
424 nova_user_password => $nova_user_password,
426 odl_controller_ip => $odl_control_ip,
427 odl_controller_port => $odl_rest_port,
429 swift_shared_secret => $swift_shared_secret,
430 swift_admin_password => $swift_admin_password,
431 swift_ringserver_ip => '192.168.203.1',
432 swift_storage_ips => ["192.168.203.2","192.168.203.3","192.168.203.4"],
433 swift_storage_device => 'device1',