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 !$neutron_metadata_proxy_secret { $neutron_metadata_proxy_secret = $single_password }
110 if !$nova_db_password { $nova_db_password = $single_password }
111 if !$nova_user_password { $nova_user_password = $single_password }
112 if !$pcmk_server_addrs {$pcmk_server_addrs = $controllers_ip_array}
113 if !$pcmk_server_names {$pcmk_server_names = ["pcmk-${controllers_hostnames_array[0]}", "pcmk-${controllers_hostnames_array[1]}", "pcmk-${controllers_hostnames_array[2]}"] }
114 if !$rbd_secret_uuid { $rbd_secret_uuid = '3b519746-4021-4f72-957e-5b9d991723be' }
115 if !$heat_user_password { $heat_user_password = $single_password }
116 if !$heat_db_password { $heat_db_password = $single_password }
117 if !$heat_cfn_user_password { $heat_cfn_user_password = $single_password }
118 if !$heat_auth_encryption_key { $heat_auth_encryption_key = 'octopus1octopus1' }
119 if !$storage_network {
120 $storage_iface = $ovs_tunnel_if
122 $storage_iface = get_nic_from_network("$storage_network")
125 ##we assume here that if not provided, the first controller is where ODL will reside
126 ##this is fine for now as we will replace ODL with ODL HA when it is ready
127 if $odl_control_ip == '' { $odl_control_ip = $controllers_ip_array[0] }
129 ###find interface ip of storage network
130 $osd_ip = find_ip("",
134 if ($external_network_flag != '') and str2bool($external_network_flag) {
135 class { "opnfv::external_net_presetup":
137 require => Class['opnfv::repo'],
141 class { "opnfv::ceph_deploy":
143 osd_pool_default_size => $ceph_osd_pool_size,
144 osd_journal_size => $ceph_osd_journal_size,
145 mon_initial_members => $controllers_hostnames_array_str,
146 mon_host => $controllers_ip_array_str,
148 public_network => $ceph_public_network,
149 cluster_network => $ceph_public_network,
150 images_key => $ceph_images_key,
151 volumes_key => $ceph_volumes_key,
154 class { "quickstack::openstack_common": }
156 class { "quickstack::pacemaker::params":
157 amqp_password => $amqp_password,
158 amqp_username => $amqp_username,
159 amqp_vip => $amqp_vip,
160 ceph_cluster_network => $private_subnet,
161 ceph_fsid => $ceph_fsid,
162 ceph_images_key => $ceph_images_key,
163 ceph_mon_host => $ceph_mon_host,
164 ceph_mon_initial_members => $ceph_mon_initial_members,
165 ceph_osd_journal_size => $ceph_osd_journal_size,
166 ceph_osd_pool_size => $ceph_osd_pool_size,
167 ceph_public_network => $ceph_public_network,
168 ceph_volumes_key => $ceph_volumes_key,
169 cinder_admin_vip => $cinder_admin_vip,
170 cinder_db_password => $cinder_db_password,
171 cinder_private_vip => $cinder_private_vip,
172 cinder_public_vip => $cinder_public_vip,
173 cinder_user_password => $cinder_user_password,
174 cluster_control_ip => $cluster_control_ip,
176 glance_admin_vip => $glance_admin_vip,
177 glance_db_password => $glance_db_password,
178 glance_private_vip => $glance_private_vip,
179 glance_public_vip => $glance_public_vip,
180 glance_user_password => $glance_user_password,
181 heat_auth_encryption_key => $heat_auth_encryption_key,
182 heat_cfn_admin_vip => $heat_cfn_admin_vip,
183 heat_cfn_private_vip => $heat_cfn_private_vip,
184 heat_cfn_public_vip => $heat_cfn_public_vip,
185 heat_cfn_user_password => $heat_cfn_user_password,
186 heat_cloudwatch_enabled => 'true',
187 heat_cfn_enabled => 'true',
188 heat_db_password => $heat_db_password,
189 heat_admin_vip => $heat_admin_vip,
190 heat_private_vip => $heat_private_vip,
191 heat_public_vip => $heat_public_vip,
192 heat_user_password => $heat_user_password,
193 horizon_admin_vip => $horizon_admin_vip,
194 horizon_private_vip => $horizon_private_vip,
195 horizon_public_vip => $horizon_public_vip,
196 include_ceilometer => 'false',
197 include_cinder => 'true',
198 include_glance => 'true',
199 include_heat => 'true',
200 include_horizon => 'true',
201 include_keystone => 'true',
202 include_neutron => 'true',
203 include_nosql => 'false',
204 include_nova => 'true',
205 include_swift => 'false',
206 keystone_admin_vip => $keystone_admin_vip,
207 keystone_db_password => $keystone_db_password,
208 keystone_private_vip => $keystone_private_vip,
209 keystone_public_vip => $keystone_public_vip,
210 keystone_user_password => $keystone_user_password,
211 lb_backend_server_addrs => $lb_backend_server_addrs,
212 lb_backend_server_names => $lb_backend_server_names,
213 loadbalancer_vip => $loadbalancer_vip,
215 neutron_admin_vip => $neutron_admin_vip,
216 neutron_db_password => $neutron_db_password,
217 neutron_metadata_proxy_secret => $neutron_metadata_proxy_secret,
218 neutron_private_vip => $neutron_private_vip,
219 neutron_public_vip => $neutron_public_vip,
220 neutron_user_password => $neutron_user_password,
221 nova_admin_vip => $nova_admin_vip,
222 nova_db_password => $nova_db_password,
223 nova_private_vip => $nova_private_vip,
224 nova_public_vip => $nova_public_vip,
225 nova_user_password => $nova_user_password,
226 pcmk_iface => $ovs_tunnel_if,
227 pcmk_server_addrs => $pcmk_server_addrs,
228 pcmk_server_names => $pcmk_server_names,
229 private_iface => $ovs_tunnel_if,
232 class { "quickstack::pacemaker::common": }
234 class { "quickstack::pacemaker::load_balancer": }
236 class { "quickstack::pacemaker::galera":
237 mysql_root_password => $mysql_root_password,
238 wsrep_cluster_members => $controllers_ip_array,
241 class { "quickstack::pacemaker::qpid": }
243 class { "quickstack::pacemaker::rabbitmq": }
245 class { "quickstack::pacemaker::keystone":
246 admin_email => $admin_email,
247 admin_password => $admin_password,
248 admin_token => $keystone_admin_token,
252 keystonerc => 'true',
253 use_syslog => 'true',
257 class { "quickstack::pacemaker::swift": }
259 class { "quickstack::pacemaker::glance":
262 pcmk_fs_manage => 'false',
267 class { "quickstack::pacemaker::nova":
268 neutron_metadata_proxy_secret => $neutron_metadata_shared_secret,
271 class { "quickstack::pacemaker::cinder":
273 rbd_secret_uuid => $rbd_secret_uuid,
279 class { "quickstack::pacemaker::heat":
284 class { "quickstack::pacemaker::constraints": }
286 class { "quickstack::pacemaker::nosql": }
288 class { "quickstack::pacemaker::memcached": }
290 class { "quickstack::pacemaker::ceilometer":
291 ceilometer_metering_secret => $single_password,
294 class { "quickstack::pacemaker::horizon":
295 horizon_ca => '/etc/ipa/ca.crt',
296 horizon_cert => '/etc/pki/tls/certs/PUB_HOST-horizon.crt',
297 horizon_key => '/etc/pki/tls/private/PUB_HOST-horizon.key',
298 secret_key => $horizon_secret,
302 class { "quickstack::pacemaker::neutron":
303 agent_type => $this_agent,
304 enable_tunneling => 'true',
305 ml2_mechanism_drivers => $ml2_mech_drivers,
306 ml2_network_vlan_ranges => ["physnet1:10:50"],
307 odl_controller_ip => $odl_control_ip,
308 odl_controller_port => $odl_rest_port,
309 ovs_tunnel_iface => $ovs_tunnel_if,
310 ovs_tunnel_types => ["vxlan"],
314 if ($external_network_flag != '') and str2bool($external_network_flag) {
315 class { "opnfv::external_net_setup": }
319 if $ovs_tunnel_if == '' { fail('ovs_tunnel_if is empty') }
320 if $public_ip == '' { fail('public_ip is empty') }
321 if $private_ip == '' { fail('private_ip is empty') }
323 if $odl_control_ip == '' { $odl_control_ip = $private_ip }
325 if $mysql_ip == '' { fail('mysql_ip is empty') }
326 if $mysql_root_password == '' { fail('mysql_root_password is empty') }
327 if $amqp_ip == '' { fail('amqp_ip is empty') }
329 if $memcache_ip == '' { fail('memcache_ip is empty') }
330 if $neutron_ip == '' { fail('neutron_ip is empty') }
332 if $keystone_db_password == '' { fail('keystone_db_password is empty') }
334 if $horizon_secret_key == '' { fail('horizon_secret_key is empty') }
336 if $nova_user_password == '' { fail('nova_user_password is empty') }
337 if $nova_db_password == '' { fail('nova_db_password is empty') }
339 if $cinder_user_password == '' { fail('cinder_user_password is empty') }
340 if $cinder_db_password == '' { fail('cinder_db_password is empty') }
342 if $glance_user_password == '' { fail('glance_user_password is empty') }
343 if $glance_db_password == '' { fail('glance_db_password is empty') }
345 if $neutron_user_password == '' { fail('neutron_user_password is empty') }
346 if $neutron_db_password == '' { fail('neutron_db_password is empty') }
347 if $neutron_metadata_shared_secret == '' { fail('neutron_metadata_shared_secret is empty') }
349 if $ceilometer_user_password == '' { fail('ceilometer_user_password is empty') }
350 if $ceilometer_metering_secret == '' { fail('ceilometer_user_password is empty') }
352 if $heat_user_password == '' { fail('heat_user_password is empty') }
353 if $heat_db_password == '' { fail('heat_db_password is empty') }
354 if $heat_auth_encrypt_key == '' { fail('heat_auth_encrypt_key is empty') }
356 if $swift_user_password == '' { fail('swift_user_password is empty') }
357 if $swift_shared_secret == '' { fail('swift_shared_secret is empty') }
358 if $swift_admin_password == '' { fail('swift_admin_password is empty') }
360 if !$amqp_username { $amqp_username = $single_username }
361 if !$amqp_password { $amqp_password = $single_password }
364 class { "quickstack::neutron::controller_networker":
365 admin_email => $admin_email,
366 admin_password => $admin_password,
367 agent_type => $this_agent,
368 enable_tunneling => true,
369 ovs_tunnel_iface => $ovs_tunnel_if,
370 ovs_tunnel_network => '',
371 ovs_tunnel_types => ['vxlan'],
372 ovs_l2_population => 'True',
373 external_network_bridge => 'br-ex',
374 tenant_network_type => 'vxlan',
375 tunnel_id_ranges => '1:1000',
376 controller_admin_host => $private_ip,
377 controller_priv_host => $private_ip,
378 controller_pub_host => $public_ip,
380 #support_profile => $quickstack::params::support_profile,
381 #freeipa => $quickstack::params::freeipa,
383 mysql_host => $mysql_ip,
384 mysql_root_password => $mysql_root_password,
385 #amqp_provider => $amqp_provider,
386 amqp_host => $amqp_ip,
387 amqp_username => $amqp_username,
388 amqp_password => $amqp_password,
389 #amqp_nssdb_password => $quickstack::params::amqp_nssdb_password,
391 keystone_admin_token => $keystone_admin_token,
392 keystone_db_password => $keystone_db_password,
394 ceilometer_metering_secret => $ceilometer_metering_secret,
395 ceilometer_user_password => $ceilometer_user_password,
397 cinder_backend_gluster => $quickstack::params::cinder_backend_gluster,
398 cinder_backend_gluster_name => $quickstack::params::cinder_backend_gluster_name,
399 cinder_gluster_shares => $quickstack::params::cinder_gluster_shares,
400 cinder_user_password => $cinder_user_password,
401 cinder_db_password => $cinder_db_password,
403 glance_db_password => $glance_db_password,
404 glance_user_password => $glance_user_password,
407 heat_cloudwatch => true,
408 heat_db_password => $heat_db_password,
409 heat_user_password => $heat_user_password,
410 heat_auth_encrypt_key => $heat_auth_encrypt_key,
412 horizon_secret_key => $horizon_secret_key,
413 horizon_ca => $quickstack::params::horizon_ca,
414 horizon_cert => $quickstack::params::horizon_cert,
415 horizon_key => $quickstack::params::horizon_key,
417 ml2_mechanism_drivers => $ml2_mech_drivers,
420 neutron_metadata_proxy_secret => $neutron_metadata_shared_secret,
421 neutron_db_password => $neutron_db_password,
422 neutron_user_password => $neutron_user_password,
424 nova_db_password => $nova_db_password,
425 nova_user_password => $nova_user_password,
427 odl_controller_ip => $odl_control_ip,
428 odl_controller_port => $odl_rest_port,
430 swift_shared_secret => $swift_shared_secret,
431 swift_admin_password => $swift_admin_password,
432 swift_ringserver_ip => '192.168.203.1',
433 swift_storage_ips => ["192.168.203.2","192.168.203.3","192.168.203.4"],
434 swift_storage_device => 'device1',