Fixes puppet modules to come from Genesis repo
[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 !$rbd_secret_uuid { $rbd_secret_uuid = '3b519746-4021-4f72-957e-5b9d991723be' }
32   if !$private_subnet { fail('private_subnet is empty')}
33   if !$ceph_public_network { $ceph_public_network = $private_subnet }
34   if !$ceph_fsid { $ceph_fsid = '904c8491-5c16-4dae-9cc3-6ce633a7f4cc' }
35   if !$ceph_images_key { $ceph_images_key = 'AQAfHBdUKLnUFxAAtO7WPKQZ8QfEoGqH0CLd7A==' }
36   if !$ceph_osd_journal_size { $ceph_osd_journal_size = '1000' }
37   if !$ceph_osd_pool_size { $ceph_osd_pool_size = '1' }
38   if !$ceph_volumes_key { $ceph_volumes_key = 'AQAfHBdUsFPTHhAAfqVqPq31FFCvyyO7oaOQXw==' }
39
40
41   ##Most users will only care about a single user/password for all services
42   ##so lets create one variable that can be used instead of separate usernames/passwords
43   if !$single_username { $single_username = 'octopus' }
44   if !$single_password { $single_password = 'octopus' }
45
46   if !$admin_password { $admin_password = $single_password }
47   if !$neutron_db_password  { $neutron_db_password = $single_password }
48   if !$neutron_user_password  { $neutron_user_password = $single_password }
49
50   if !$ceilometer_user_password { $ceilometer_user_password = $single_password }
51   if !$ceilometer_metering_secret { $ceilometer_metering_secret = $single_password }
52
53   ##HA Global params
54   if $ha_flag and str2bool($ha_flag) {
55      if $private_network == '' { fail('private_network is empty') }
56      if !$keystone_private_vip { fail('keystone_private_vip is empty') }
57      if !$glance_private_vip { fail('glance_private_vip is empty') }
58      if !$nova_public_vip { fail('nova_public_vip is empty') }
59      if !$nova_db_password { $nova_db_password = $single_password }
60      if !$nova_user_password { $nova_user_password = $single_password }
61      if !$controllers_ip_array { fail('controllers_ip_array is empty') }
62      if !$controllers_hostnames_array { fail('controllers_hostnames_array is empty') }
63      $controllers_ip_array = split($controllers_ip_array, ',')
64      $controllers_hostnames_array = split($controllers_hostnames_array, ',')
65      if !$odl_control_ip  { $odl_control_ip =  $controllers_ip_array[0] }
66      if !$db_vip { fail('db_vip is empty') }
67      $mysql_ip = $db_vip
68      if !$amqp_vip { fail('amqp_vip is empty') }
69      $amqp_ip = $amqp_vip
70      if !$amqp_username { $amqp_username = $single_username }
71      if !$amqp_password { $amqp_password = $single_password }
72      if !$ceph_mon_initial_members { $ceph_mon_initial_members = $controllers_hostnames_array }
73      if !$ceph_mon_host { $ceph_mon_host = $controllers_ip_array }
74      if !$neutron_private_vip { fail('neutron_private_vip is empty') }
75
76     ##Find private interface
77     $ovs_tunnel_if = get_nic_from_network("$private_network")
78
79   } else {
80   ##non HA params
81      ##Mandatory
82      if $private_network == '' { fail('private_network is empty') }
83      if ($odl_flag != '') and str2bool($odl_flag) {
84        if $odl_control_ip == '' { fail('odl_control_ip is empty') }
85      }
86      if $controller_ip == '' { fail('controller_ip is empty') }
87
88      ##Optional
89      ##Find private interface
90      $ovs_tunnel_if = get_nic_from_network("$private_network")
91      ##Find private ip
92      $private_ip = get_ip_from_nic("$ovs_tunnel_if")
93
94      $keystone_private_vip = $controller_ip
95      $glance_private_vip   = $controller_ip
96      $nova_public_vip      = $controller_ip
97      $neutron_private_vip  = $controller_ip
98
99      if !$nova_db_password { $nova_db_password = $single_password }
100      if !$nova_user_password { $nova_user_password = $single_password }
101      if !$mysql_ip { $mysql_ip = $controller_ip }
102      if !$amqp_ip { $amqp_ip = $controller_ip }
103      if !$amqp_username { $amqp_username = $single_username }
104      if !$amqp_password { $amqp_password = $single_password }
105      if !$ceph_mon_host { $ceph_mon_host= ["$private_ip"] }
106      if !$ceph_mon_initial_members { $ceph_mon_initial_members = ["$::hostname"] }
107   }
108
109   class { "quickstack::neutron::compute":
110     auth_host                    => $keystone_private_vip,
111     glance_host                  => $glance_private_vip,
112     libvirt_images_rbd_pool      => 'volumes',
113     libvirt_images_rbd_ceph_conf => '/etc/ceph/ceph.conf',
114     libvirt_inject_password      => 'false',
115     libvirt_inject_key           => 'false',
116     libvirt_images_type          => 'rbd',
117     nova_host                    => $nova_public_vip,
118     nova_db_password             => $nova_db_password,
119     nova_user_password           => $nova_user_password,
120     private_network              => '',
121     private_iface                => $ovs_tunnel_if,
122     private_ip                   => '',
123     rbd_user                     => 'volumes',
124     rbd_secret_uuid              => $rbd_secret_uuid,
125     network_device_mtu           => $quickstack::params::network_device_mtu,
126
127     admin_password               => $admin_password,
128     ssl                          => false,
129
130     mysql_host                   => $mysql_ip,
131     mysql_ca                     =>  '/etc/ipa/ca.crt',
132     amqp_host                    => $amqp_ip,
133     amqp_username                => $amqp_username,
134     amqp_password                => $amqp_password,
135
136     ceilometer                   => 'false',
137     ceilometer_metering_secret   => $ceilometer_metering_secret,
138     ceilometer_user_password     => $ceilometer_user_password,
139
140     cinder_backend_gluster       => $quickstack::params::cinder_backend_gluster,
141     cinder_backend_rbd           => 'true',
142     glance_backend_rbd           => 'true',
143     ceph_cluster_network         => $ceph_public_network,
144     ceph_fsid                    => $ceph_fsid,
145     ceph_images_key              => $ceph_images_key,
146     ceph_mon_host                => $ceph_mon_host,
147     ceph_mon_initial_members     => $ceph_mon_initial_members,
148     ceph_osd_pool_default_size   => $ceph_osd_pool_size,
149     ceph_osd_journal_size        => $ceph_osd_journal_size,
150     ceph_volumes_key             => $ceph_volumes_key,
151
152     agent_type                   => $this_agent,
153     enable_tunneling             => true,
154
155     ml2_mechanism_drivers        => $ml2_mech_drivers,
156     odl_controller_ip            => $odl_control_ip,
157
158     neutron_db_password          => $neutron_db_password,
159     neutron_user_password        => $neutron_user_password,
160     neutron_host                 => $neutron_private_vip,
161
162     ovs_tunnel_iface             => $ovs_tunnel_if,
163     ovs_tunnel_network           => '',
164     ovs_l2_population            => 'false',
165
166     tenant_network_type          => 'vxlan',
167     tunnel_id_ranges             => '1:1000',
168     ovs_tunnel_types             => ['vxlan'],
169
170     verbose                      => 'true',
171     security_group_api           => 'neutron',
172
173   }
174 }