inuits/puppet-keepalived

Name: puppet-keepalived

Owner: Inuits

Description: null

Created: 2015-08-04 11:57:37.0

Updated: 2015-08-04 11:57:38.0

Pushed: 2015-06-22 11:25:50.0

Homepage: http://arioch.github.com/puppet-keepalived/

Size: 1304

Language: Ruby

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Puppet Keepalived

Build status

Build Status

Requirements
Tested on…
Example usage
Basic IP-based VRRP failover

This configuration will fail-over when:

a. Master node is unavailable

 /node01/ {
clude keepalived

epalived::vrrp::instance { 'VI_50':
interface         => 'eth1',
state             => 'MASTER',
virtual_router_id => '50',
priority          => '101',
auth_type         => 'PASS',
auth_pass         => 'secret',
virtual_ipaddress => [ '10.0.0.1/29' ],
track_interface   => ['eth1','tun0'], # optional, monitor these interfaces.



 /node02/ {
clude keepalived

epalived::vrrp::instance { 'VI_50':
interface         => 'eth1',
state             => 'BACKUP',
virtual_router_id => '50',
priority          => '100',
auth_type         => 'PASS',
auth_pass         => 'secret',
virtual_ipaddress => [ '10.0.0.1/29' ],
track_interface   => ['eth1','tun0'], # optional, monitor these interfaces.


Add floating routes
 /node01/ {
clude keepalived

epalived::vrrp::instance { 'VI_50':
interface         => 'eth1',
state             => 'MASTER',
virtual_router_id => '50',
priority          => '101',
auth_type         => 'PASS',
auth_pass         => 'secret',
virtual_ipaddress => [ '10.0.0.1/29' ],
virtual_routes    => [ { to  => '168.168.2.0/24', via => '10.0.0.2' },
                       { to  => '168.168.3.0/24', via => '10.0.0.3' } ]


Detect application level failure

This configuration will fail-over when:

a. NGinX daemon is not running
b. Master node is unavailable

 /node01/ {
clude ::keepalived

epalived::vrrp::script { 'check_nginx':
script => '/usr/bin/killall -0 nginx',


epalived::vrrp::instance { 'VI_50':
interface         => 'eth1',
state             => 'MASTER',
virtual_router_id => '50',
priority          => '101',
auth_type         => 'PASS',
auth_pass         => 'secret',
virtual_ipaddress => '10.0.0.1/29',
track_script      => 'check_nginx',



 /node02/ {
clude ::keepalived

epalived::vrrp::script { 'check_nginx':
script => '/usr/bin/killall -0 nginx',


epalived::vrrp::instance { 'VI_50':
interface         => 'eth1',
state             => 'BACKUP',
virtual_router_id => '50',
priority          => '100',
auth_type         => 'PASS',
auth_pass         => 'secret',
virtual_ipaddress => '10.0.0.1/29',
track_script      => 'check_nginx',


Global definitions
s { 'keepalived::global_defs':
sure                  => present,
tification_email      => 'no@spam.tld',
tification_email_from => 'no@spam.tld',
tp_server             => 'localhost',
tp_connect_timeout    => '60',
uter_id               => 'your_router_instance_id',

Soft-restart the Keepalived daemon
s { '::keepalived':
rvice_restart => 'service keepalived reload',     # When using SysV Init
service_restart => 'systemctl reload keepalived', # When using SystemD

Opt out of having the service managed by the module
s { '::keepalived':
rvice_manage => false,

Unicast instead of Multicast

caution: unicast support has only been added to Keepalived since version 1.2.8

By default Keepalived will use multicast packets to determine failover conditions. However, in many cloud environments it is not possible to use multicast because of network restrictions. Keepalived can be configured to use unicast in such environments:

epalived::vrrp::instance { 'VI_50':
interface         => 'eth1',
state             => 'BACKUP',
virtual_router_id => '50',
priority          => '100',
auth_type         => 'PASS',
auth_pass         => 'secret',
virtual_ipaddress => '10.0.0.1/29',
track_script      => 'check_nginx',
unicast_source_ip => $::ipaddress_eth1,
unicast_peers     => ['10.0.0.1', '10.0.0.2']

The 'unicast_source_ip' parameter is optional as Keepalived will bind to the specified interface by default. The 'unicast_peers' parameter contains an array of ip addresses that correspond to the failover nodes.

Unit testing

Plain RSpec:

$ rake spec

Using bundle:

$ bundle exec rake spec

Test against a specific Puppet or Facter version:

$ PUPPET_VERSION=3.2.1  bundle update && bundle exec rake spec
$ PUPPET_VERSION=2.7.19 bundle update && bundle exec rake spec
$ FACTER_VERSION=1.6.8  bundle update && bundle exec rake spec
Contributing

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.