Browse Source

Merge "Add slave interfaces to bond master after bond was created/set up"

pull/123/head
Jakub Pavlik 7 years ago
parent
commit
513ce43b8c
2 changed files with 20 additions and 1 deletions
  1. +3
    -1
      linux/map.jinja
  2. +17
    -0
      linux/network/interface.sls

+ 3
- 1
linux/map.jinja View File

@@ -118,7 +118,7 @@

{% set network = salt['grains.filter_by']({
'Arch': {
'pkgs': ['wpa_supplicant', 'dhclient', 'wireless_tools'],
'pkgs': ['wpa_supplicant', 'dhclient', 'wireless_tools', 'ifenslave'],
'bridge_pkgs': ['bridge-utils'],
'ovs_pkgs': ['openvswitch-switch'],
'hostname_file': '/etc/hostname',
@@ -135,6 +135,7 @@
'dhclient_config': '/etc/dhcp/dhclient.conf',
},
'Debian': {
'pkgs': ['ifenslave'],
'hostname_file': '/etc/hostname',
'bridge_pkgs': ['bridge-utils'],
'ovs_pkgs': ['openvswitch-switch', 'bridge-utils'],
@@ -152,6 +153,7 @@
'dhclient_config': '/etc/dhcp/dhclient.conf',
},
'RedHat': {
'pkgs': ['iputils'],
'bridge_pkgs': ['bridge-utils'],
'ovs_pkgs': ['openvswitch-switch', 'bridge-utils'],
'hostname_file': '/etc/sysconfig/network',

+ 17
- 0
linux/network/interface.sls View File

@@ -224,6 +224,23 @@ linux_interface_ipflush_onchange_{{ interface_name }}:

{%- endif %}

{%- if salt['grains.get']('saltversion') < '2017.7' %}
# TODO(ddmitriev): Remove this 'if .. endif' block completely when
# switched to salt version 2017.7 that has the same functionality.
{%- if interface.type == 'bond' and interface.enabled == True %}
linux_bond_interface_{{ interface_name }}:
cmd.run:
- name: ifenslave {{ interface_name }} {{ interface.slaves }}
- require:
- network: linux_interface_{{ interface_name }}
- onchanges:
- network: linux_interface_{{ interface_name }}
{%- for network in interface.slaves.split() %}
- network: linux_interface_{{ network }}
{%- endfor %}
{%- endif %}
{%- endif %}

{%- for network in interface.get('use_ovs_ports', []) %}

remove_interface_{{ network }}_line1:

Loading…
Cancel
Save