Add update yaml backward compatibe with PublicVirtualIP on ctlplane
[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(sysctl::value, hiera('sysctl_settings'), {})
20
21 if count(hiera('ntp::servers')) > 0 {
22   include ::ntp
23 }
24
25 file { ['/etc/libvirt/qemu/networks/autostart/default.xml',
26         '/etc/libvirt/qemu/networks/default.xml']:
27   ensure => absent,
28   before => Service['libvirt'],
29 }
30 # in case libvirt has been already running before the Puppet run, make
31 # sure the default network is destroyed
32 exec { 'libvirt-default-net-destroy':
33   command => '/usr/bin/virsh net-destroy default',
34   onlyif  => '/usr/bin/virsh net-info default | /bin/grep -i "^active:\s*yes"',
35   before  => Service['libvirt'],
36 }
37
38 include ::nova
39 include ::nova::config
40 include ::nova::compute
41
42 nova_config {
43   'DEFAULT/my_ip':                     value => $ipaddress;
44   'DEFAULT/linuxnet_interface_driver': value => 'nova.network.linux_net.LinuxOVSInterfaceDriver';
45 }
46
47 $rbd_ephemeral_storage = hiera('nova::compute::rbd::ephemeral_storage', false)
48 $rbd_persistent_storage = hiera('rbd_persistent_storage', false)
49 if $rbd_ephemeral_storage or $rbd_persistent_storage {
50   include ::ceph::profile::client
51
52   $client_keys = hiera('ceph::profile::params::client_keys')
53   $client_user = join(['client.', hiera('ceph_client_user_name')])
54   class { '::nova::compute::rbd':
55     libvirt_rbd_secret_key => $client_keys[$client_user]['secret'],
56   }
57 }
58
59 if hiera('cinder_enable_nfs_backend', false) {
60   if str2bool($::selinux) {
61     selboolean { 'virt_use_nfs':
62       value      => on,
63       persistent => true,
64     } -> Package['nfs-utils']
65   }
66
67   package {'nfs-utils': } -> Service['nova-compute']
68 }
69
70 include ::nova::compute::libvirt
71 include ::nova::network::neutron
72 include ::neutron
73
74 # If the value of core plugin is set to 'nuage',
75 # include nuage agent,
76 # else use the default value of 'ml2'
77 if hiera('neutron::core_plugin') == 'neutron.plugins.nuage.plugin.NuagePlugin' {
78   include ::nuage::vrs
79   include ::nova::compute::neutron
80
81   class { '::nuage::metadataagent':
82     nova_os_tenant_name => hiera('nova::api::admin_tenant_name'),
83     nova_os_password    => hiera('nova_password'),
84     nova_metadata_ip    => hiera('nova_metadata_node_ips'),
85     nova_auth_ip        => hiera('keystone_public_api_virtual_ip'),
86   }
87 } else {
88   class { '::neutron::plugins::ml2':
89     flat_networks        => split(hiera('neutron_flat_networks'), ','),
90     tenant_network_types => [hiera('neutron_tenant_network_type')],
91   }
92
93   class { '::neutron::agents::ml2::ovs':
94     bridge_mappings => split(hiera('neutron_bridge_mappings'), ','),
95     tunnel_types    => split(hiera('neutron_tunnel_types'), ','),
96   }
97
98   if 'cisco_n1kv' in hiera('neutron_mechanism_drivers') {
99     class { '::neutron::agents::n1kv_vem':
100       n1kv_source  => hiera('n1kv_vem_source', undef),
101       n1kv_version => hiera('n1kv_vem_version', undef),
102     }
103   }
104 }
105
106
107 include ::ceilometer
108 include ::ceilometer::config
109 include ::ceilometer::agent::compute
110 include ::ceilometer::agent::auth
111
112 $snmpd_user = hiera('snmpd_readonly_user_name')
113 snmp::snmpv3_user { $snmpd_user:
114   authtype => 'MD5',
115   authpass => hiera('snmpd_readonly_user_password'),
116 }
117 class { '::snmp':
118   agentaddress => ['udp:161','udp6:[::1]:161'],
119   snmpd_config => [ join(['rouser ', hiera('snmpd_readonly_user_name')]), 'proc  cron', 'includeAllDisks  10%', 'master agentx', 'trapsink localhost public', 'iquerySecName internalUser', 'rouser internalUser', 'defaultMonitors yes', 'linkUpDownNotifications yes' ],
120 }
121
122 hiera_include('compute_classes')
123 package_manifest{'/var/lib/tripleo/installed-packages/overcloud_compute': ensure => present}