瀏覽代碼

ifdown ifup fix

PROD-16903

Change-Id: I660f745fc7518836f262b08fb92d39bbbe7a24e8
pull/139/head
Jiri Broulik 7 年之前
父節點
當前提交
1a191e379e
共有 2 個文件被更改,包括 32 次插入1 次删除
  1. +21
    -0
      README.rst
  2. +11
    -1
      linux/network/interface.sls

+ 21
- 0
README.rst 查看文件

@@ -1010,6 +1010,27 @@ to true.
mtu: 9100
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


+ 11
- 1
linux/network/interface.sls 查看文件

@@ -225,10 +225,20 @@ linux_interface_{{ interface_name }}:

linux_interface_ipflush_onchange_{{ interface_name }}:
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:
- 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' %}

Loading…
取消
儲存