Cookbooks
keepalived
documentation
Keepalived Vrrp Instance

keepalived_vrrp_instance

back to resource list (opens in a new tab)

The keepalived_vrrp_instance resource can be used to manage configuration within the vrrp_instance section of keepalived.conf.

More information available at https://www.keepalived.org/manpage.html (opens in a new tab)

Actions

  • :create
  • :delete

Properties

NameTypeDefaultDescriptionAllowed Values
virtual_router_idIntegernil(required) used to differentiate multiple instances of vrrpd0 to 255
mastertrue, falsefalseInitial state, MASTER or BACKUP
interfaceStringnilinterface for inside_network, bound by vrrp
use_vmacStringnilUse VRRP Virtual MAC
vmac_xmit_basetrue, falsenilSend/Recv VRRP messages from base interface instead of vmac interface
dont_track_primarytrue, falsenilIgnore VRRP interface faults
track_interfaceStringnilSee ManPage
mcast_src_ipStringnilSee ManPage
unicast_src_ipStringnilSee ManPage
unicast_peerArraynilSee ManPage
garp_master_delayIntegernildelay for second set of gratuitous ARPs after transition to MASTER.
garp_master_repeatIntegernilnumber of gratuitous ARP messages to send at a time after transition to MASTER
garp_master_refreshIntegernilminimum time interval for refreshing gratuitous ARPs while MASTER
garp_master_refresh_repeatIntegernilnumber of gratuitous ARP messages to send at a time while MASTER
priorityInteger100for electing MASTER, highest priority wins0 up to 255
advert_intIntegernilVRRP Advert interval in seconds
authenticationHashnilSee Manpage:auth_type,:auth_pass Note: Symbols
virtual_ipaddressArrayniladdresses add or del on change to MASTER, to BACKUP
virtual_ipaddress_excludedArraynilSee ManPage
virtual_routesArraynilroutes add or del when changing to MASTER, to BACKUP
virtual_rulesArraynilrules add or del when changing to MASTER, to BACKUP
track_scriptArrayniladd a tracking script to the sync group
nopreempttrue,falsenilSee ManPage
preempt_delayIntegernilSeconds after startup or seeing a lower priority master until preemption0 to 1000
strict_modetrue,falsenilEnforce strict VRRP protocol compliance
versionIntegernilVRRP version to run on interface2,3
native_ipv6true,falsenilforce instance to use IPv6
notify_stopStringnilexecuted when stopping vrrp
notify_masterStringnilScript to run for notifications when transitioning to state of master
notify_backupStringnilScript to run for notifications when transitioning to state of backup
notify_faultStringnilScript to run for notifications when transitioning to state of fault
notifyStringnilScript to run for notifications when any transition of state happens
smtp_alerttrue, falsenilSend email notification during state transition
config_directoryString/etc/keepalived/conf.ddirectory for the config file to reside in
config_fileString::File.join(config_directory, "keepalived_vrrp_instance__#{name}__.conf")full path to the config file
cookbookStringkeepalivedWhich cookbook to look in for the template
sourceStringvrrp_instance.conf.erbName of the template to render

Examples

keepalived_vrrp_instance 'inside_network' do
  master true
  interface node['network']['default_interface']
  virtual_router_id 51
  priority 101
  authentication auth_type: 'PASS', auth_pass: 'secret1'
  virtual_ipaddress %w( 192.168.1.1 )
  notify '/usr/local/bin/keepalived-notify.sh'
  smtp_alert true
  notifies :restart, 'service[keepalived]', :delayed
end