fuel-library/deployment/puppet/l23network/manifests/l3/defaultroute.pp
Andrew Woodward c1e3c4e74c Multiple Cluster Networks: IP routes
Adds new attributes 'is_default_route' and 'other_nets' to
 l23network::l3::ifconfig.

Adds ability for ns_IPaddr2 to consume other_nets

In multiple cluster networks it is necessary for interfaces each have their
 own gateway. This adds 'is_default_route' so that only one interface will
 receive the default gateway route. This is assured by nailgun.

It is also necessary for each interface to know the route to the other
 networks of the same network role from other NodeGroups in the cluster. These
 networks are expressed in 'other_nets' and with the 'gateway' and interface
 name will be used to add routes to the node

data used from asute.yaml

Neutron network provider:
network_scheme:
  endpoints:
...
    br-fw-admin:
      IP:
      - 10.108.47.3/24
      default_gateway: true
      gateway: 10.108.47.1
      other_nets:
      - 10.108.52.0/24
    br-mgmt:
      IP:
      - 10.108.49.2/24
      gateway: 10.108.49.1
      other_nets:
      - 10.108.54.0/24
...

Nova network provider:
network_data:
...
  eth1:
    default_gateway: true
    gateway: 10.108.48.1
    interface: eth1
    ipaddr:
    - 10.108.48.4/24
...

Adds disabled code to configure haproxy to keep vip points together
 There are some deployment cases where the deployer may need to
 enable this and this serves as the code example to perform it.

Resolves-bug #1272766
implments: blueprint multiple-cluster-networks

Change-Id: I06e09fd9b292cac53b925933006de064e725bdb0
2014-10-31 15:26:38 -07:00

46 lines
1.3 KiB
Puppet

# == Define: l23network::l3::defaultroute
#
# Do not use this directly,
# use l23network::l3::route instead
#
define l23network::l3::defaultroute (
$gateway = $name,
$metric = undef,
){
$exec_name = "Default route of ${name} metric ${metric}"
case $::osfamily {
/(?i)debian/: {
exec { $exec_name :
path => '/bin:/usr/bin:/sbin:/usr/sbin',
command => "ip route replace default via ${gateway}",
unless => "netstat -r | grep -q 'default.*${gateway}'",
}
}
/(?i)redhat/: {
Cfg <| name == $gateway |>
if ! defined(Cfg[$gateway]) {
cfg { $gateway:
file => '/etc/sysconfig/network',
key => 'GATEWAY',
value => $gateway,
} ->
# FIXME: we should not nuke the system with 'service network restart'...
# FIXME: but we should ensure default route will be created somehow
exec { $exec_name :
path => '/bin:/usr/bin:/sbin:/usr/sbin',
command => "ip route replace default via ${gateway} || true",
unless => "netstat -r | grep -q 'default.*${gateway}'",
}
}
}
default: {
fail("Unsupported OS: ${::osfamily}/${::operatingsystem}")
}
}
}
#
###