rewrite LVM lv_present prevents unwanted LV shrink (#221)
* Update file.sls
add replace
* Update file.sls
update replace
* Update job.sls
Added the opportunity to set a job with a special keyword like '@reboot' or '@hourly'. Quotes must be used, otherwise PyYAML will strip the '@' sign.
https://docs.saltstack.com/en/master/ref/states/all/salt.states.cron.html
* Update README.rst
Added the opportunity to set a job with a special keyword like '@reboot' or '@hourly'. Quotes must be used, otherwise PyYAML will strip the '@' sign.
* Update README.rst
* fix(deprecation): update to new method (#214)
Signed-off-by: Felipe Zipitria <fzipitria@perceptyx.com>
* Allow swap to be completely disabled
* sort repos so they do not change order every run
* allow use of new state syntax for module.run
The new syntax has been supported since ~2017.
From the docs, in case they change:
! New Style
test.random_hash:
module.run:
- test.random_hash:
- size: 42
- hash_type: sha256
! Legacy Style
test.random_hash:
module.run:
- size: 42
- hash_type: sha256
* Update map.jinja
Add support fpr Ubuntu Focal.
* Update file.sls
added possibility to delete files
* Network resolf.conf handling
the handling as the Resolv.conf is generated and adapted, adapted.
previously the Resolv.conf was created and then through
Overwrite "network.system" in the interface.sls again.
With two search servers that should actually be included.
"search example.com. sudomain.example.com"
but it always became that
search ['example.com.', 'sudomain.example.com']
The resolv.conf was first created correctly but then overwritten again in the interface.sls.
The problem only arises if you don't want to have a "Domain:" in resov.conf
* rewrite LVM lv_present
Since salt now also supports LV extend and reduce, the option Force must be used with care.
The changes include that force is only set if the corresponding LV does not yet exist (check via Grains) in order to overwrite any FS signatures (Wiping fs signature).
If the LV already exists (check via Grains), Force is set to False unless this is explicitly set to True in the pillars.
* Network resolf.conf handling (#220) (#8)
* Update file.sls
add replace
* Update file.sls
update replace
* Update job.sls
Added the opportunity to set a job with a special keyword like '@reboot' or '@hourly'. Quotes must be used, otherwise PyYAML will strip the '@' sign.
https://docs.saltstack.com/en/master/ref/states/all/salt.states.cron.html
* Update README.rst
Added the opportunity to set a job with a special keyword like '@reboot' or '@hourly'. Quotes must be used, otherwise PyYAML will strip the '@' sign.
* Update README.rst
* fix(deprecation): update to new method (#214)
Signed-off-by: Felipe Zipitria <fzipitria@perceptyx.com>
* Allow swap to be completely disabled
* sort repos so they do not change order every run
* allow use of new state syntax for module.run
The new syntax has been supported since ~2017.
From the docs, in case they change:
! New Style
test.random_hash:
module.run:
- test.random_hash:
- size: 42
- hash_type: sha256
! Legacy Style
test.random_hash:
module.run:
- size: 42
- hash_type: sha256
* Update map.jinja
Add support fpr Ubuntu Focal.
* Update file.sls
added possibility to delete files
* Network resolf.conf handling
the handling as the Resolv.conf is generated and adapted, adapted.
previously the Resolv.conf was created and then through
Overwrite "network.system" in the interface.sls again.
With two search servers that should actually be included.
"search example.com. sudomain.example.com"
but it always became that
search ['example.com.', 'sudomain.example.com']
The resolv.conf was first created correctly but then overwritten again in the interface.sls.
The problem only arises if you don't want to have a "Domain:" in resov.conf
Co-authored-by: Felipe Zipitría <fzipi@fing.edu.uy>
Co-authored-by: Kyle Gullion <kgullion@gmail.com>
Co-authored-by: Matthew Thode <thode@fsi.io>
Co-authored-by: Matthew Thode <mthode@mthode.org>
Co-authored-by: Felipe Zipitría <fzipi@fing.edu.uy>
Co-authored-by: Kyle Gullion <kgullion@gmail.com>
Co-authored-by: Matthew Thode <thode@fsi.io>
Co-authored-by: Matthew Thode <mthode@mthode.org>
* Network resolf.conf handling (#220) (#9)
* Update file.sls
add replace
* Update file.sls
update replace
* Update job.sls
Added the opportunity to set a job with a special keyword like '@reboot' or '@hourly'. Quotes must be used, otherwise PyYAML will strip the '@' sign.
https://docs.saltstack.com/en/master/ref/states/all/salt.states.cron.html
* Update README.rst
Added the opportunity to set a job with a special keyword like '@reboot' or '@hourly'. Quotes must be used, otherwise PyYAML will strip the '@' sign.
* Update README.rst
* fix(deprecation): update to new method (#214)
Signed-off-by: Felipe Zipitria <fzipitria@perceptyx.com>
* Allow swap to be completely disabled
* sort repos so they do not change order every run
* allow use of new state syntax for module.run
The new syntax has been supported since ~2017.
From the docs, in case they change:
! New Style
test.random_hash:
module.run:
- test.random_hash:
- size: 42
- hash_type: sha256
! Legacy Style
test.random_hash:
module.run:
- size: 42
- hash_type: sha256
* Update map.jinja
Add support fpr Ubuntu Focal.
* Update file.sls
added possibility to delete files
* Network resolf.conf handling
the handling as the Resolv.conf is generated and adapted, adapted.
previously the Resolv.conf was created and then through
Overwrite "network.system" in the interface.sls again.
With two search servers that should actually be included.
"search example.com. sudomain.example.com"
but it always became that
search ['example.com.', 'sudomain.example.com']
The resolv.conf was first created correctly but then overwritten again in the interface.sls.
The problem only arises if you don't want to have a "Domain:" in resov.conf
Co-authored-by: Felipe Zipitría <fzipi@fing.edu.uy>
Co-authored-by: Kyle Gullion <kgullion@gmail.com>
Co-authored-by: Matthew Thode <thode@fsi.io>
Co-authored-by: Matthew Thode <mthode@mthode.org>
Co-authored-by: Felipe Zipitría <fzipi@fing.edu.uy>
Co-authored-by: Kyle Gullion <kgullion@gmail.com>
Co-authored-by: Matthew Thode <thode@fsi.io>
Co-authored-by: Matthew Thode <mthode@mthode.org>
* Update mount.sls
added the possibility to set the dump and pass option
dump
The dump value to be passed into the fstab, Default is 0
pass_num
The pass value to be passed into the fstab, Default is 0
* Update mount.sls
correction, wrong line.
added the possibility to set the dump and pass option
dump
The dump value to be passed into the fstab, Default is 0
pass_num
The pass value to be passed into the fstab, Default is 0
* Add Bind Mount Option
Add Bind Mount Option
* Add support for template defaults/context args
* Add IPv6 Interface Support
Add IPv6 Interface Support
First Version
* Fix warning in salt v3003
The 'gid_from_name' argument in the user.present state has been replaced
with 'usergroup'. Update your SLS file to get rid of this warning.
* Update map.jinja
add Jammy Support
---------
Signed-off-by: Felipe Zipitria <fzipitria@perceptyx.com>
Co-authored-by: Felipe Zipitría <fzipi@fing.edu.uy>
Co-authored-by: Kyle Gullion <kgullion@gmail.com>
Co-authored-by: Matthew Thode <thode@fsi.io>
Co-authored-by: Matthew Thode <mthode@mthode.org>
Co-authored-by: Bruno Binet <bruno.binet@gmail.com> 1 vuosi sitten |
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531 |
- {%- from "linux/map.jinja" import network with context %}
- {%- from "linux/map.jinja" import system with context %}
- {%- if network.enabled %}
-
- {%- set dpdk_enabled = network.get('dpdk', {}).get('enabled', False) %}
- {%- if dpdk_enabled %}
- include:
- - linux.network.dpdk
- {%- endif %}
-
- {%- macro set_param(param_name, param_dict) -%}
- {%- if param_dict.get(param_name, False) -%}
- - {{ param_name }}: {{ param_dict[param_name] }}
- {%- endif -%}
- {%- endmacro -%}
-
- {%- if network.bridge != 'none' %}
-
- linux_network_bridge_pkgs:
- pkg.installed:
- {%- if network.bridge == 'openvswitch' %}
- - pkgs: {{ network.ovs_pkgs | json }}
- {%- else %}
- - pkgs: {{ network.bridge_pkgs | json }}
- {%- endif %}
-
- {%- endif %}
-
- {%- for f in network.get('concat_iface_files', []) %}
-
- {%- if salt['file.file_exists'](f.src) %}
-
- append_{{ f.src }}_{{ f.dst }}:
- file.append:
- - name: {{ f.dst }}
- - source: {{ f.src }}
-
- remove_appended_{{ f.src }}:
- file.absent:
- - name: {{ f.src }}
-
- {%- endif %}
-
- {%- endfor %}
-
- {%- for f in network.get('remove_iface_files', []) %}
-
- remove_iface_file_{{ f }}:
- file.absent:
- - name: {{ f }}
-
- {%- 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.items() %}
-
- {%- set interface_name = interface.get('name', interface_name) %}
-
- {# add linux network interface into OVS dpdk bridge #}
-
- {%- if interface.type == 'dpdk_ovs_bridge' %}
-
- {%- for int_name, int in network.interface.items() %}
-
- {%- set int_name = int.get('name', int_name) %}
-
- {%- if int.ovs_bridge is defined and interface_name == int.ovs_bridge %}
-
- add_int_{{ int_name }}_to_ovs_dpdk_bridge_{{ interface_name }}:
- cmd.run:
- - unless: ovs-vsctl show | grep -w {{ int_name }}
- - name: ovs-vsctl{%- if network.ovs_nowait %} --no-wait{%- endif %} add-port {{ interface_name }} {{ int_name }}
- {%- endif %}
- {%- endfor %}
-
- linux_interfaces_include_{{ interface_name }}:
- file.prepend:
- - name: /etc/network/interfaces
- - text: |
- source /etc/network/interfaces.d/*
- # Workaround for Upstream-Bug: https://github.com/saltstack/salt/issues/40262
- source /etc/network/interfaces.u/*
-
- {# create override for openvswitch dependency for dpdk br-prv #}
- /etc/systemd/system/ifup@{{ interface_name }}.service.d/override.conf:
- file.managed:
- - makedirs: true
- - require:
- - cmd: linux_network_dpdk_bridge_interface_{{ interface_name }}
- - contents: |
- [Unit]
- Requires=openvswitch-switch.service
- After=openvswitch-switch.service
-
- dpdk_ovs_bridge_{{ interface_name }}:
- file.managed:
- - name: /etc/network/interfaces.u/ifcfg-{{ interface_name }}
- - makedirs: True
- - source: salt://linux/files/ovs_bridge
- - defaults:
- bridge: {{ interface|yaml }}
- bridge_name: {{ interface_name }}
- - template: jinja
-
- dpdk_ovs_bridge_up_{{ interface_name }}:
- cmd.run:
- - name: ifup {{ interface_name }}
- - require:
- - file: dpdk_ovs_bridge_{{ interface_name }}
- - file: linux_interfaces_final_include
-
- {%- endif %}
-
- {# it is not used for any interface with type preffix dpdk,eg. dpdk_ovs_port #}
- {%- if interface.get('managed', True) and not 'dpdk' in interface.type %}
-
- {%- if grains.os_family in ['RedHat', 'Debian'] %}
-
- {%- if interface.type == 'ovs_bridge' %}
-
- ovs_bridge_{{ interface_name }}_present:
- openvswitch_bridge.present:
- - name: {{ interface_name }}
-
- {# add linux network interface into OVS bridge #}
- {%- for int_name, int in network.interface.items() %}
-
- {%- set int_name = int.get('name', int_name) %}
-
- {%- if int.ovs_bridge is defined and interface_name == int.ovs_bridge %}
-
- add_int_{{ int_name }}_to_ovs_bridge_{{ interface_name }}:
- cmd.run:
- - unless: ovs-vsctl show | grep {{ int_name }}
- - name: ovs-vsctl{%- if network.ovs_nowait %} --no-wait{%- endif %} add-port {{ interface_name }} {{ int_name }}
- {%- endif %}
- {%- endfor %}
-
- linux_interfaces_include_{{ interface_name }}:
- file.prepend:
- - name: /etc/network/interfaces
- - text: |
- source /etc/network/interfaces.d/*
- # Workaround for Upstream-Bug: https://github.com/saltstack/salt/issues/40262
- source /etc/network/interfaces.u/*
-
- ovs_bridge_{{ interface_name }}:
- file.managed:
- - name: /etc/network/interfaces.u/ifcfg-{{ interface_name }}
- - makedirs: True
- - source: salt://linux/files/ovs_bridge
- - defaults:
- bridge: {{ interface|yaml }}
- bridge_name: {{ interface_name }}
- - template: jinja
-
- ovs_bridge_up_{{ interface_name }}:
- cmd.run:
- - name: ifup {{ interface_name }}
- - require:
- - file: ovs_bridge_{{ interface_name }}
- - file: linux_interfaces_final_include
-
- {%- elif interface.type == 'ovs_bond' %}
- ovs_bond_{{ interface_name }}:
- cmd.run:
- - name: ovs-vsctl add-bond {{ interface.bridge }} {{ interface_name }} {{ interface.slaves }} bond_mode={{ interface.mode }}
- - unless: ovs-vsctl show | grep -A 2 'Port.*{{ interface_name }}.'
- - require:
- - ovs_bridge_{{ interface.bridge }}_present
-
- {%- elif interface.type == 'ovs_port' %}
-
- {%- if interface.get('port_type','internal') == 'patch' %}
-
- ovs_port_{{ interface_name }}_present:
- openvswitch_port.present:
- - name: {{ interface_name }}
- - bridge: {{ interface.bridge }}
- - require:
- {%- if dpdk_enabled and network.interface.get(interface.bridge, {}).get('type', 'ovs_bridge') == 'dpdk_ovs_bridge' %}
- - cmd: linux_network_dpdk_bridge_interface_{{ interface.bridge }}
- {%- else %}
- - openvswitch_bridge: ovs_bridge_{{ interface.bridge }}_present
- {%- endif %}
-
- ovs_port_set_type_{{ interface_name }}:
- cmd.run:
- - name: ovs-vsctl{%- if network.ovs_nowait %} --no-wait{%- endif %} set interface {{ interface_name }} type=patch
- - unless: ovs-vsctl show | grep -A 1 'Interface {{ interface_name }}' | grep patch
-
- ovs_port_set_peer_{{ interface_name }}:
- cmd.run:
- - name: ovs-vsctl{%- if network.ovs_nowait %} --no-wait{%- endif %} set interface {{ interface_name }} options:peer={{ interface.peer }}
- - unless: ovs-vsctl show | grep -A 2 'Interface {{ interface_name }}' | grep {{ interface.peer }}
-
- {% if interface.tag is defined %}
- ovs_port_set_tag_{{ interface_name }}:
- cmd.run:
- - name: ovs-vsctl{%- if network.ovs_nowait %} --no-wait{%- endif %} set port {{ interface_name }} tag={{ interface.tag }}
- - unless: ovs-vsctl get Port {{ interface_name }} tag | grep -Fx {{ interface.tag }}
- {%- endif %}
-
- {%- else %}
-
- linux_interfaces_include_{{ interface_name }}:
- file.prepend:
- - name: /etc/network/interfaces
- - text: |
- source /etc/network/interfaces.d/*
- # Workaround for Upstream-Bug: https://github.com/saltstack/salt/issues/40262
- source /etc/network/interfaces.u/*
-
- ovs_port_{{ interface_name }}:
- file.managed:
- - name: /etc/network/interfaces.u/ifcfg-{{ interface_name }}
- - makedirs: True
- - source: salt://linux/files/ovs_port
- - defaults:
- port: {{ interface|yaml }}
- port_name: {{ interface_name }}
- auto: ""
- iface_inet: ""
- - template: jinja
-
- ovs_port_up_{{ interface_name }}:
- cmd.run:
- - name: ifup {{ interface_name }}
- - require:
- - file: ovs_port_{{ interface_name }}
- - openvswitch_bridge: ovs_bridge_{{ interface.bridge }}_present
- - file: linux_interfaces_final_include
-
- {%- endif %}
-
- {%- else %}
-
- linux_interface_{{ interface_name }}:
- network.managed:
- - enabled: {{ interface.enabled }}
- - name: {{ interface_name }}
- - type: {{ interface.type }}
- {%- if interface.address is defined %}
- {%- if grains.os_family == 'Debian' %}
- - proto: {{ interface.get('proto', 'static') }}
- {% endif %}
- {%- if grains.os_family == 'RedHat' %}
- {%- if interface.get('proto', 'none') == 'manual' %}
- - proto: 'none'
- {%- else %}
- - proto: {{ interface.get('proto', 'none') }}
- {%- endif %}
- {% endif %}
- - ipaddr: {{ interface.address }}
- - netmask: {{ interface.netmask }}
- {%- else %}
- - proto: {{ interface.get('proto', 'dhcp') }}
- {%- endif %}
-
- # IPv6
- {%- if interface.enable_ipv6 is defined %}
- - enable_ipv6: {{ interface.enable_ipv6 }}
- {%- if interface.ipv6ipaddr is defined %}
- {%- if grains.os_family == 'Debian' %}
- - ipv6proto: {{ interface.get('ipv6proto', 'static') }}
- {%- endif %}
- - ipv6ipaddr: {{ interface.ipv6ipaddr }}
- - ipv6gateway: {{ interface.ipv6gateway }}
- - ipv6netmask: {{ interface.ipv6netmask }}
- {%- endif %}
- {%- endif %}
-
- {%- if interface.type == 'slave' %}
- - master: {{ interface.master }}
- {%- endif %}
- {%- if interface.name_servers is defined %}
- - dns: {{ interface.name_servers }}
- {%- endif %}
- {%- if interface.metric is defined and grains.os_family == 'Debian' %}
- - metric: {{ interface.metric }}
- {%- endif %}
- {%- if interface.wireless is defined and grains.os_family == 'Debian' %}
- {%- if interface.wireless.security == "wpa" %}
- - wpa-ssid: {{ interface.wireless.essid }}
- - wpa-psk: {{ interface.wireless.key }}
- {%- else %}
- - wireless-ssid: {{ interface.wireless.essid }}
- - wireless-psk: {{ interface.wireless.key }}
- {%- endif %}
- {%- endif %}
- {%- if pillar.linux.network.noifupdown is defined %}
- - noifupdown: {{ pillar.linux.network.noifupdown }}
- {%- endif %}
- {%- for param in network.interface_params %}
- {{ set_param(param, interface) }}
- {%- endfor %}
- {%- if interface.require_interfaces is defined %}
- - require:
- {%- for netif in interface.get('require_interfaces', []) %}
- - network: linux_interface_{{ netif }}
- {%- endfor %}
- {%- for network in interface.get('use_ovs_ports', []) %}
- - cmd: ovs_port_up_{{ network }}
- {%- endfor %}
- {%- endif %}
- {%- if interface.type == 'bridge' %}
- - bridge: {{ interface_name }}
- - delay: 0
- - bypassfirewall: True
- - use:
- {%- for network in interface.use_interfaces %}
- - network: linux_interface_{{ network }}
- {%- endfor %}
- - ports: {% for network in interface.get('use_interfaces', []) %}{{ network }} {% endfor %}{% for network in interface.get('use_ovs_ports', []) %}{{ network }} {% endfor %}
- - require:
- {%- for network in interface.get('use_interfaces', []) %}
- - network: linux_interface_{{ network }}
- {%- endfor %}
- {%- for network in interface.get('use_ovs_ports', []) %}
- - cmd: ovs_port_up_{{ network }}
- {%- endfor %}
- {%- endif %}
- {%- if interface.type == 'bond' %}
- - slaves: {{ interface.slaves }}
- - mode: {{ interface.mode }}
- {%- endif %}
-
-
- {%- if salt['grains.get']('saltversion') < '2017.7' %}
- # TODO(ddmitriev): Remove this 'if .. endif' block completely when
- # switched to salt version 2017.7 that has the same functionality.
- {%- if interface.type == 'bond' and interface.enabled == True %}
- linux_bond_interface_{{ interface_name }}:
- cmd.run:
- - name: ifenslave {{ interface_name }} {{ interface.slaves }}
- - require:
- - network: linux_interface_{{ interface_name }}
- - onchanges:
- - network: linux_interface_{{ interface_name }}
- {%- for network in interface.slaves.split() %}
- - network: linux_interface_{{ network }}
- {%- endfor %}
- {%- endif %}
- {%- endif %}
-
- {%- for network in interface.get('use_ovs_ports', []) %}
-
- remove_interface_{{ network }}_line1:
- file.replace:
- - name: /etc/network/interfaces
- - pattern: auto {{ network }}$
- - repl: ""
-
- remove_interface_{{ network }}_line2:
- file.replace:
- - name: /etc/network/interfaces
- - pattern: iface {{ network }} inet manual
- - repl: ""
-
- {%- endfor %}
-
- {%- if interface.gateway is defined and network.resolv is not defined %}
-
- linux_system_network:
- network.system:
- - enabled: {{ interface.enabled }}
- - hostname: {{ network.fqdn }}
- {%- if interface.gateway is defined %}
- - gateway: {{ interface.gateway }}
- - gatewaydev: {{ interface_name }}
- {%- endif %}
- - nozeroconf: True
- - nisdomain: {{ system.domain }}
- - require_reboot: True
-
- {%- endif %}
-
- {%- endif %}
-
- {%- endif %}
-
- {%- if interface.wireless is defined %}
-
- {%- if grains.os_family == 'Arch' %}
-
- linux_network_packages:
- pkg.installed:
- - pkgs: {{ network.pkgs | json }}
-
- /etc/netctl/network_{{ interface.wireless.essid }}:
- file.managed:
- - source: salt://linux/files/wireless
- - mode: 755
- - template: jinja
- - require:
- - pkg: linux_network_packages
- - defaults:
- interface_name: {{ interface_name }}
-
- switch_profile_{{ interface.wireless.essid }}:
- cmd.run:
- - name: netctl switch-to network_{{ interface.wireless.essid }}
- - cwd: /root
- - unless: "iwconfig {{ interface_name }} | grep -e 'ESSID:\"{{ interface.wireless.essid }}\"'"
- - require:
- - file: /etc/netctl/network_{{ interface.wireless.essid }}
-
- enable_profile_{{ interface.wireless.essid }}:
- cmd.run:
- - name: netctl enable network_{{ interface.wireless.essid }}
- - cwd: /root
- - unless: test -e /etc/systemd/system/multi-user.target.wants/netctl@network_{{ interface.wireless.essid }}.service
- - require:
- - file: /etc/netctl/network_{{ interface.wireless.essid }}
-
- {%- endif %}
-
- {%- endif %}
-
- {%- endif %}
-
- {%- if interface.route is defined %}
-
- linux_network_{{ interface_name }}_routes:
- network.routes:
- - name: {{ interface_name }}
- - routes:
- {%- for route_name, route in interface.route.items() %}
- - name: {{ route_name }}
- ipaddr: {{ route.address }}
- netmask: {{ route.netmask }}
- {%- if route.gateway is defined %}
- gateway: {{ route.gateway }}
- {%- endif %}
- {%- endfor %}
- {%- if interface.noifupdown is defined %}
- - require_reboot: {{ interface.noifupdown }}
- {%- 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 %}
-
- {%- if network.bridge != 'none' %}
-
- linux_interfaces_final_include:
- file.prepend:
- - name: /etc/network/interfaces
- - text: |
- source /etc/network/interfaces.d/*
- # Workaround for Upstream-Bug: https://github.com/saltstack/salt/issues/40262
- source /etc/network/interfaces.u/*
-
- linux_interfaces_final_include_no_requisite:
- file.prepend:
- - name: /etc/network/interfaces
- - text: |
- source /etc/network/interfaces.d/*
- # Workaround for Upstream-Bug: https://github.com/saltstack/salt/issues/40262
- source /etc/network/interfaces.u/*
-
- {%- endif %}
-
- {%- endif %}
-
- {%- if network.network_manager.disable is defined and network.network_manager.disable == True %}
-
- NetworkManager:
- service.dead:
- - enable: false
-
- {%- endif %}
-
- {%- if network.tap_custom_txqueuelen is defined %}
-
- /etc/udev/rules.d/60-net-txqueue.rules:
- file.managed:
- - source: salt://linux/files/60-net-txqueue.rules
- - mode: 755
- - template: jinja
- - defaults:
- tap_custom_txqueuelen: {{ network.tap_custom_txqueuelen }}
-
- udev_reload_rules:
- cmd.run:
- - name: "/bin/udevadm control --reload-rules"
- - onchanges:
- - file: /etc/udev/rules.d/60-net-txqueue.rules
-
- udev_retrigger:
- cmd.run:
- - name: "/bin/udevadm trigger --attr-match=subsystem=net"
- - onchanges:
- - udev_reload_rules
-
- {%- endif %}
|