Skip to content

Commit

Permalink
Merge pull request #340 from ecomm911/hiera_global_defs
Browse files Browse the repository at this point in the history
allow hiera to define keepalived::global_defs
  • Loading branch information
TheMeier authored Jun 2, 2024
2 parents 4b6eb71 + e3c523e commit 91c2dac
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 6 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,33 @@ class { 'keepalived::global_defs':
vrrp_notify_fifo_script => 'your_fifo_script_path',
}
```
or hiera:

```yaml
---
keepalived::global_defs:
notification_email: '[email protected]'
notification_email_from: '[email protected]'
smtp_server: 'localhost'
smtp_connect_timeout: '60'
router_id: 'your_router_instance_id'
bfd_rlimit_rttime: 10000
checker_rlimit_rttime: 10000
vrrp_rlimit_rttime: 10000
bfd_priority: -20
checker_priority: -20
vrrp_priority: -20
bfd_rt_priority: 50
checker_rt_priority: 50
vrrp_rt_priority: 50
bfd_no_swap: true
checker_no_swap: true
vrrp_no_swap: true
vrrp_version: 3
max_auto_priority: 99
vrrp_notify_fifo: '/run/keepalived.fifo'
vrrp_notify_fifo_script: 'your_fifo_script_path'
```
### Soft-restart the Keepalived daemon
```puppet
Expand Down
9 changes: 9 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ The following parameters are available in the `keepalived` class:
* [`service_manage`](#-keepalived--service_manage)
* [`service_name`](#-keepalived--service_name)
* [`service_restart`](#-keepalived--service_restart)
* [`global_defs`](#-keepalived--global_defs)
* [`vrrp_instance`](#-keepalived--vrrp_instance)
* [`vrrp_script`](#-keepalived--vrrp_script)
* [`vrrp_track_process`](#-keepalived--vrrp_track_process)
Expand Down Expand Up @@ -213,6 +214,14 @@ Data type: `Optional[String[1]]`



Default value: `undef`

##### <a name="-keepalived--global_defs"></a>`global_defs`

Data type: `Optional[Hash]`



Default value: `undef`

##### <a name="-keepalived--vrrp_instance"></a>`vrrp_instance`
Expand Down
6 changes: 6 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@
order => '001',
}

if $keepalived::global_defs {
class { 'keepalived::global_defs':
* => $keepalived::global_defs,
}
}

concat::fragment { 'keepalived.conf_include_external_configs':
target => "${keepalived::config_dir}/keepalived.conf",
content => epp('keepalived/include-external-configs.epp',
Expand Down
15 changes: 9 additions & 6 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
#
# @param service_restart
#
# @param global_defs
#
# @param vrrp_instance
#
# @param vrrp_script
Expand Down Expand Up @@ -81,12 +83,13 @@

Boolean $manage_package = true,

Hash $vrrp_instance = {},
Hash $vrrp_script = {},
Hash $vrrp_track_process = {},
Hash $vrrp_sync_group = {},
Hash $lvs_real_server = {},
Hash $lvs_virtual_server = {},
Optional[Hash] $global_defs = undef,
Hash $vrrp_instance = {},
Hash $vrrp_script = {},
Hash $vrrp_track_process = {},
Hash $vrrp_sync_group = {},
Hash $lvs_real_server = {},
Hash $lvs_virtual_server = {},
) {
contain keepalived::install
contain keepalived::config
Expand Down
11 changes: 11 additions & 0 deletions spec/classes/keepalived_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,17 @@
)
}
end

describe 'with parameter: global_defs' do
let(:params) { { global_defs: { enable_script_security: 'true' } } }

it {
is_expected.to \
contain_concat__fragment('keepalived.conf_globaldefs').with(
'content' => %r{enable_script_security$}
)
}
end
end
end
end

0 comments on commit 91c2dac

Please sign in to comment.