diff --git a/REFERENCE.md b/REFERENCE.md index b959cacec..5432f3359 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -35,6 +35,7 @@ Work in progress, supports: ### Data types +* [`Keepalived::Global_defs::Lvs_sync_daemon`](#Keepalived--Global_defs--Lvs_sync_daemon): Defines parameters for lvs_sync_daemon as documented in `man 5 keepalived.conf` * [`Keepalived::Options`](#Keepalived--Options): keepalived::options * [`Keepalived::Vrrp::Instance::VRule`](#Keepalived--Vrrp--Instance--VRule): Translates directly to rules to be added as per `ip-rule(8)` @@ -343,6 +344,7 @@ The following parameters are available in the `keepalived::global_defs` class: * [`dynamic_interfaces`](#-keepalived--global_defs--dynamic_interfaces) * [`vrrp_notify_fifo`](#-keepalived--global_defs--vrrp_notify_fifo) * [`vrrp_notify_fifo_script`](#-keepalived--global_defs--vrrp_notify_fifo_script) +* [`lvs_sync_daemon`](#-keepalived--global_defs--lvs_sync_daemon) ##### `notification_email` @@ -688,6 +690,14 @@ Set the vrrp_notify_fifo_script option. Default value: `undef` +##### `lvs_sync_daemon` + +Data type: `Optional[Keepalived::Global_defs::Lvs_sync_daemon]` + +Set the lvs_sync_daemon option. + +Default value: `undef` + ### `keepalived::install` Install keepalived package @@ -1865,6 +1875,24 @@ Default value: `false` ## Data types +### `Keepalived::Global_defs::Lvs_sync_daemon` + +Defines parameters for lvs_sync_daemon as documented in `man 5 keepalived.conf` + +Alias of + +```puppet +Struct[{ + interface => String[1], + vrrp_instance => String[1], + Optional[id] => Integer[0, 255], + Optional[maxlen] => Integer[1, 65507], + Optional[port] => Stdlib::Port, + Optional[ttl] => Integer[1, 255], + Optional[group] => Stdlib::IP::Address, +}] +``` + ### `Keepalived::Options` keepalived::options diff --git a/manifests/global_defs.pp b/manifests/global_defs.pp index 7a7e0d730..9901c8b96 100644 --- a/manifests/global_defs.pp +++ b/manifests/global_defs.pp @@ -87,50 +87,53 @@ # # @param vrrp_notify_fifo_script Set the vrrp_notify_fifo_script option. # +# @param lvs_sync_daemon Set the lvs_sync_daemon option. +# class keepalived::global_defs ( - $notification_email = undef, - $notification_email_from = undef, - $smtp_server = undef, - $smtp_connect_timeout = undef, - $router_id = undef, - $script_user = undef, - $enable_script_security = undef, - $enable_snmp_keepalived = undef, - $enable_snmp_vrrp = undef, - $enable_snmp_checker = undef, - $enable_snmp_rfc = undef, - $enable_snmp_rfcv2 = undef, - $enable_snmp_rfcv3 = undef, - $enable_traps = undef, - Boolean $enable_dbus = false, - Optional[Boolean] $vrrp_higher_prio_send_advert = undef, - Optional[Boolean] $vrrp_min_garp = undef, - Optional[Integer] $vrrp_garp_lower_prio_repeat = undef, - Optional[Integer] $vrrp_garp_master_delay = undef, - Optional[Integer] $vrrp_garp_master_refresh = undef, - Optional[Integer] $vrrp_garp_master_repeat = undef, - Optional[Integer] $vrrp_garp_master_refresh_repeat = undef, - Optional[Integer] $vrrp_garp_lower_prio_delay = undef, - Optional[Float] $vrrp_startup_delay = undef, - Optional[Integer] $bfd_rlimit_rttime = undef, - Optional[Integer] $checker_rlimit_rttime = undef, - Optional[Integer] $vrrp_rlimit_rttime = undef, - Optional[Integer[-20, 19]] $bfd_priority = undef, - Optional[Integer[-20, 19]] $checker_priority = undef, - Optional[Integer[-20, 19]] $vrrp_priority = undef, - Optional[Integer[1, 99]] $bfd_rt_priority = undef, - Optional[Integer[1, 99]] $checker_rt_priority = undef, - Optional[Integer[1, 99]] $vrrp_rt_priority = undef, - Boolean $bfd_no_swap = false, - Boolean $checker_no_swap = false, - Boolean $vrrp_no_swap = false, - Boolean $vrrp_check_unicast_src = false, - Optional[Integer[2, 3]] $vrrp_version = undef, - Optional[Integer[-1, 99]] $max_auto_priority = undef, - Boolean $dynamic_interfaces = false, - Optional[Stdlib::Absolutepath] $vrrp_notify_fifo = undef, - Optional[Stdlib::Absolutepath] $vrrp_notify_fifo_script = undef, - $snmp_socket = 'unix:/var/agentx/master', + $notification_email = undef, + $notification_email_from = undef, + $smtp_server = undef, + $smtp_connect_timeout = undef, + $router_id = undef, + $script_user = undef, + $enable_script_security = undef, + $enable_snmp_keepalived = undef, + $enable_snmp_vrrp = undef, + $enable_snmp_checker = undef, + $enable_snmp_rfc = undef, + $enable_snmp_rfcv2 = undef, + $enable_snmp_rfcv3 = undef, + $enable_traps = undef, + Boolean $enable_dbus = false, + Optional[Boolean] $vrrp_higher_prio_send_advert = undef, + Optional[Boolean] $vrrp_min_garp = undef, + Optional[Integer] $vrrp_garp_lower_prio_repeat = undef, + Optional[Integer] $vrrp_garp_master_delay = undef, + Optional[Integer] $vrrp_garp_master_refresh = undef, + Optional[Integer] $vrrp_garp_master_repeat = undef, + Optional[Integer] $vrrp_garp_master_refresh_repeat = undef, + Optional[Integer] $vrrp_garp_lower_prio_delay = undef, + Optional[Float] $vrrp_startup_delay = undef, + Optional[Integer] $bfd_rlimit_rttime = undef, + Optional[Integer] $checker_rlimit_rttime = undef, + Optional[Integer] $vrrp_rlimit_rttime = undef, + Optional[Integer[-20, 19]] $bfd_priority = undef, + Optional[Integer[-20, 19]] $checker_priority = undef, + Optional[Integer[-20, 19]] $vrrp_priority = undef, + Optional[Integer[1, 99]] $bfd_rt_priority = undef, + Optional[Integer[1, 99]] $checker_rt_priority = undef, + Optional[Integer[1, 99]] $vrrp_rt_priority = undef, + Boolean $bfd_no_swap = false, + Boolean $checker_no_swap = false, + Boolean $vrrp_no_swap = false, + Boolean $vrrp_check_unicast_src = false, + Optional[Integer[2, 3]] $vrrp_version = undef, + Optional[Integer[-1, 99]] $max_auto_priority = undef, + Boolean $dynamic_interfaces = false, + Optional[Stdlib::Absolutepath] $vrrp_notify_fifo = undef, + Optional[Stdlib::Absolutepath] $vrrp_notify_fifo_script = undef, + $snmp_socket = 'unix:/var/agentx/master', + Optional[Keepalived::Global_defs::Lvs_sync_daemon] $lvs_sync_daemon = undef, ) { concat::fragment { 'keepalived.conf_globaldefs': target => "${keepalived::config_dir}/keepalived.conf", diff --git a/spec/classes/keepalived_global_defs_spec.rb b/spec/classes/keepalived_global_defs_spec.rb index c471fd9fc..6d6642fa0 100644 --- a/spec/classes/keepalived_global_defs_spec.rb +++ b/spec/classes/keepalived_global_defs_spec.rb @@ -673,6 +673,47 @@ ) } end + + describe 'with parameter lvs_sync_daemon (minimal)' do + let(:params) do + { + lvs_sync_daemon: { + 'interface' => 'eth0', + 'vrrp_instance' => 'VRRP', + } + } + end + + it { + is_expected.to \ + contain_concat__fragment('keepalived.conf_globaldefs').with( + 'content' => %r{lvs_sync_daemon eth0 VRRP$} + ) + } + end + + describe 'with parameter lvs_sync_daemon (full)' do + let(:params) do + { + lvs_sync_daemon: { + 'interface' => 'eth0', + 'vrrp_instance' => 'VRRP', + 'id' => 42, + 'maxlen' => 4711, + 'port' => 8848, + 'ttl' => 128, + 'group' => '192.0.2.1', + } + } + end + + it { + is_expected.to \ + contain_concat__fragment('keepalived.conf_globaldefs').with( + 'content' => %r{lvs_sync_daemon eth0 VRRP id 42 maxlen 4711 port 8848 ttl 128 group 192\.0\.2\.1$} + ) + } + end end end end diff --git a/templates/globaldefs.erb b/templates/globaldefs.erb index fe29cf684..7cc3dd8d3 100644 --- a/templates/globaldefs.erb +++ b/templates/globaldefs.erb @@ -132,6 +132,12 @@ global_defs { <%- if @vrrp_notify_fifo_script -%> vrrp_notify_fifo_script <%= @vrrp_notify_fifo_script %> <%- end -%> + <%- if @lvs_sync_daemon -%> + lvs_sync_daemon <%= @lvs_sync_daemon['interface'] %> <%= @lvs_sync_daemon['vrrp_instance'] -%> + <%- %w(id maxlen port ttl group).each do |key| -%> + <%- if @lvs_sync_daemon.has_key?(key) %> <%= key %> <%= @lvs_sync_daemon[key] -%><% end -%> + <%- end %> + <%- end -%> } diff --git a/types/global_defs/lvs_sync_daemon.pp b/types/global_defs/lvs_sync_daemon.pp new file mode 100644 index 000000000..55df356eb --- /dev/null +++ b/types/global_defs/lvs_sync_daemon.pp @@ -0,0 +1,10 @@ +# @summary Defines parameters for lvs_sync_daemon as documented in `man 5 keepalived.conf` +type Keepalived::Global_defs::Lvs_sync_daemon = Struct[{ + interface => String[1], + vrrp_instance => String[1], + Optional[id] => Integer[0, 255], + Optional[maxlen] => Integer[1, 65507], + Optional[port] => Stdlib::Port, + Optional[ttl] => Integer[1, 255], + Optional[group] => Stdlib::IP::Address, +}]