Defined Type: network::alias

Defined in:
manifests/alias.pp

Overview

Definition: network::alias

Creates an alias on an interface with a static IP address. There is an assumption that an aliased interface will never use DHCP.

Parameters:

$ensure         - required - up|down
$ipaddress      - required
$netmask        - required
$gateway        - optional
$noaliasrouting - optional - defaults to false
$userctl        - optional - defaults to false
$zone           - optional
$metric         - optional

Actions:

Deploys the file /etc/sysconfig/network-scripts/ifcfg-$name.

Sample Usage:

network::alias { 'eth0:1':
  ensure         => 'up',
  ipaddress      => '1.2.3.5',
  netmask        => '255.255.255.0',
  noaliasrouting => true,
}

Authors:

Mike Arnold <mike@razorsedge.org>

Copyright © 2011 Mike Arnold, unless otherwise noted.

Parameters:

  • ensure (Any)
  • ipaddress (Any)
  • netmask (Any)
  • gateway (Any) (defaults to: undef)
  • noaliasrouting (Any) (defaults to: false)
  • ipv6address (Any) (defaults to: undef)
  • ipv6gateway (Any) (defaults to: undef)
  • userctl (Any) (defaults to: false)
  • zone (Any) (defaults to: undef)
  • metric (Any) (defaults to: undef)


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
68
69
70
71
72
73
# File 'manifests/alias.pp', line 38

define network::alias (
  $ensure,
  $ipaddress,
  $netmask,
  $gateway = undef,
  $noaliasrouting = false,
  $ipv6address = undef,
  $ipv6gateway = undef,
  $userctl = false,
  $zone = undef,
  $metric = undef
) {
  # Validate our data
  if ! is_ip_address($ipaddress) { fail("${ipaddress} is not an IP address.") }
  # Validate our booleans
  validate_bool($noaliasrouting)
  validate_bool($userctl)

  network_if_base { $title:
    ensure         => $ensure,
    ipaddress      => $ipaddress,
    netmask        => $netmask,
    gateway        => $gateway,
    noaliasrouting => $noaliasrouting,
    ipv6address    => $ipv6address,
    ipv6gateway    => $ipv6gateway,
    macaddress     => '',
    bootproto      => 'none',
    userctl        => $userctl,
    mtu            => '',
    ethtool_opts   => '',
    isalias        => true,
    zone           => $zone,
    metric         => $metric,
  }
}