7bba609b37add4cc33b22fe1f5fa563da62ee643
[genesis.git] / common / puppet-opnfv / manifests / compute.pp
1 #Copyright 2015 Open Platform for NFV Project, Inc. and its contributors
2 #
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
6 #
7 #       http://www.apache.org/licenses/LICENSE-2.0
8 #
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.
14 #
15 #Provides a manifest to configure OpenStack compute node in HA or non-HA
16 #environment, with Ceph configured as Cinder backend storage.
17 #ha_flag set to true will use virtual IP addresses (VIPs provided by
18 #global params) as the provider to the compute node for HA
19
20 class opnfv::compute {
21   if ($odl_flag != '') and str2bool($odl_flag) {
22      $ml2_mech_drivers = ['opendaylight']
23      $this_agent = 'opendaylight'
24   }
25   else {
26     $ml2_mech_drivers = ['openvswitch','l2population']
27     $this_agent = 'ovs'
28   }
29
30   ##Common Parameters
31   if $ovs_tunnel_if == '' { fail('ovs_tunnel_if is empty') }
32
33   if !$rbd_secret_uuid { $rbd_secret_uuid = '3b519746-4021-4f72-957e-5b9d991723be' }
34   if !$private_subnet { fail('private_subnet is empty')}
35   if !$ceph_public_network { $ceph_public_network = $private_subnet }
36   if !$ceph_fsid { $ceph_fsid = '904c8491-5c16-4dae-9cc3-6ce633a7f4cc' }
37   if !$ceph_images_key { $ceph_images_key = 'AQAfHBdUKLnUFxAAtO7WPKQZ8QfEoGqH0CLd7A==' }
38   if !$ceph_osd_journal_size { $ceph_osd_journal_size = '1000' }
39   if !$ceph_osd_pool_size { $ceph_osd_pool_size = '1' }
40   if !$ceph_volumes_key { $ceph_volumes_key = 'AQAfHBdUsFPTHhAAfqVqPq31FFCvyyO7oaOQXw==' }
41
42
43   ##Most users will only care about a single user/password for all services
44   ##so lets create one variable that can be used instead of separate usernames/passwords
45   if !$single_username { $single_username = 'octopus' }
46   if !$single_password { $single_password = 'octopus' }
47
48   if !$admin_password { $admin_password = $single_password }
49   if !$neutron_db_password  { $neutron_db_password = $single_password }
50   if !$neutron_user_password  { $neutron_user_password = $single_password }
51
52   if !$ceilometer_user_password { $ceilometer_user_password = $single_password }
53   if !$ceilometer_metering_secret { $ceilometer_metering_secret = $single_password }
54
55   ##HA Global params
56   if $ha_flag {
57      if !$keystone_private_vip { fail('keystone_private_vip is empty') }
58      if !$glance_private_vip { fail('glance_private_vip is empty') }
59      if !$nova_private_vip { fail('nova_private_vip is empty') }
60      if !$nova_db_password { $nova_db_password = $single_password }
61      if !$nova_user_password { $nova_user_password = $single_password }
62      if !$controllers_ip_array { fail('controllers_ip_array is empty') }
63      if !$controllers_hostnames_array { fail('controllers_hostnames_array is empty') }
64      $controllers_ip_array = split($controllers_ip_array, ',')
65      $controllers_hostnames_array = split($controllers_hostnames_array, ',')
66      if !$odl_control_ip  { $odl_control_ip =  $controllers_ip_array[0] }
67      if !$db_vip { fail('db_vip is empty') }
68      $mysql_ip = $db_vip
69      if !$amqp_vip { fail('amqp_vip is empty') }
70      $amqp_ip = $amqp_vip
71      if !$amqp_username { $amqp_username = $single_username }
72      if !$amqp_password { $amqp_password = $single_password }
73      if !$ceph_mon_initial_members { $ceph_mon_initial_members = $controllers_hostnames_array }
74      if !$ceph_mon_host { $ceph_mon_host = $controllers_ip_array }
75      if !$neutron_private_vip { fail('neutron_private_vip is empty') }
76   } else {
77   ##non HA params
78      if !$private_ip { fail('private_ip is empty') }
79      $keystone_private_vip = $private_ip
80      $glance_private_vip   = $private_ip
81      $nova_private_vip     = $private_ip
82      $neutron_private_vip  = $private_ip
83      if !$nova_db_password { fail('nova_db_password is empty') }
84      if !$nova_user_password { fail('nova_user_password is empty') }
85      if !$odl_control_ip { $odl_control_ip = $private_ip }
86      if !$mysql_ip { $mysql_ip = $private_ip }
87      if !$amqp_ip { $amqp_ip = $private_ip }
88      if !$amqp_username { $amqp_username = 'guest' }
89      if !$amqp_password { $amqp_password = 'guest' }
90      if !$ceph_mon_host { $ceph_mon_host= ["$private_ip"] }
91      if !$ceph_mon_initial_members { $ceph_mon_initial_members = ["$::hostname"] }
92   }
93
94   class { "quickstack::neutron::compute":
95     auth_host                    => $keystone_private_vip,
96     glance_host                  => $glance_private_vip,
97     libvirt_images_rbd_pool      => 'volumes',
98     libvirt_images_rbd_ceph_conf => '/etc/ceph/ceph.conf',
99     libvirt_inject_password      => 'false',
100     libvirt_inject_key           => 'false',
101     libvirt_images_type          => 'rbd',
102     nova_host                    => $nova_private_vip,
103     nova_db_password             => $nova_db_password,
104     nova_user_password           => $nova_user_password,
105     private_network              => '',
106     private_iface                => $ovs_tunnel_if,
107     private_ip                   => '',
108     rbd_user                     => 'volumes',
109     rbd_secret_uuid              => $rbd_secret_uuid,
110     network_device_mtu           => $quickstack::params::network_device_mtu,
111
112     admin_password               => $admin_password,
113     ssl                          => false,
114
115     mysql_host                   => $mysql_ip,
116     mysql_ca                     =>  '/etc/ipa/ca.crt',
117     amqp_host                    => $amqp_ip,
118     amqp_username                => $amqp_username,
119     amqp_password                => $amqp_password,
120
121     ceilometer                   => 'false',
122     ceilometer_metering_secret   => $ceilometer_metering_secret,
123     ceilometer_user_password     => $ceilometer_user_password,
124
125     cinder_backend_gluster       => $quickstack::params::cinder_backend_gluster,
126     cinder_backend_rbd           => 'true',
127     glance_backend_rbd           => 'true',
128     ceph_cluster_network         => $ceph_public_network,
129     ceph_fsid                    => $ceph_fsid,
130     ceph_images_key              => $ceph_images_key,
131     ceph_mon_host                => $ceph_mon_host,
132     ceph_mon_initial_members     => $ceph_mon_initial_members,
133     ceph_osd_pool_default_size   => $ceph_osd_pool_size,
134     ceph_osd_journal_size        => $ceph_osd_journal_size,
135     ceph_volumes_key             => $ceph_volumes_key,
136
137     agent_type                   => $this_agent,
138     enable_tunneling             => true,
139
140     ml2_mechanism_drivers        => $ml2_mech_drivers,
141     odl_controller_ip            => $odl_control_ip,
142
143     neutron_db_password          => $neutron_db_password,
144     neutron_user_password        => $neutron_user_password,
145     neutron_host                 => $neutron_private_vip,
146
147     ovs_tunnel_iface             => $ovs_tunnel_if,
148     ovs_tunnel_network           => '',
149     ovs_l2_population            => 'false',
150
151     tenant_network_type          => 'vxlan',
152     tunnel_id_ranges             => '1:1000',
153     ovs_tunnel_types             => ['vxlan'],
154
155     verbose                      => 'true',
156     security_group_api           => 'neutron',
157
158   }
159 }