Newer
Older
Alessandro Costantini
committed
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
# A static class to set up a shared network. Should appear on the
# controller node. It sets up the public network, a private network,
# two subnets (one for admin, one for test), and the routers that
# connect the subnets to the public network.
#
# After this class has run, you should have a functional network
# avaiable for your test user to launch and connect machines to.
class iaas::setup::sharednetwork (
#New variable definition
# tenant where configure network defined as yaml variable
$tenant = hiera('iaas::profile::network::tenant', undef),
$external_network = hiera('iaas::profile::neutron::external_network', undef),
$gateway = hiera('iaas::profile::neutron::external_gateway', undef),
# $dns = hiera('iaas::profile::base::dns_servers', undef),
$start_ip = hiera('iaas::profile::neutron::network_external_ippool_start', undef),
$end_ip = hiera('iaas::profile::neutron::network_external_ippool_end', undef),
$private_network = hiera('iaas::profile::neutron::network_neutron_private', undef),
) {
$ip_range = "start=${start_ip},end=${end_ip}"
notify {"debug message: ${start_ip}; ${end_ip}; ${ip_range}":
loglevel => alert
}
neutron_network { 'public':
tenant_name => 'services',
provider_network_type => 'gre',
router_external => true,
provider_segmentation_id => 3604,
shared => true,
} ->
neutron_subnet { $external_network:
cidr => $external_network,
ip_version => '4',
gateway_ip => $gateway,
enable_dhcp => false,
network_name => 'public',
tenant_name => 'services',
allocation_pools => [$ip_range],
#DNS commented
# dns_nameservers => [$dns],
}
neutron_network { 'private':
tenant_name => 'services',
provider_network_type => 'gre',
router_external => false,
provider_segmentation_id => 4063,
shared => true,
} ->
neutron_subnet { $private_network:
cidr => $private_network,
ip_version => '4',
enable_dhcp => true,
network_name => 'private',
tenant_name => 'services',
#DNS commented
# dns_nameservers => [$dns],
}
# router setup for the selected tenant
iaas::setup::router { "${tenant}:${private_network}": }
}