From 45e3261e53b42e611d2d2ec92135bf554f6500f8 Mon Sep 17 00:00:00 2001 From: Ricardo Klein Date: Mon, 6 Apr 2020 22:40:52 +0200 Subject: [PATCH] feat(vrrp_sync_group): added option for vrrp_sync_group * Changed the template to include new config setting group * Added example to pillar.example * Included test (could be better if we check the entire section and ensure that it is in the correct format?) --- keepalived/files/default/keepalived.conf.tmpl.jinja | 2 +- pillar.example | 5 +++++ test/integration/default/controls/config_spec.rb | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/keepalived/files/default/keepalived.conf.tmpl.jinja b/keepalived/files/default/keepalived.conf.tmpl.jinja index c2741ec..5e25e25 100644 --- a/keepalived/files/default/keepalived.conf.tmpl.jinja +++ b/keepalived/files/default/keepalived.conf.tmpl.jinja @@ -4,7 +4,7 @@ ######################################################################## {%- from "keepalived/macro.jinja" import print_config %} -{%- set sections = ['global_defs', 'vrrp_script', 'vrrp_instance', 'virtual_server'] %} +{%- set sections = ['global_defs', 'vrrp_sync_group', 'vrrp_script', 'vrrp_instance', 'virtual_server'] %} {%- for section in sections %} {{ print_config({ section: config[section]|d({}) }) }} {%- endfor %} diff --git a/pillar.example b/pillar.example index aa28bd9..ee2f892 100644 --- a/pillar.example +++ b/pillar.example @@ -27,6 +27,11 @@ keepalived: smtp_server: 192.168.200.1 smtp_connect_timeout: 30 router_id: LVS_DEVEL + vrrp_sync_group: + EXAMPLE_GROUP: + group: + - VI_IPV4 + - VI_IPV6 vrrp_instance: VI_1: state: MASTER diff --git a/test/integration/default/controls/config_spec.rb b/test/integration/default/controls/config_spec.rb index 3ba827d..c18c248 100644 --- a/test/integration/default/controls/config_spec.rb +++ b/test/integration/default/controls/config_spec.rb @@ -9,5 +9,11 @@ control 'Keepalived configuration' do # Custom config from pillar its('content') { should include 'acassen@firewall.loc' } + + # Check config from example pillar -- example vrrp sync group + its('content') { should include 'EXAMPLE_GROUP' } + + # Check config from example pillar -- vrrp sync group item + its('content') { should include 'VI_IPV6' } end end