Defined Type: keepalived::vrrp::unicast_peer

Defined in:
manifests/vrrp/unicast_peer.pp

Summary

Define a unicast peer for a vrrp instance.

Overview

Examples:

Define a known, static unicast peer

keepalived::vrrp::unicast_peer { '10.1.2.3':
  instance => 'my_vrrp_instance_name',
}

Export ourselves as a unicast peer for other peers to import

@@keepalived::vrrp::unicast_peer { $facts['networking']['ip']:
  instance => 'my_vrrp_instance_name',
}

Parameters:

  • instance (String)

    Name of vrrp instance this peer belongs to.

  • ip_address (Stdlib::IP::Address) (defaults to: $name)

    IP address of unicast peer. Defaults to $name.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'manifests/vrrp/unicast_peer.pp', line 21

define keepalived::vrrp::unicast_peer (
  String $instance,
  Stdlib::IP::Address $ip_address = $name,
) {
  assert_private()

  $_inst = regsubst($instance, '[:\/\n]', '', 'G')
  $_ordersafe = regsubst($_inst, '-', '', 'G')

  concat::fragment { "keepalived.conf_vrrp_instance_${_inst}_upeers_peer_${ip_address}":
    target  => "${keepalived::config_dir}/keepalived.conf",
    content => "    ${ip_address}\n",
    order   => "100-${_ordersafe}-020",
  }
}