Skip to content
This repository has been archived by the owner on May 14, 2019. It is now read-only.

Commit

Permalink
Remove router and sharednetwork setup classes
Browse files Browse the repository at this point in the history
The openstack::setup::router and openstack::setup::sharednetwork
classes only create two networks and one router with very little
configuration options. This change moves the network data into the
example hiera files and uses create_resources on a hash to create as
many networks, subnets, and routers are the user wants. We move this
into openstack::profile::neutron::router since these resources will
always reside on the network node.
  • Loading branch information
Colleen Murphy committed Apr 24, 2015
1 parent 0fdb812 commit 308643a
Show file tree
Hide file tree
Showing 9 changed files with 152 additions and 121 deletions.
46 changes: 37 additions & 9 deletions examples/allinone.yaml
Expand Up @@ -3,18 +3,46 @@ openstack::region: 'openstack'
######## Networks
openstack::network::api: '192.168.11.0/24'
openstack::network::external: '192.168.22.0/24'
openstack::networks:
public:
tenant_name: 'services'
provider_network_type: 'gre'
router_external: true
provider_segmentation_id: 3604
shared: true
private:
tenant_name: 'services'
provider_network_type: 'gre'
router_external: false
provider_segmentation_id: 4063
shared: true
openstack::subnets:
'192.168.22.0/24':
cidr: '192.168.22.0/24'
ip_version: '4'
gateway_ip: 192.168.22.2
enable_dhcp: false
network_name: 'public'
tenant_name: 'services'
allocation_pools: ['start=192.168.22.100,end=192.168.22.200']
dns_nameservers: [192.168.22.2]
'10.0.0.0/24':
cidr: '10.0.0.0/24'
ip_version: '4'
enable_dhcp: true
network_name: 'private'
tenant_name: 'services'
dns_nameservers: [192.168.22.2]
openstack::routers:
test:
tenant_name: 'test'
gateway_network_name: 'public'
openstack::router_interfaces:
'test:10.0.0.0/24': {}

openstack::network::management: '172.16.33.0/24'
openstack::network::data: '172.16.44.0/24'

openstack::network::external::ippool::start: 192.168.22.100
openstack::network::external::ippool::end: 192.168.22.200
openstack::network::external::gateway: 192.168.22.2
openstack::network::external::dns: 192.168.22.2

######## Private Neutron Network

openstack::network::neutron::private: '10.0.0.0/24'

######## Fixed IPs (controllers)

openstack::controller::address::api: '192.168.11.4'
Expand Down
46 changes: 37 additions & 9 deletions examples/common.yaml
Expand Up @@ -3,18 +3,46 @@ openstack::region: 'openstack'
######## Networks
openstack::network::api: '192.168.11.0/24'
openstack::network::external: '192.168.22.0/24'
openstack::networks:
public:
tenant_name: 'services'
provider_network_type: 'gre'
router_external: true
provider_segmentation_id: 3604
shared: true
private:
tenant_name: 'services'
provider_network_type: 'gre'
router_external: false
provider_segmentation_id: 4063
shared: true
openstack::subnets:
'192.168.22.0/24':
cidr: '192.168.22.0/24'
ip_version: '4'
gateway_ip: 192.168.22.2
enable_dhcp: false
network_name: 'public'
tenant_name: 'services'
allocation_pools: ['start=192.168.22.100,end=192.168.22.200']
dns_nameservers: [192.168.22.2]
'10.0.0.0/24':
cidr: '10.0.0.0/24'
ip_version: '4'
enable_dhcp: true
network_name: 'private'
tenant_name: 'services'
dns_nameservers: [192.168.22.2]
openstack::routers:
test:
tenant_name: 'test'
gateway_network_name: 'public'
openstack::router_interfaces:
'test:10.0.0.0/24': {}

openstack::network::management: '172.16.33.0/24'
openstack::network::data: '172.16.44.0/24'

openstack::network::external::ippool::start: 192.168.22.100
openstack::network::external::ippool::end: 192.168.22.200
openstack::network::external::gateway: 192.168.22.2
openstack::network::external::dns: 192.168.22.2

######## Private Neutron Network

openstack::network::neutron::private: '10.0.0.0/24'

######## Fixed IPs (controllers)

openstack::controller::address::api: '192.168.11.4'
Expand Down
4 changes: 4 additions & 0 deletions manifests/config.pp
Expand Up @@ -3,6 +3,10 @@
$use_hiera = undef,
$region = undef,
$network_api = undef,
$networks = undef,
$subnets = undef,
$routers = undef,
$router_interfaces = undef,
$network_external = undef,
$network_management = undef,
$network_data = undef,
Expand Down
90 changes: 67 additions & 23 deletions manifests/init.pp
Expand Up @@ -24,6 +24,61 @@
# The CIDR of the api network. This is the network that all public
# api calls are made on, as well as the network to access Horizon.
#
# [*networks*]
# (optional) Hash of neutron networks. Example:
# {
# 'public' => {
# 'tenant_name' => 'services',
# 'provider_network_type' => 'gre',
# 'router_external' => true,
# 'provider_segmentation_id' => 3604,
# 'shared' => true,
# }
# }
# Consult the neutron_network documentation for more information.
# Defaults to {}.
#
# [*subnets*]
# (optional) Hash of neutron subnets. Example:
# {
# '192.168.22.0/24' => {
# 'cidr' => '192.168.22.0/24',
# 'ip_version' => '4',
# 'gateway_ip' => '192.168.22.2',
# 'enable_dhcp' => false,
# 'network_name' => 'public',
# 'tenant_name' => 'services',
# 'allocation_pools' => ['start=192.168.22.100,end=192.168.22.200'],
# 'dns_nameservers' => [192.168.22.2],
# }
# }
# Consult the neutron_subnet documentation for more information.
# Defaults to {}.
#
# [*routers*]
# (optional) Hash of neutron routers. Example:
# {
# 'test' => {
# 'tenant_name' => 'test',
# 'gateway_network_name' => 'public',
# }
# }
# Consult the neutron_router documentation for more information.
# Defaults to {}.
#
# [*router_interfaces*]
# (optional) Hash of neutron router interfaces. The key has the form
# tenant:subnet where the subnet is one of the subnets given by the
# $subnets parameter. Example:
# {
# 'test:10.0.0.0/24' => {
# ensure => present,
# }
# }
# Consult the neutron_router_interface documentation for more
# information.
# Defaults to {}.
#
# [*network_external*]
# The CIDR of the external network. May be the same as network_api.
# This is the network that floating IP addresses are allocated in
Expand All @@ -35,24 +90,6 @@
# [*network_data*]
# The CIDR of the data network. May be the same as network_management.
#
# [*network_external_ippool_start*]
# The starting address of the external network IP pool. Must be contained
# within the network_external CIDR range.
#
# [*network_external_ippool_end*]
# The end address of the external network IP pool. Must be contained within
# the network_external CIDR range, and greater than network_external_ippool_start.
#
# [*network_external_gateway*]
# The gateway address for the external network.
#
# [*network_external_dns*]
# The DNS server for the external network.
#
# == Private Neutron Network
# [*network_neutron_private*]
# The CIDR of the automatically created private network.
#
# == Fixed IPs (controllers)
# [*controller_address_api*]
# The API IP address of the controller node. Must be in the network_api CIDR.
Expand Down Expand Up @@ -316,6 +353,10 @@
$use_hiera = true,
$region = undef,
$network_api = undef,
$networks = undef,
$subnets = undef,
$routers = undef,
$router_interfaces = undef,
$network_external = undef,
$network_management = undef,
$network_data = undef,
Expand Down Expand Up @@ -401,14 +442,13 @@
class { '::openstack::config':
region => hiera(openstack::region),
network_api => hiera(openstack::network::api),
networks => hiera(openstack::networks, {}),
subnets => hiera(openstack::subnets, {}),
routers => hiera(openstack::routers, {}),
router_interfaces => hiera(openstack::router_interfaces, {}),
network_external => hiera(openstack::network::external),
network_management => hiera(openstack::network::management),
network_data => hiera(openstack::network::data),
network_external_ippool_start => hiera(openstack::network::external::ippool::start),
network_external_ippool_end => hiera(openstack::network::external::ippool::end),
network_external_gateway => hiera(openstack::network::external::gateway),
network_external_dns => hiera(openstack::network::external::dns),
network_neutron_private => hiera(openstack::network::neutron::private),
controller_address_api => hiera(openstack::controller::address::api),
controller_address_management => hiera(openstack::controller::address::management),
storage_address_api => hiera(openstack::storage::address::api),
Expand Down Expand Up @@ -486,6 +526,10 @@
class { '::openstack::config':
region => $region,
network_api => $network_api,
networks => $networks,
subnets => $subnets,
routers => $routers,
router_interfaces => $router_interfaces,
network_external => $network_external,
network_management => $network_management,
network_data => $network_data,
Expand Down
7 changes: 7 additions & 0 deletions manifests/profile/neutron/router.pp
Expand Up @@ -65,4 +65,11 @@
# External bridge already has the external device's IP, thus the external
# device has already been linked
}

$defaults = { 'ensure' => 'present' }
create_resources('neutron_network', $::openstack::config::networks, $defaults)
create_resources('neutron_subnet', $::openstack::config::subnets, $defaults)
create_resources('neutron_router', $::openstack::config::routers, $defaults)
create_resources('neutron_router_interface', $::openstack::config::router_interfaces, $defaults)

}
1 change: 0 additions & 1 deletion manifests/role/allinone.pp
Expand Up @@ -18,6 +18,5 @@
class { '::openstack::profile::heat::api': }
class { '::openstack::profile::horizon': }
class { '::openstack::profile::auth_file': }
class { '::openstack::setup::sharednetwork': }

}
1 change: 0 additions & 1 deletion manifests/role/network.pp
@@ -1,5 +1,4 @@
class openstack::role::network inherits ::openstack::role {
class { '::openstack::profile::firewall': }
class { '::openstack::profile::neutron::router': }
class { '::openstack::setup::sharednetwork': }
}
22 changes: 0 additions & 22 deletions manifests/setup/router.pp

This file was deleted.

56 changes: 0 additions & 56 deletions manifests/setup/sharednetwork.pp

This file was deleted.

0 comments on commit 308643a

Please sign in to comment.