add suport for keepalived over unicast
Keepalived can be used via unicast and it is required for for
running keepalived in Amazon VPC.
You can includes `unicast_src_ip` in list of peers because it will be
skipped.
Change-Id: Ia7b83fdee3a13df5a1fdc395c986263596ee493d
diff --git a/README.rst b/README.rst
index 6cbb4bb..17410a4 100644
--- a/README.rst
+++ b/README.rst
@@ -49,6 +49,28 @@
- 192.168.10.2
interface: eth0
+
+Use unicast
+
+.. code-block:: yaml
+
+ keepalived:
+ cluster:
+ enabled: True
+ instance:
+ VIP1:
+ nopreempt: True
+ priority: 100 (highest priority must be on primary server, different for cluster members)
+ virtual_router_id: 51
+ password: pass
+ address: 192.168.10.1
+ interface: eth0
+ unicast_src_ip: 172.16.10.1
+ unicast_peer:
+ 172.16.10.2
+ 172.16.10.3
+
+
Disable nopreempt mode to have Master. Highest priority is taken in all cases.
.. code-block:: yaml
diff --git a/keepalived/files/keepalived.conf b/keepalived/files/keepalived.conf
index 2eec609..14b993a 100644
--- a/keepalived/files/keepalived.conf
+++ b/keepalived/files/keepalived.conf
@@ -33,6 +33,16 @@
interface {{ instance.interface }}
virtual_router_id {{ instance.virtual_router_id }}
priority {{ instance.priority }}
+{%- if instance.unicast_src_ip is defined and instance.unicast_peer is defined %}
+ unicast_src_ip {{ instance.unicast_src_ip }}
+ unicast_peer {
+ {%- for peer in instance.unicast_peer %}
+ {%- if peer != instance.unicast_src_ip %}
+ {{ peer }}
+ {%- endif %}
+ {%- endfor %}
+ }
+{%- endif %}
advert_int 1
authentication {
auth_type PASS