소스 검색

ifdown ifup fix

PROD-16903

Change-Id: I660f745fc7518836f262b08fb92d39bbbe7a24e8
atp-proxy
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…
취소
저장