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