Puppet Class: openstack::setup::sharednetwork

Defined in:
manifests/setup/sharednetwork.pp

Overview

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.



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
# File 'manifests/setup/sharednetwork.pp', line 8

class openstack::setup::sharednetwork {

  $external_network = hiera('openstack::network::external')
  $start_ip = hiera('openstack::network::external::ippool::start')
  $end_ip   = hiera('openstack::network::external::ippool::end')
  $ip_range = "start=${start_ip},end=${end_ip}"
  $gateway  = hiera('openstack::network::external::gateway')
  $dns      = hiera('openstack::network::external::dns')

  $private_network = hiera('openstack::network::neutron::private')

  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_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_nameservers  => [$dns],
  } 

  openstack::setup::router { "test:${private_network}": }
}