Browse Source

Merge "restart interface after ip flush / remove cloud init interface file / kill dhclient"

pull/133/head
Filip Pytloun 7 years ago
parent
commit
3a999aa0dd
2 changed files with 15 additions and 1 deletions
  1. +7
    -0
      linux/network/dhclient.sls
  2. +8
    -1
      linux/network/interface.sls

+ 7
- 0
linux/network/dhclient.sls View File

- source: salt://linux/files/dhclient.conf - source: salt://linux/files/dhclient.conf
- template: jinja - template: jinja


{%- elif network.dhclient.enabled is defined and network.dhclient.enabled == False %}

kill_dhcp_client:
cmd.run:
- name: "pkill dhclient"
- onlyif: "pgrep dhclient"

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

+ 8
- 1
linux/network/interface.sls View File



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


{%- if network.interface is defined %}

remove_cloud_init_file:
file.absent:
- name: /etc/network/interfaces.d/50-cloud-init.cfg

{%- endif %}


{%- for interface_name, interface in network.interface.iteritems() %} {%- for interface_name, interface in network.interface.iteritems() %}




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



Loading…
Cancel
Save