Skip to content

Commit

Permalink
Adding sync iface to internal virtual IPs insead of management
Browse files Browse the repository at this point in the history
  • Loading branch information
rgomezborder committed Oct 7, 2024
1 parent 27ab0b8 commit 5aa455d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion resources/templates/default/keepalived.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,17 @@ vrrp_sync_group vg_<%= ip %>_<%= tmp.join("_") %> {
#######################################################

<% index=0 %>
<% sync_iface = `ip -o addr show | grep #{@ipsync} | awk '{print $2}'`.strip %>
<% internal_services = @virtual_ips["internal"] %>
<% @virtual_ips_per_ip.each do |ip,services| %>
<% index=index+1 %>
<% if services.select{|x| x["enable"]}.size>0 %>
vrrp_instance vi_<%= ip %> {
<% iface=services.select{|x| x["enable"]}.first["iface"] %>
state BACKUP
<% services.each do |service| %>
<% iface = internal_services.key?(service["service"]) ? sync_iface : service["iface"] %>
interface <%= iface %>
<% end %>
virtual_router_id <%= ((@start_id.nil? ? 111 : @start_id.to_i) + index).to_s %>
priority <%= 50+@managers.size-@managers.index { |m| m.name == node.name } %>
advert_int 1
Expand Down

0 comments on commit 5aa455d

Please sign in to comment.