Skip to content
This repository was archived by the owner on Oct 27, 2025. It is now read-only.

Commit 49d371f

Browse files
committed
For mutlti-interfaced hosts, the default gateway is based on the
Interface whose ifcfg script is evaluated last. This sometimes causes problems. This PR is to explicitly set gateway dev so network interfaces will have a predictable behavior.
1 parent 0791a14 commit 49d371f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tasks/redhat.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,11 @@
2424
template: src=route_{{ ansible_os_family }}.j2 dest={{ net_path }}/route-{{ item.device }}
2525
with_items: "{{ network_bridge_interfaces }}"
2626
when: network_bridge_interfaces is defined and item.route is defined
27+
28+
- name: Cleanup gateway dev that does not set to the one we want
29+
lineinfile: dest=/etc/sysconfig/network regexp="^GATEWAYDEV=(?!{{ gateway_dev }})" state=absent
30+
when: gateway_dev is defined
31+
32+
- name: Explicitly set gateway dev
33+
lineinfile: dest=/etc/sysconfig/network line="GATEWAYDEV={{ gateway_dev }}"
34+
when: gateway_dev is defined

0 commit comments

Comments
 (0)