Cookbooks
keepalived
documentation
Keepalived Vrrp Script

keepalived_vrrp_script

back to resource list (opens in a new tab)

The keepalived_vrrp_script resource can be used to configure a track script via a vrrp_script configuration block.

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

Actions

  • :create
  • :delete

Properties

NameTypeDefaultDescriptionAllowed Values
scriptStringnil(Required) Path of the script to execute
intervalIntegernilSeconds between script invocations,
timeoutIntegernilSeconds after which script is considered to have failed
weightIntegernilAdjust priority by this weight-253..253
fallIntegernilRequired number of successes for OK transition
riseIntegerRequired number of successes for KO transition
userStringUser/group names to run script under, group default to group of user
config_directoryString/etc/keepalived/conf.ddirectory for the config file to reside in
config_fileString::File.join(config_directory, '00_keepalived_vrrp_script__#{name}__.conf')full path to the config file
cookbookStringkeepalivedWhich cookbook to look in for the template
sourceStringvrrp_script.conf.erbName of the template to render

Examples

keepalived_vrrp_script 'chk_haproxy' do
  script '/usr/local/bin/chk-haproxy.sh'
  timeout 10
  fall 20
  rise 30
  user 'scriptUser'
  notifies :restart, 'service[keepalived]', :delayed
end
keepalived_vrrp_script 'mongo-active' do
  script '/usr/local/bin/chk-mongod.sh'
  interval 2
  weight 50
  notifies :restart, 'service[keepalived]', :delayed
end