6403a734ea67cc378d9377f8462de2054f364a3f
[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 include ::nova
43 include ::nova::config
44 include ::nova::compute
45
46 nova_config {
47   'DEFAULT/my_ip':                     value => $ipaddress;
48   'DEFAULT/linuxnet_interface_driver': value => 'nova.network.linux_net.LinuxOVSInterfaceDriver';
49 }
50
51 $rbd_ephemeral_storage = hiera('nova::compute::rbd::ephemeral_storage', false)
52 $rbd_persistent_storage = hiera('rbd_persistent_storage', false)
53 if $rbd_ephemeral_storage or $rbd_persistent_storage {
54   include ::ceph::conf
55   include ::ceph::profile::client
56
57   $client_keys = hiera('ceph::profile::params::client_keys')
58   $client_user = join(['client.', hiera('ceph_client_user_name')])
59   class { '::nova::compute::rbd':
60     libvirt_rbd_secret_key => $client_keys[$client_user]['secret'],
61   }
62 }
63
64 if hiera('cinder_enable_nfs_backend', false) {
65   if str2bool($::selinux) {
66     selboolean { 'virt_use_nfs':
67       value      => on,
68       persistent => true,
69     } -> Package['nfs-utils']
70   }
71
72   package {'nfs-utils': } -> Service['nova-compute']
73 }
74
75 include ::nova::compute::libvirt
76 if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
77   file {'/etc/libvirt/qemu.conf':
78     ensure  => present,
79     content => hiera('midonet_libvirt_qemu_data')
80   }
81 }
82 include ::nova::network::neutron
83 include ::neutron
84 include ::neutron::config
85
86 # If the value of core plugin is set to 'nuage',
87 # include nuage agent,
88 # If the value of core plugin is set to 'midonet',
89 # include midonet agent,
90 # else use the default value of 'ml2'
91 if hiera('neutron::core_plugin') == 'neutron.plugins.nuage.plugin.NuagePlugin' {
92   include ::nuage::vrs
93   include ::nova::compute::neutron
94
95   class { '::nuage::metadataagent':
96     nova_os_tenant_name => hiera('nova::api::admin_tenant_name'),
97     nova_os_password    => hiera('nova_password'),
98     nova_metadata_ip    => hiera('nova_metadata_node_ips'),
99     nova_auth_ip        => hiera('keystone_public_api_virtual_ip'),
100   }
101 }
102 elsif hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
103
104   # TODO(devvesa) provide non-controller ips for these services
105   $zookeeper_node_ips = hiera('neutron_api_node_ips')
106   $cassandra_node_ips = hiera('neutron_api_node_ips')
107
108   class {'::tripleo::network::midonet::agent':
109     zookeeper_servers => $zookeeper_node_ips,
110     cassandra_seeds   => $cassandra_node_ips
111   }
112 }
113 else {
114
115   include ::neutron::plugins::ml2
116   include ::neutron::agents::ml2::ovs
117
118   if 'cisco_n1kv' in hiera('neutron::plugins::ml2::mechanism_drivers') {
119     class { '::neutron::agents::n1kv_vem':
120       n1kv_source  => hiera('n1kv_vem_source', undef),
121       n1kv_version => hiera('n1kv_vem_version', undef),
122     }
123   }
124 }
125
126
127 include ::ceilometer
128 include ::ceilometer::config
129 include ::ceilometer::agent::compute
130 include ::ceilometer::agent::auth
131
132 $snmpd_user = hiera('snmpd_readonly_user_name')
133 snmp::snmpv3_user { $snmpd_user:
134   authtype => 'MD5',
135   authpass => hiera('snmpd_readonly_user_password'),
136 }
137 class { '::snmp':
138   agentaddress => ['udp:161','udp6:[::1]:161'],
139   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' ],
140 }
141
142 hiera_include('compute_classes')
143 package_manifest{'/var/lib/tripleo/installed-packages/overcloud_compute': ensure => present}