diff --git a/keepalived/defaults/main.yml b/keepalived/defaults/main.yml index 8a4f8aa6..14899cde 100644 --- a/keepalived/defaults/main.yml +++ b/keepalived/defaults/main.yml @@ -37,4 +37,5 @@ keepalived_instances: - '{{ keepalived_floating_ip1 }}' track_script: - '{{ keepalived_script1_name }}' - + #track_interface: + # - eth0 diff --git a/keepalived/templates/keepalived.conf.j2 b/keepalived/templates/keepalived.conf.j2 index 0c70c50a..68c3f63c 100644 --- a/keepalived/templates/keepalived.conf.j2 +++ b/keepalived/templates/keepalived.conf.j2 @@ -1,8 +1,11 @@ {% for script in keepalived_scripts %} vrrp_script {{ script.name }} { script "{{ script.script }}" - interval {{ script.interval }} - weight {{ script.weight }} + interval {{ script.interval | default(1) }} + weight {{ script.weight | default(2) }} + fall: {{ script.fall | default(3) }} + raise: {{ script.raise | default(2) }} + timeout: {{ script.timeout | default(5) }} } {% endfor %} @@ -17,6 +20,9 @@ vrrp_instance {{ instance.name }} { {% if instance.notify is defined %} notify {{ instance.notify }} {% endif %} + {% if instance.nopreempt is defined and instance.nopreempt %} + nopreempt + {% endif %} {% if instance.authentication is defined %} authentication { auth_type {{ instance.authentication }} @@ -32,5 +38,12 @@ vrrp_instance {{ instance.name }} { {{ trk }} {% endfor %} } + {% if instance.track_interface is defined %} + track_interface { + {% for if in instance.track_interface %} + {{ if }} + {% endfor %} + } + {% endif %} } {% endfor %}