Puppet Class: keepalived

Defined in:
modules/keepalived/manifests/init.pp

Overview

Parameters:

  • peers (Array[Stdlib::Fqdn])
  • auth_pass (String)
  • vips (Array[Stdlib::IP::Address])
  • default_state (Enum['BACKUP', 'MASTER']) (defaults to: 'BACKUP')
  • interface (String) (defaults to: 'eth0')
  • priority (Integer) (defaults to: fqdn_rand(100))
  • virtual_router_id (Integer) (defaults to: 51)


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'modules/keepalived/manifests/init.pp', line 21

class keepalived(
    Array[Stdlib::Fqdn] $peers,
    String              $auth_pass,
    Array[Stdlib::IP::Address] $vips,
    Enum['BACKUP', 'MASTER']   $default_state = 'BACKUP',
    String              $interface            = 'eth0',
    Integer             $priority             = fqdn_rand(100),
    Integer             $virtual_router_id    = 51,
) {
    package { 'keepalived':
        ensure => present,
    }

    file { '/etc/keepalived/keepalived.conf':
        ensure    => present,
        mode      => '0444',
        owner     => 'root',
        group     => 'root',
        content   => template('keepalived/keepalived.conf.erb'),
        show_diff => false,
        require   => Package['keepalived'],
        notify    => Exec['restart-keepalived'],
    }

    exec { 'restart-keepalived':
        command     => '/bin/systemctl restart keepalived',
        refreshonly => true,
    }
}