mirror of
https://gitea.0xace.cc/ansible-galaxy/keepalived.git
synced 2025-06-28 18:03:08 +00:00
initial commit
This commit is contained in:
70
templates/keepalived.conf.j2
Normal file
70
templates/keepalived.conf.j2
Normal file
@ -0,0 +1,70 @@
|
||||
global_defs {
|
||||
{% if keepalived_config.vrrp_script is defined %}
|
||||
enable_script_security
|
||||
script_user {{ keepalived_script_user }}
|
||||
{% endif %}
|
||||
{% for key, value in keepalived_config.global_defs.items() %}
|
||||
{% if value | type_debug != 'list' %}
|
||||
{{key}} {{value}}
|
||||
{% else %}
|
||||
{% for list_value in value %}
|
||||
{{key}} {{ list_value }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
}
|
||||
|
||||
{% if keepalived_config.vrrp_script is defined %}
|
||||
{% for vrrp_script in keepalived_config.vrrp_script %}
|
||||
vrrp_script {{ vrrp_script }} {
|
||||
{% for key, value in keepalived_config.vrrp_script[vrrp_script].items() %}
|
||||
{% if value | type_debug != 'list' %}
|
||||
{{key}} {{value}}
|
||||
{% else %}
|
||||
{% for list_value in value %}
|
||||
{{key}} {{ list_value }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if keepalived_config.vrrp_track_process is defined %}
|
||||
{% for vrrp_track_process in keepalived_config.vrrp_track_process %}
|
||||
vrrp_track_process {{ vrrp_track_process }} {
|
||||
{% for key, value in keepalived_config.vrrp_track_process[vrrp_track_process].items() %}
|
||||
{% if value | type_debug != 'list' %}
|
||||
{{key}} {{value}}
|
||||
{% else %}
|
||||
{% for list_value in value %}
|
||||
{{key}} {{ list_value }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% for vrrp_instance in keepalived_config.vrrp_instance %}
|
||||
vrrp_instance {{ vrrp_instance }} {
|
||||
{% for key, value in keepalived_config.vrrp_instance[vrrp_instance].items() %}
|
||||
{% if value | type_debug != 'list' %}
|
||||
{{key}} {{value}}
|
||||
{% else %}
|
||||
{{ key }} {
|
||||
{% if key == 'unicast_peer' %}
|
||||
{% for list_value in value %}
|
||||
{{ list_value if list_value != ansible_default_ipv4.address }}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% for list_value in value %}
|
||||
{{ list_value }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
}
|
||||
{% endfor %}
|
||||
|
Reference in New Issue
Block a user