Puppet Class: psick::keepalived::static

Defined in:
manifests/keepalived/static.pp

Overview

Class to manage keepalived with static data Use psick::keepalived + psick::keepalived::balanced_host for dynamic management based on exported resurces

Parameters:

  • ensure (Enum['present','absent']) (defaults to: 'present')
  • config_dir_source (Variant[String[1],Undef]) (defaults to: undef)
  • config_file_template (String) (defaults to: 'psick/keepalived/keepalived.conf.erb')


5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
# File 'manifests/keepalived/static.pp', line 5

class psick::keepalived::static (
  Enum['present','absent'] $ensure                     = 'present',

  Variant[String[1],Undef] $config_dir_source          = undef,
  String                   $config_file_template       = 'psick/keepalived/keepalived.conf.erb',
) {

  $options_default = {
    'notification_email_from' => "info@${::domain}",
    'smtp_server'             => 'localhost',
    'smtp_connect_timeout'    => '30',
    'lvs_id'                  =>  $::hostname,
  }
  $virtualservers=hiera_hash('lb_virtualservers', {} )
  $options_user=hiera_hash('psick::keepalived::static::options', {} )
  $options=merge($options_default,$options_user)

  ::tp::install { 'keepalived':
    ensure => $ensure,
  }

  if $config_file_template != '' {
    ::tp::conf { 'keepalived':
      ensure       => $ensure,
      template     => $config_file_template,
      options_hash => $options,
    }
  }

  ::tp::dir { 'keepalived::services':
    ensure => $ensure,
    path   => '/etc/keepalived/services',
    source => $config_dir_source,
  }

  $virtualservers.each | $vs , $params | {
    psick::keepalived::virtualserver_static { $vs:
      * => $params,
    }
  }

}