44 lines
1.3 KiB
Plaintext
Raw Normal View History

2015-07-29 23:55:31 -07:00
# keepalived configuration
#
# **** DO NOT EDIT THIS FILE ****
#
# This file is managed by Salt.
# Any changes will be overwritten.
2016-10-23 19:17:58 -04:00
{{ '\n' }}
2016-10-23 20:50:06 -04:00
{%- import_yaml 'keepalived/defaults.yaml' as keepalived_defaults -%}
2016-10-23 18:56:24 -04:00
{%- set keepalived_final_values = salt.pillar.get(
2016-10-23 19:29:26 -04:00
'keepalived',
2016-10-23 18:56:24 -04:00
default=keepalived_defaults,
2016-10-23 20:50:06 -04:00
merge=True) -%}
2016-10-23 18:56:24 -04:00
2016-10-23 22:01:51 -04:00
{%- set groupings = ['vrrp_script', 'vrrp_sync_group', 'vrrp_instance',
'virtual_server_group', 'virtual_server', 'real_server'] -%}
{%- macro config_entries(data, indents, carryover='') -%}
2016-10-23 20:02:12 -04:00
{%- if data is string or data is number -%}
2016-10-23 20:53:01 -04:00
{{ data|string|indent(indents, True) }}{{ '\n' }}
2016-10-23 20:11:55 -04:00
{%- else -%}
2016-10-23 22:01:51 -04:00
{%- if indents != 0 and not carryover -%}
2016-10-23 21:03:24 -04:00
{{- "{\n" -}}
{%- endif -%}
2016-10-23 20:11:55 -04:00
{%- if data is mapping -%}
{%- for entry in data|dictsort -%}
2016-10-23 22:01:51 -04:00
{%- if entry[0] in groupings -%}
{{- config_entries(entry[1], indents + 2, carryover=entry[0]) -}}
{%- else -%}
2016-10-23 21:09:30 -04:00
{{ entry[0]|indent(indents, True) }}
2016-10-23 20:02:12 -04:00
{{- config_entries(entry[1], indents + 2) -}}
2016-10-23 22:01:51 -04:00
{%- endif -%}
2016-10-23 20:11:55 -04:00
{%- endfor -%}
2016-10-23 20:37:27 -04:00
{%- else -%}
{%- for entry in data -%}
2016-10-23 21:03:24 -04:00
{{- config_entries(entry, indents) -}}
2016-10-23 20:37:27 -04:00
{%- endfor -%}
2016-10-23 20:11:55 -04:00
{%- endif -%}
2016-10-23 22:01:51 -04:00
{%- if indents != 0 and not carryover -%}
{{ '}'|indent(indents - 2, True) }}{{ '\n' }}
{%- endif -%}
2016-10-23 18:56:24 -04:00
{%- endif -%}
{%- endmacro -%}
2016-10-23 19:03:11 -04:00
2016-10-23 19:44:51 -04:00
{{ config_entries(keepalived_final_values, 0) }}