PROD-16903 Change-Id: I660f745fc7518836f262b08fb92d39bbbe7a24e8pull/139/head
mtu: 9100 | mtu: 9100 | ||||
ipflush_onchange: true | ipflush_onchange: true | ||||
Debian static proto interfaces | |||||
When you are changing interface proto from dhcp in up state to static, you | |||||
may need to flush ip addresses and restart interface to assign ip address from a managed file. | |||||
For example, if you want to use the interface and the ip on the bridge. | |||||
This can be done by setting the ``ipflush_onchange`` with combination | |||||
``restart_on_ipflush`` param set to to true. | |||||
.. code-block:: yaml | |||||
linux: | |||||
network: | |||||
interface: | |||||
eth1: | |||||
enabled: true | |||||
type: eth | |||||
proto: static | |||||
address: 10.1.0.22 | |||||
netmask: 255.255.255.0 | |||||
ipflush_onchange: true | |||||
restart_on_ipflush: true | |||||
Concatinating and removing interface files | Concatinating and removing interface files | ||||
linux_interface_ipflush_onchange_{{ interface_name }}: | linux_interface_ipflush_onchange_{{ interface_name }}: | ||||
cmd.run: | cmd.run: | ||||
- name: "/sbin/ip address flush dev {{ interface_name }}; ifdown {{ interface_name }} ;ifup {{ interface_name }};" | |||||
- name: "/sbin/ip address flush dev {{ interface_name }}" | |||||
- onchanges: | - onchanges: | ||||
- network: linux_interface_{{ interface_name }} | - 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 %} | {%- endif %} | ||||
{%- if salt['grains.get']('saltversion') < '2017.7' %} | {%- if salt['grains.get']('saltversion') < '2017.7' %} |