Browse Source

Merge "Flush IP address on change for ovs_port"

pull/148/merge
Jiri Broulik 6 years ago
parent
commit
b08a62ebe6
1 changed files with 28 additions and 19 deletions
  1. +28
    -19
      linux/network/interface.sls

+ 28
- 19
linux/network/interface.sls View File

- mode: {{ interface.mode }} - mode: {{ interface.mode }}
{%- endif %} {%- endif %}


{%- if interface.get('ipflush_onchange', False) %}

linux_interface_ipflush_onchange_{{ interface_name }}:
cmd.run:
- name: "/sbin/ip address flush dev {{ interface_name }}"
- onchanges:
- network: linux_interface_{{ interface_name }}

{%- if interface.get('restart_on_ipflush', False) %}

linux_interface_restart_on_ipflush_{{ interface_name }}:
cmd.run:
- name: "ifdown {{ interface_name }}; ifup {{ interface_name }};"
- onchanges:
- cmd: linux_interface_ipflush_onchange_{{ interface_name }}

{%- endif %}

{%- endif %}


{%- if salt['grains.get']('saltversion') < '2017.7' %} {%- if salt['grains.get']('saltversion') < '2017.7' %}
# TODO(ddmitriev): Remove this 'if .. endif' block completely when # TODO(ddmitriev): Remove this 'if .. endif' block completely when


{%- endif %} {%- endif %}


{%- if interface.type in ('eth','ovs_port') %}
{%- if interface.get('ipflush_onchange', False) %}

linux_interface_ipflush_onchange_{{ interface_name }}:
cmd.run:
- name: "/sbin/ip address flush dev {{ interface_name }}"
{%- if interface.type == 'eth' %}
- onchanges:
- network: linux_interface_{{ interface_name }}
{%- elif interface.type == 'ovs_port' %}
- onchanges:
- file: ovs_port_{{ interface_name }}
{%- endif %}

{%- if interface.get('restart_on_ipflush', False) %}

linux_interface_restart_on_ipflush_{{ interface_name }}:
cmd.run:
- name: "ifdown {{ interface_name }}; ifup {{ interface_name }};"
- onchanges:
- cmd: linux_interface_ipflush_onchange_{{ interface_name }}

{%- endif %}

{%- endif %}

{%- endif %}

{%- endfor %} {%- endfor %}


{%- if network.bridge != 'none' %} {%- if network.bridge != 'none' %}

Loading…
Cancel
Save