2023-04-12 12:09:46 +00:00
|
|
|
# {{ ansible_managed }}
|
|
|
|
|
|
|
|
global_defs {
|
|
|
|
{% if keepalived_mail_to | length > 0 %}
|
|
|
|
notification_email {
|
|
|
|
{{ keepalived_mail_to }}
|
|
|
|
}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if keepalived_mail_from | length > 0 %}
|
|
|
|
notification_email_from {{ keepalived_mail_from }}
|
|
|
|
smtp_server 127.0.0.1
|
|
|
|
smtp_connect_timeout 30
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
enable_script_security
|
|
|
|
max_auto_priority 50
|
|
|
|
}
|
|
|
|
|
|
|
|
{% for script in keepalived_track_scripts %}
|
|
|
|
vrrp_script {{ script.name }} {
|
2023-05-23 10:48:01 +00:00
|
|
|
script "{{ script.command }}"
|
2023-04-12 12:09:46 +00:00
|
|
|
interval {{ script.interval }}
|
|
|
|
}
|
|
|
|
{% endfor %}
|
|
|
|
|
|
|
|
{% for process in keepalived_track_processes %}
|
|
|
|
vrrp_track_process {{ process.name }} {
|
|
|
|
process "{{ process.search }}"
|
|
|
|
quorum {{ process.quorum }}
|
|
|
|
}
|
|
|
|
{% endfor %}
|
|
|
|
|
|
|
|
vrrp_instance VIP_{{ keepalived_uid }} {
|
|
|
|
state BACKUP
|
|
|
|
priority {{ keepalived_priority }}
|
|
|
|
nopreempt
|
|
|
|
|
|
|
|
interface {{ keepalived_interface }}
|
|
|
|
virtual_router_id {{ keepalived_uid }}
|
|
|
|
advert_int 1
|
|
|
|
|
|
|
|
{% if keepalived_ipv4 | length > 0 %}
|
|
|
|
virtual_ipaddress {
|
|
|
|
{{ keepalived_ipv4 }} dev {{ keepalived_interface }} scope global
|
|
|
|
}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if keepalived_ipv6 | length > 0 %}
|
|
|
|
virtual_ipaddress_excluded {
|
|
|
|
{{ keepalived_ipv6 }} dev {{ keepalived_interface }} scope global
|
|
|
|
}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if keepalived_track_scripts | length > 0 %}
|
|
|
|
track_script {
|
|
|
|
{% for script in keepalived_track_scripts %}
|
|
|
|
{{ script.name }}
|
|
|
|
{% endfor%}
|
|
|
|
}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if keepalived_track_processes | length > 0 %}
|
|
|
|
track_process {
|
|
|
|
{% for process in keepalived_track_processes %}
|
|
|
|
{{ process.name }}
|
|
|
|
{% endfor %}
|
|
|
|
}
|
|
|
|
{% endif %}
|
|
|
|
}
|