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