Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some bonded interface fixes #104

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions templates/bond_Debian.j2
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ netmask {{ item.netmask }}
{% if item.gateway is defined %}
gateway {{ item.gateway }}
{% endif %}
{% if item.dnsnameservers is defined %}
dns-nameservers {{ item.dnsnameservers }}
{% endif %}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add the same for bridge_Debian.j2?

{% endif %}
{% if item.mtu is defined %}
mtu {{ item.mtu }}
Expand All @@ -25,6 +28,9 @@ hwaddress {{ item.hwaddr }}
{% if item.pre_up is defined %}
pre-up {{ item.pre_up }}
{% endif %}
{% if item.dnssearch is defined %}
dns-search {{ item.dnssearch }}
{% endif %}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

{% if item.bond_mode is defined %}
bond-mode {{ item.bond_mode }}
{% endif %}
Expand Down
12 changes: 11 additions & 1 deletion templates/bond_RedHat.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
DEVICE={{ item.device }}
TYPE=Bond
{% if item.hwaddr is defined %}
HWADDR={{ item.hwaddr }}
MACADDR={{ item.hwaddr }}
{% endif %}
USERCTL=no
{% if item.bootproto == 'static' %}
Expand All @@ -18,13 +18,23 @@ NETMASK={{ item.netmask }}
GATEWAY={{ item.gateway }}
{% endif %}
{% endif %}
{% if item.dnsnameservers is defined %}
{% for dns_server in item.dnsnameservers.split(' ')[:2] %}
DNS{{ loop.index }}={{ dns_server }}
{% endfor %}
{% endif %}
{% if item.dnssearch is defined %}
DOMAIN={{ item.dnssearch }}
{% endif %}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add the same for templates/bridge_RedHat.j2?

{% if item.bootproto == 'dhcp' %}
BOOTPROTO=dhcp
{% endif %}
{% if item.defroute is defined %}
DEFROUTE={{ item.defroute | bool | ternary('yes', 'no') }}
{% endif %}
{% if item.onboot is defined %}
ONBOOT={{ item.onboot | bool | ternary('yes', 'no') }}
{% endif %}
BONDING_OPTS="{% if item.bond_mode is defined %}mode={{ item.bond_mode }} {% endif %}miimon={{ item.bond_miimon|default(100) }} {% if item.bond_updelay is defined %}updelay={{ item.bond_updelay }} {% endif %} {% if item.bond_downdelay is defined %}downdelay={{ item.bond_downdelay }} {% endif %} {% if item.bond_xmit_hash_policy is defined %}xmit_hash_policy={{ item.bond_xmit_hash_policy }} {% endif %} {% if item.bond_lacp_rate is defined %}lacp_rate={{ item.bond_lacp_rate }} {% endif %} "
{% if ansible_distribution_major_version | int >= 7 %}
NM_CONTROLLED=no
Expand Down
2 changes: 1 addition & 1 deletion templates/route6_RedHat.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{% for i in item.ip6.route %}
{% set route = i.network %}
{% if 'gateway' in i %}
{% set route = route ~ ' via ' ~ i.gateway %}
{% set route = route ~ ' via ' ~ i.gateway ~ ' dev ' ~ item.device %}
{% else %}
{% set route = route ~ ' dev ' ~ item.device %}
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion templates/route_RedHat.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{% set prefix = ('0.0.0.0/' ~ i.netmask) | ipaddr('prefix') %}
{% set route = i.network ~ '/' ~ prefix %}
{% if 'gateway' in i %}
{% set route = route ~ ' via ' ~ i.gateway %}
{% set route = route ~ ' via ' ~ i.gateway ~ ' dev ' ~ item.device %}
{% else %}
{% set route = route ~ ' dev ' ~ item.device %}
{% endif %}
Expand Down