Skip to content
Snippets Groups Projects
keepalived.pp 1.37 KiB
Newer Older
  • Learn to ignore specific revisions
  • Giovanni Zizzi's avatar
    Giovanni Zizzi committed
    class iaas::profile::keepalived (
      $admin_interface = hiera('iaas::admin_interface', undef),
      $vip_address = hiera('iaas::role::endpoint::main_address',undef),
      $notification_email = undef,
      $notification_email_from = undef,
      $smtp_server = undef,
      $state = undef,
      $priority = undef,
      $lvs_interface = hiera('iaas::profile::keepalived::lvs_interface',undef),
    ) {
    
    sysctl::value { "net.ipv4.ip_nonlocal_bind": value => "1" }
    
    include keepalived
    
    
    Giovanni Zizzi's avatar
    Giovanni Zizzi committed
        ensure                  => present,
        notification_email      => $notification_email,
        notification_email_from => $notification_email_from,
        smtp_server             => $smtp_server,
        smtp_connect_timeout    => '60',
    
    Giovanni Zizzi's avatar
    Giovanni Zizzi committed
      } ->
    
    
    Giovanni Zizzi's avatar
    Giovanni Zizzi committed
        interval          => '1',
    
    Giovanni Zizzi's avatar
    Giovanni Zizzi committed
        script            => 'killall -0 haproxy',
      } ->
    
    
    Giovanni Zizzi's avatar
    Giovanni Zizzi committed
        interface         => $admin_interface,
        state             => $state,
    
        virtual_router_id => '21',
    
    Giovanni Zizzi's avatar
    Giovanni Zizzi committed
        priority          => $priority,
        auth_type         => 'PASS',
        auth_pass         => '1111',
        virtual_ipaddress => $vip_address,
        lvs_interface => $lvs_interface,
    
    Giovanni Zizzi's avatar
    Giovanni Zizzi committed
      } ->
    
      class { '::keepalived':
        service_restart => 'service keepalived reload',     # When using SysV Init
      }
    
    }