[Unit]
Description=Keepalive Daemon (LVS and VRRP)
After=network-online.target {{ amphora_netns }}.service
Wants=network-online.target
Requires={{ amphora_netns }}.service

[Service]
# Force context as we start keepalived under "ip netns exec"
SELinuxContext=system_u:system_r:keepalived_t:s0
Type=forking
KillMode=process
{% if vrrp_pid and check_pid %}
ExecStart=/sbin/ip netns exec {{ amphora_nsname }} {{ keepalived_cmd }} --log-facility={{ administrative_log_facility }} -f {{ keepalived_cfg }} -p {{ keepalived_pid }} -r {{ vrrp_pid }} -c {{ check_pid }}
{% else %}
ExecStart=/sbin/ip netns exec {{ amphora_nsname }} {{ keepalived_cmd }} --log-facility={{ administrative_log_facility }} -f {{ keepalived_cfg }} -p {{ keepalived_pid }}
{% endif %}
ExecReload=/bin/kill -HUP $MAINPID
PIDFile={{ keepalived_pid }}

[Install]
WantedBy=multi-user.target
