-
Notifications
You must be signed in to change notification settings - Fork 21
/
contrail_openstack.pp
128 lines (122 loc) · 4.54 KB
/
contrail_openstack.pp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# == Class: contrail::contrail_openstack
#
# This class is used to configure software and services required
# to perfrom any additional functionality required on openstack node
# by contrail modules (e.g. create openstackrc, keystonerc, ec2rc files etc).
# Any new code needed to be executed on openstack node by contrail should be
# added here.
#
# === Parameters:
#
# [*openstack_ip*]
# IP address of server running openstack services. If the server has
# separate interfaces for management and control, this parameter
# should provide control interface IP address.
#
# [*keystone_ip*]
# IP address of server running keystone service. Should be specified if
# keystone is running on a server other than openstack server.
# (optional) - Defaults to "", meaning use openstack_ip.
#
# [*internal_vip*]
# Virtual mgmt IP address for openstack modules
# (optional) - Defaults to ""
#
# [*external_vip*]
# Virtual IP address to be used for openstack HA functionality on
# management interface.
#
# [*openstack_mgmt_ip*]
# Management interface address of openstack node (if management and control are separate
# interfaces on that node)
# (optional) - Defaults to "", meaning use openstack_ip.
#
# [*keystone_admin_user*]
# Keystone admin user.
# (optional) - Defaults to "admin".
#
# [*keystone_admin_password*]
# Keystone admin password.
# (optional) - Defaults to "contrail123"
#
# [*keystone_admin_tenant*]
# Keystone admin tenant name.
# (optional) - Defaults to "admin".
#
# [*keystone_service_token*]
# openstack service token value.
# (optional) - Defaults to "contrail123"
#
# [*keystone_auth_protocol*]
# Keystone authentication protocol.
# (optional) - Defaults to "http".
#
# [*contrail_logoutput*]
# Variable to specify if output of exec commands is to be logged or not.
# Values are true, false or on_failure
# (optional) - Defaults to false
#
# [*enable_ceilometer*]
# Flag to include or exclude ceilometer service as part of openstack module dynamically.
# (optional) - Defaults to false.
#
class contrail::contrail_openstack (
$openstack_ip = $::contrail::params::openstack_ip_list[0],
$keystone_ip = $::contrail::params::keystone_ip,
$internal_vip = $::contrail::params::internal_vip,
$external_vip = $::contrail::params::external_vip,
$openstack_mgmt_ip = $::contrail::params::openstack_mgmt_ip_list_to_use[0],
$keystone_admin_user = $::contrail::params::keystone_admin_user,
$keystone_admin_password = $::contrail::params::keystone_admin_password,
$keystone_admin_tenant = $::contrail::params::keystone_admin_tenant,
$keystone_service_token = $::contrail::params::keystone_service_token,
$keystone_auth_protocol = $::contrail::params::keystone_auth_protocol,
$contrail_logoutput = $::contrail::params::contrail_logoutput,
$host_control_ip = $::contrail::params::host_ip,
$enable_ceilometer = $::contrail::params::enable_ceilometer,
) {
# Main code for class
#slect the novncproxy based on presence of internal_vip
if ($internal_vip != ''){
$novncproxy_port = '6999'
$vnc_proxy_host = $host_control_ip
} else {
$novncproxy_port = '5999'
$vnc_proxy_host = $openstack_mgmt_ip
}
if ($external_vip != '') {
$vnc_base_url_ip = $external_vip
} elsif ($internal_vip != '' ) {
$vnc_base_url_ip = $internal_vip
} else {
$vnc_base_url_ip = $openstack_mgmt_ip
}
include ::contrail::openstackrc
# Create mysql token file.
file { '/etc/contrail/mysql.token' :
ensure => present,
mode => '0400',
group => root,
content => $::contrail::params::mysql_root_password
} ->
# Create keystonerc file.
file { '/etc/contrail/keystonerc' :
ensure => present,
content => template("${module_name}/keystonerc.erb"),
} ->
class {'::contrail::exec_create_ec2rc_file':}
$nova_params = {
'DEFAULT/novncproxy_base_url' => { value => "http://${vnc_base_url_ip}:${novncproxy_port}/vnc_auto.html"},
'DEFAULT/ec2_private_dns_show_ip' => { value => 'False' },
}
create_resources(nova_config,$nova_params, {} )
#include ::contrail::exec_disable_mpm_event
if ($enable_ceilometer) {
# Set instance_usage_audit_period to hour
$ceilometer_nova_params = {
'DEFAULT/instance_usage_audit_period' => { value => 'hour' },
'DEFAULT/instance_usage_audit' => { value => 'True' },
}
create_resources(nova_config,$ceilometer_nova_params, {} )
}
}