Defined Type: interface::alias

Defined in:
modules/interface/manifests/alias.pp

Overview

SPDX-License-Identifier: Apache-2.0 Simplified version of interface::ip, only used for adding secondary IPs to hosts

Parameters:

  • interface (Any) (defaults to: $facts['interface_primary'])
  • ipv4 (Any) (defaults to: undef)
  • ipv6 (Any) (defaults to: undef)


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'modules/interface/manifests/alias.pp', line 4

define interface::alias(
  $interface=$facts['interface_primary'],
  $ipv4=undef,
  $ipv6=undef,
) {
    if $ipv4 != undef {
        interface::ip { "${title} ipv4":
            interface => $interface,
            address   => $ipv4,
            prefixlen => 32,
        }
    }

    if $ipv6 != undef {
        interface::ip { "${title} ipv6":
            interface => $interface,
            address   => $ipv6,
            prefixlen => 128,
            # mark as deprecated = never pick this address unless explicitly asked
            options   => 'preferred_lft 0',
        }
    }
}