|
1 | | -# |
2 | 1 | # This document serves as an example of how to deploy |
3 | 2 | # basic single and multi-node openstack environments. |
4 | | -# |
5 | 3 |
|
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 | +} |
10 | 7 |
|
| 8 | +####### Start Shared Variables ################## |
11 | 9 |
|
12 | | -# this section is used to specify global variables that will |
| 10 | +# This section is used to specify global variables that will |
13 | 11 | # be used in the deployment of multi and single node openstack |
14 | | -# environments |
| 12 | +# environments. |
15 | 13 |
|
16 | | -# assumes that eth0 is the public interface |
| 14 | +# Assumes that eth0 is the public interface. |
17 | 15 | $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 |
19 | 17 | # this configuration assumes this interface is active but does not have an |
20 | 18 | # ip address allocated to it. |
21 | 19 | $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. |
23 | 36 | $admin_email = 'root@localhost' |
24 | 37 | $admin_password = 'keystone_admin' |
25 | | -$keystone_db_password = 'keystone_db_pass' |
26 | 38 | $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 |
44 | 68 | # deployed as all-in-one openstack installations. |
45 | 69 | node /openstack_all/ { |
46 | 70 |
|
| 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 | + |
47 | 84 | include 'apache' |
48 | 85 |
|
49 | 86 | class { 'openstack::all': |
50 | 87 | public_address => $ipaddress_eth0, |
| 88 | + internal_address => $ipaddress_eth0, |
51 | 89 | public_interface => $public_interface, |
52 | 90 | private_interface => $private_interface, |
| 91 | + mysql_root_password => $mysql_root_password, |
| 92 | + secret_key => $secret_key, |
53 | 93 | admin_email => $admin_email, |
54 | 94 | admin_password => $admin_password, |
55 | 95 | keystone_db_password => $keystone_db_password, |
|
58 | 98 | nova_user_password => $nova_user_password, |
59 | 99 | glance_db_password => $glance_db_password, |
60 | 100 | 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, |
61 | 105 | rabbit_password => $rabbit_password, |
62 | 106 | rabbit_user => $rabbit_user, |
63 | | - libvirt_type => 'kvm', |
| 107 | + libvirt_type => $libvirt_type, |
64 | 108 | floating_range => $floating_network_range, |
65 | 109 | fixed_range => $fixed_network_range, |
66 | 110 | verbose => $verbose, |
67 | | - auto_assign_floating_ip => $auto_assign_floating_ip, |
| 111 | + quantum => $use_quantum, |
| 112 | + vncproxy_host => $ipaddress_eth0, |
68 | 113 | } |
69 | 114 |
|
70 | 115 | class { 'openstack::auth_file': |
|
73 | 118 | controller_node => '127.0.0.1', |
74 | 119 | } |
75 | 120 |
|
| 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'] |
76 | 133 | } |
77 | 134 |
|
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/ { |
81 | 138 |
|
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 | + } |
85 | 142 |
|
86 | | -node /openstack_controller/ { |
| 143 | + package { 'python-cliff': |
| 144 | + ensure => present, |
| 145 | + } |
87 | 146 |
|
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 | + } |
89 | 152 |
|
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 | + } |
91 | 164 |
|
92 | 165 | class { 'openstack::controller': |
| 166 | + # Required Network. |
93 | 167 | public_address => $controller_node_public, |
94 | 168 | public_interface => $public_interface, |
95 | 169 | 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. |
105 | 171 | mysql_root_password => $mysql_root_password, |
| 172 | + # Required Keystone. |
106 | 173 | admin_email => $admin_email, |
107 | 174 | admin_password => $admin_password, |
108 | 175 | keystone_db_password => $keystone_db_password, |
109 | 176 | keystone_admin_token => $keystone_admin_token, |
| 177 | + # Required Glance. |
110 | 178 | glance_db_password => $glance_db_password, |
111 | 179 | glance_user_password => $glance_user_password, |
| 180 | + # Required Nova. |
112 | 181 | nova_db_password => $nova_db_password, |
113 | 182 | 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', |
114 | 206 | rabbit_password => $rabbit_password, |
115 | 207 | 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, |
117 | 216 | } |
118 | 217 |
|
119 | 218 | class { 'openstack::auth_file': |
120 | 219 | admin_password => $admin_password, |
121 | 220 | keystone_admin_token => $keystone_admin_token, |
122 | 221 | controller_node => $controller_node_internal, |
123 | 222 | } |
124 | | - |
125 | | - |
126 | 223 | } |
127 | 224 |
|
| 225 | +# All nodes whose certname matches openstack_compute should be |
| 226 | +# deployed as openstack compute installations. |
128 | 227 | node /openstack_compute/ { |
129 | 228 |
|
| 229 | + # Create a test volume on a loopback device for testing. |
| 230 | +# class { 'cinder::setup_test_volume': } -> Service<||> |
| 231 | + |
130 | 232 | 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, |
149 | 256 | } |
150 | 257 |
|
| 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 | + } |
151 | 272 | } |
0 commit comments