Skip to content

Commit 546de92

Browse files
committed
Merge pull request #125 from hswong3i/folsom
Update example/site.pp for Folsom
2 parents af0bbb0 + b2254ee commit 546de92

1 file changed

Lines changed: 191 additions & 70 deletions

File tree

‎examples/site.pp‎

Lines changed: 191 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,95 @@
1-
#
21
# This document serves as an example of how to deploy
32
# basic single and multi-node openstack environments.
4-
#
53

6-
# deploy a script that can be used to test nova
7-
class { 'openstack::test_file': }
8-
9-
####### shared variables ##################
4+
Exec {
5+
logoutput => true,
6+
}
107

8+
####### Start Shared Variables ##################
119

12-
# this section is used to specify global variables that will
10+
# This section is used to specify global variables that will
1311
# be used in the deployment of multi and single node openstack
14-
# environments
12+
# environments.
1513

16-
# assumes that eth0 is the public interface
14+
# Assumes that eth0 is the public interface.
1715
$public_interface = 'eth0'
18-
# assumes that eth1 is the interface that will be used for the vm network
16+
# Assumes that eth1 is the interface that will be used for the vm network
1917
# this configuration assumes this interface is active but does not have an
2018
# ip address allocated to it.
2119
$private_interface = 'eth1'
22-
# credentials
20+
$fixed_network_range = '10.1.0.0/16'
21+
$floating_network_range = '172.24.1.0/24'
22+
23+
# Database settings.
24+
$mysql_root_password = 'mysql_root_password'
25+
$keystone_db_password = 'keystone_db_password'
26+
$glance_db_password = 'glance_db_password'
27+
$nova_db_password = 'nova_db_password'
28+
$cinder_db_password = 'cinder_db_password'
29+
$quantum_db_password = 'quantum_db_password'
30+
31+
# Rabbit settings.
32+
$rabbit_password = 'rabbit_password'
33+
$rabbit_user = 'nova'
34+
35+
# Keystone settings.
2336
$admin_email = 'root@localhost'
2437
$admin_password = 'keystone_admin'
25-
$keystone_db_password = 'keystone_db_pass'
2638
$keystone_admin_token = 'keystone_admin_token'
27-
$nova_db_password = 'nova_pass'
28-
$nova_user_password = 'nova_pass'
29-
$glance_db_password = 'glance_pass'
30-
$glance_user_password = 'glance_pass'
31-
$rabbit_password = 'openstack_rabbit_password'
32-
$rabbit_user = 'openstack_rabbit_user'
33-
$fixed_network_range = '10.0.0.0/24'
34-
$floating_network_range = '192.168.101.64/28'
35-
# switch this to true to have all service log at verbose
36-
$verbose = false
37-
# by default it does not enable atomatically adding floating IPs
38-
$auto_assign_floating_ip = false
39-
40-
41-
#### end shared variables #################
42-
43-
# all nodes whose certname matches openstack_all should be
39+
$glance_user_password = 'glance_user_password'
40+
$nova_user_password = 'nova_user_password'
41+
$cinder_user_password = 'cinder_user_password'
42+
$quantum_user_password = 'quantum_user_password'
43+
44+
# Misc settings.
45+
$libvirt_type = 'kvm'
46+
$network_type = 'nova'
47+
$secret_key = 'secret_key'
48+
$verbose = true
49+
50+
#### End Shared Variables #################
51+
52+
#### Start Multi-node Specific Parameters #################
53+
54+
$controller_node_address = '172.24.0.11'
55+
$controller_node_public = $controller_node_address
56+
$controller_node_internal = $controller_node_address
57+
58+
#### End Multi-node Specific Parameters #################
59+
60+
if $network_type == 'nova' {
61+
$use_quantum = false
62+
$multi_host = true
63+
} else {
64+
$use_quantum = true
65+
}
66+
67+
# All nodes whose certname matches openstack_all should be
4468
# deployed as all-in-one openstack installations.
4569
node /openstack_all/ {
4670

71+
keystone_config {
72+
'DEFAULT/log_config': ensure => absent,
73+
}
74+
75+
# Deploy a script that can be used to test nova.
76+
class { 'openstack::test_file':
77+
quantum => $use_quantum,
78+
image_type => 'ubuntu',
79+
}
80+
81+
# Create a test volume on a loopback device for testing.
82+
# class { 'cinder::setup_test_volume': } -> Service<||>
83+
4784
include 'apache'
4885

4986
class { 'openstack::all':
5087
public_address => $ipaddress_eth0,
88+
internal_address => $ipaddress_eth0,
5189
public_interface => $public_interface,
5290
private_interface => $private_interface,
91+
mysql_root_password => $mysql_root_password,
92+
secret_key => $secret_key,
5393
admin_email => $admin_email,
5494
admin_password => $admin_password,
5595
keystone_db_password => $keystone_db_password,
@@ -58,13 +98,18 @@
5898
nova_user_password => $nova_user_password,
5999
glance_db_password => $glance_db_password,
60100
glance_user_password => $glance_user_password,
101+
quantum_user_password => $quantum_user_password,
102+
quantum_db_password => $quantum_db_password,
103+
cinder_user_password => $cinder_user_password,
104+
cinder_db_password => $cinder_db_password,
61105
rabbit_password => $rabbit_password,
62106
rabbit_user => $rabbit_user,
63-
libvirt_type => 'kvm',
107+
libvirt_type => $libvirt_type,
64108
floating_range => $floating_network_range,
65109
fixed_range => $fixed_network_range,
66110
verbose => $verbose,
67-
auto_assign_floating_ip => $auto_assign_floating_ip,
111+
quantum => $use_quantum,
112+
vncproxy_host => $ipaddress_eth0,
68113
}
69114

70115
class { 'openstack::auth_file':
@@ -73,79 +118,155 @@
73118
controller_node => '127.0.0.1',
74119
}
75120

121+
# TODO Not sure why this is required.
122+
# This has a bug, and is constantly added to the file.
123+
Package['libvirt'] ->
124+
file_line { 'quemu_hack':
125+
line => 'cgroup_device_acl = [
126+
"/dev/null", "/dev/full", "/dev/zero",
127+
"/dev/random", "/dev/urandom",
128+
"/dev/ptmx", "/dev/kvm", "/dev/kqemu",
129+
"/dev/rtc", "/dev/hpet", "/dev/net/tun",]',
130+
path => '/etc/libvirt/qemu.conf',
131+
ensure => present,
132+
} ~> Service['libvirt']
76133
}
77134

78-
# multi-node specific parameters
79-
80-
$controller_node_address = '192.168.101.11'
135+
# All nodes whose certname matches openstack_controller should be
136+
# deployed as openstack controller installations.
137+
node /openstack_controller/ {
81138

82-
$controller_node_public = $controller_node_address
83-
$controller_node_internal = $controller_node_address
84-
$sql_connection = "mysql://nova:${nova_db_password}@${controller_node_internal}/nova"
139+
keystone_config {
140+
'DEFAULT/log_config': ensure => absent,
141+
}
85142

86-
node /openstack_controller/ {
143+
package { 'python-cliff':
144+
ensure => present,
145+
}
87146

88-
# class { 'nova::volume': enabled => true }
147+
# Deploy a script that can be used to test nova.
148+
class { 'openstack::test_file':
149+
quantum => $use_quantum,
150+
image_type => 'ubuntu',
151+
}
89152

90-
# class { 'nova::volume::iscsi': }
153+
if $::osfamily == 'Debian' {
154+
include 'apache'
155+
} else {
156+
package { 'httpd':
157+
ensure => present
158+
}~>
159+
service { 'httpd':
160+
ensure => running,
161+
enable => true
162+
}
163+
}
91164

92165
class { 'openstack::controller':
166+
# Required Network.
93167
public_address => $controller_node_public,
94168
public_interface => $public_interface,
95169
private_interface => $private_interface,
96-
internal_address => $controller_node_internal,
97-
floating_range => $floating_network_range,
98-
fixed_range => $fixed_network_range,
99-
# by default it does not enable multi-host mode
100-
multi_host => true,
101-
# by default is assumes flat dhcp networking mode
102-
network_manager => 'nova.network.manager.FlatDHCPManager',
103-
verbose => $verbose,
104-
auto_assign_floating_ip => $auto_assign_floating_ip,
170+
# Required Database.
105171
mysql_root_password => $mysql_root_password,
172+
# Required Keystone.
106173
admin_email => $admin_email,
107174
admin_password => $admin_password,
108175
keystone_db_password => $keystone_db_password,
109176
keystone_admin_token => $keystone_admin_token,
177+
# Required Glance.
110178
glance_db_password => $glance_db_password,
111179
glance_user_password => $glance_user_password,
180+
# Required Nova.
112181
nova_db_password => $nova_db_password,
113182
nova_user_password => $nova_user_password,
183+
# Cinder.
184+
cinder_db_password => $cinder_db_password,
185+
cinder_user_password => $cinder_user_password,
186+
cinder => true,
187+
# Quantum.
188+
quantum => $use_quantum,
189+
quantum_db_password => $quantum_db_password,
190+
quantum_user_password => $quantum_user_password,
191+
# Horizon.
192+
secret_key => $secret_key,
193+
# Need to sort out networking...
194+
network_manager => 'nova.network.manager.FlatDHCPManager',
195+
fixed_range => $fixed_network_range,
196+
floating_range => $floating_network_range,
197+
create_networks => true,
198+
multi_host => $multi_host,
199+
db_host => '127.0.0.1',
200+
db_type => 'mysql',
201+
mysql_account_security => true,
202+
# TODO - This should not allow all...
203+
allowed_hosts => '%',
204+
# Glance.
205+
glance_api_servers => '127.0.0.1:9292',
114206
rabbit_password => $rabbit_password,
115207
rabbit_user => $rabbit_user,
116-
export_resources => false,
208+
# Horizon.
209+
cache_server_ip => '127.0.0.1',
210+
cache_server_port => '11211',
211+
swift => false,
212+
horizon_app_links => undef,
213+
# General.
214+
verbose => $verbose,
215+
purge_nova_config => true,
117216
}
118217

119218
class { 'openstack::auth_file':
120219
admin_password => $admin_password,
121220
keystone_admin_token => $keystone_admin_token,
122221
controller_node => $controller_node_internal,
123222
}
124-
125-
126223
}
127224

225+
# All nodes whose certname matches openstack_compute should be
226+
# deployed as openstack compute installations.
128227
node /openstack_compute/ {
129228

229+
# Create a test volume on a loopback device for testing.
230+
# class { 'cinder::setup_test_volume': } -> Service<||>
231+
130232
class { 'openstack::compute':
131-
public_interface => $public_interface,
132-
private_interface => $private_interface,
133-
internal_address => $ipaddress_eth0,
134-
libvirt_type => 'kvm',
135-
fixed_range => $fixed_network_range,
136-
network_manager => 'nova.network.manager.FlatDHCPManager',
137-
multi_host => true,
138-
sql_connection => $sql_connection,
139-
nova_user_password => $nova_user_password,
140-
rabbit_host => $controller_node_internal,
141-
rabbit_password => $rabbit_password,
142-
rabbit_user => $rabbit_user,
143-
glance_api_servers => "${controller_node_internal}:9292",
144-
vncproxy_host => $controller_node_public,
145-
vnc_enabled => true,
146-
verbose => $verbose,
147-
manage_volumes => true,
148-
nova_volume => 'nova-volumes'
233+
public_interface => $public_interface,
234+
private_interface => $private_interface,
235+
internal_address => $ipaddress_eth0,
236+
libvirt_type => $libvirt_type,
237+
sql_connection => "mysql://nova:${nova_db_password}@${controller_node_internal}/nova",
238+
cinder_sql_connection => "mysql://cinder:${cinder_db_password}@${controller_node_internal}/cinder",
239+
quantum_sql_connection => "mysql://quantum:${quantum_db_password}@${controller_node_internal}/quantum?charset=utf8",
240+
multi_host => $multi_host,
241+
fixed_range => $fixed_network_range,
242+
network_manager => 'nova.network.manager.FlatDHCPManager',
243+
nova_user_password => $nova_user_password,
244+
quantum => $use_quantum,
245+
quantum_host => $controller_node_internal,
246+
quantum_user_password => $quantum_user_password,
247+
rabbit_password => $rabbit_password,
248+
glance_api_servers => "${controller_node_internal}:9292",
249+
rabbit_host => $controller_node_internal,
250+
rabbit_user => $rabbit_user,
251+
keystone_host => $controller_node_internal,
252+
vncproxy_host => $controller_node_public,
253+
vnc_enabled => true,
254+
verbose => $verbose,
255+
purge_nova_config => true,
149256
}
150257

258+
# TODO Not sure why this is required.
259+
# This has a bug, and is constantly added to the file
260+
if $libvirt_type == 'qemu' {
261+
Package['libvirt'] ->
262+
file_line { 'quemu_hack':
263+
line => 'cgroup_device_acl = [
264+
"/dev/null", "/dev/full", "/dev/zero",
265+
"/dev/random", "/dev/urandom",
266+
"/dev/ptmx", "/dev/kvm", "/dev/kqemu",
267+
"/dev/rtc", "/dev/hpet", "/dev/net/tun",]',
268+
path => '/etc/libvirt/qemu.conf',
269+
ensure => present,
270+
} ~> Service['libvirt']
271+
}
151272
}

0 commit comments

Comments
 (0)