Merge "compute: use live_migration_tunnelled"
[apex-tripleo-heat-templates.git] / puppet / manifests / overcloud_compute.pp
1 # Copyright 2014 Red Hat, Inc.
2 # All Rights Reserved.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License"); you may
5 # not use this file except in compliance with the License. You may obtain
6 # a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 # License for the specific language governing permissions and limitations
14 # under the License.
15
16 include ::tripleo::packages
17 include ::tripleo::firewall
18
19 create_resources(kmod::load, hiera('kernel_modules'), {})
20 create_resources(sysctl::value, hiera('sysctl_settings'), {})
21 Exec <| tag == 'kmod::load' |>  -> Sysctl <| |>
22
23 if count(hiera('ntp::servers')) > 0 {
24   include ::ntp
25 }
26
27 include ::timezone
28
29 file { ['/etc/libvirt/qemu/networks/autostart/default.xml',
30         '/etc/libvirt/qemu/networks/default.xml']:
31   ensure => absent,
32   before => Service['libvirt'],
33 }
34 # in case libvirt has been already running before the Puppet run, make
35 # sure the default network is destroyed
36 exec { 'libvirt-default-net-destroy':
37   command => '/usr/bin/virsh net-destroy default',
38   onlyif  => '/usr/bin/virsh net-info default | /bin/grep -i "^active:\s*yes"',
39   before  => Service['libvirt'],
40 }
41
42 # When utilising images for deployment, we need to reset the iSCSI initiator name to make it unique
43 exec { 'reset-iscsi-initiator-name':
44   command => '/bin/echo InitiatorName=$(/usr/sbin/iscsi-iname) > /etc/iscsi/initiatorname.iscsi',
45   onlyif  => '/usr/bin/test ! -f /etc/iscsi/.initiator_reset',
46 }->
47
48 file { '/etc/iscsi/.initiator_reset':
49   ensure => present,
50 }
51
52 include ::nova
53 include ::nova::config
54 include ::nova::compute
55
56 $rbd_ephemeral_storage = hiera('nova::compute::rbd::ephemeral_storage', false)
57 $rbd_persistent_storage = hiera('rbd_persistent_storage', false)
58 if $rbd_ephemeral_storage or $rbd_persistent_storage {
59   if str2bool(hiera('ceph_ipv6', false)) {
60     $mon_host = hiera('ceph_mon_host_v6')
61   } else {
62     $mon_host = hiera('ceph_mon_host')
63   }
64   class { '::ceph::profile::params':
65     mon_host            => $mon_host,
66   }
67   include ::ceph::conf
68   include ::ceph::profile::client
69
70   $client_keys = hiera('ceph::profile::params::client_keys')
71   $client_user = join(['client.', hiera('ceph_client_user_name')])
72   class { '::nova::compute::rbd':
73     libvirt_rbd_secret_key => $client_keys[$client_user]['secret'],
74   }
75 }
76
77 if hiera('cinder_enable_nfs_backend', false) {
78   if str2bool($::selinux) {
79     selboolean { 'virt_use_nfs':
80       value      => on,
81       persistent => true,
82     } -> Package['nfs-utils']
83   }
84
85   package {'nfs-utils': } -> Service['nova-compute']
86 }
87
88 if str2bool(hiera('nova::use_ipv6', false)) {
89   $vncserver_listen = '::0'
90 } else {
91   $vncserver_listen = '0.0.0.0'
92 }
93 class { '::nova::compute::libvirt' :
94   vncserver_listen => $vncserver_listen,
95 }
96
97 nova_config {
98   'DEFAULT/my_ip':                     value => $ipaddress;
99   'DEFAULT/linuxnet_interface_driver': value => 'nova.network.linux_net.LinuxOVSInterfaceDriver';
100   'DEFAULT/host':                      value => $fqdn;
101   # TUNNELLED mode provides a security enhancement when using shared storage but is not
102   # supported when not using shared storage.
103   # See https://bugzilla.redhat.com/show_bug.cgi?id=1301986#c12
104   # In future versions of QEMU (2.6, mostly), Dan's native encryption
105   # work will obsolete the need to use TUNNELLED transport mode.
106   'libvirt/live_migration_tunnelled':  value => $rbd_ephemeral_storage;
107 }
108
109 if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
110   file {'/etc/libvirt/qemu.conf':
111     ensure  => present,
112     content => hiera('midonet_libvirt_qemu_data')
113   }
114 }
115 include ::nova::network::neutron
116 include ::neutron
117 include ::neutron::config
118
119 # If the value of core plugin is set to 'nuage',
120 # include nuage agent,
121 # If the value of core plugin is set to 'midonet',
122 # include midonet agent,
123 # else use the default value of 'ml2'
124 if hiera('neutron::core_plugin') == 'neutron.plugins.nuage.plugin.NuagePlugin' {
125   include ::nuage::vrs
126   include ::nova::compute::neutron
127
128   class { '::nuage::metadataagent':
129     nova_os_tenant_name => hiera('nova::api::admin_tenant_name'),
130     nova_os_password    => hiera('nova_password'),
131     nova_metadata_ip    => hiera('nova_metadata_node_ips'),
132     nova_auth_ip        => hiera('keystone_public_api_virtual_ip'),
133   }
134 }
135 elsif hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
136
137   # TODO(devvesa) provide non-controller ips for these services
138   $zookeeper_node_ips = hiera('neutron_api_node_ips')
139   $cassandra_node_ips = hiera('neutron_api_node_ips')
140
141   class {'::tripleo::network::midonet::agent':
142     zookeeper_servers => $zookeeper_node_ips,
143     cassandra_seeds   => $cassandra_node_ips
144   }
145 }
146 elsif hiera('neutron::core_plugin') == 'neutron_plugin_contrail.plugins.opencontrail.contrail_plugin.NeutronPluginContrailCoreV2' {
147
148   include ::contrail::vrouter
149   # NOTE: it's not possible to use this class without a functional
150   # contrail controller up and running
151   #class {'::contrail::vrouter::provision_vrouter':
152   #  require => Class['contrail::vrouter'],
153   #}
154 }
155 else {
156
157   include ::neutron::plugins::ml2
158   include ::neutron::agents::ml2::ovs
159
160   if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') {
161     class { '::neutron::agents::n1kv_vem':
162       n1kv_source  => hiera('n1kv_vem_source', undef),
163       n1kv_version => hiera('n1kv_vem_version', undef),
164     }
165   }
166
167   if 'bsn_ml2' in hiera('neutron::plugins::ml2::mechanism_drivers') {
168     include ::neutron::agents::bigswitch
169   }
170 }
171
172 neutron_config {
173   'DEFAULT/host': value => $fqdn;
174 }
175
176 include ::ceilometer
177 include ::ceilometer::config
178 include ::ceilometer::agent::compute
179 include ::ceilometer::agent::auth
180
181 $snmpd_user = hiera('snmpd_readonly_user_name')
182 snmp::snmpv3_user { $snmpd_user:
183   authtype => 'MD5',
184   authpass => hiera('snmpd_readonly_user_password'),
185 }
186 class { '::snmp':
187   agentaddress => ['udp:161','udp6:[::1]:161'],
188   snmpd_config => [ join(['createUser ', hiera('snmpd_readonly_user_name'), ' MD5 "', hiera('snmpd_readonly_user_password'), '"']), join(['rouser ', hiera('snmpd_readonly_user_name')]), 'proc  cron', 'includeAllDisks  10%', 'master agentx', 'trapsink localhost public', 'iquerySecName internalUser', 'rouser internalUser', 'defaultMonitors yes', 'linkUpDownNotifications yes' ],
189 }
190
191 hiera_include('compute_classes')
192 package_manifest{'/var/lib/tripleo/installed-packages/overcloud_compute': ensure => present}