Pārlūkot izejas kodu

Add concat and remove for interfaces.d

Change-Id: Ia97c5a79c5298f24aca6ca9148ce48546f3bcb70
pull/115/head
Petr Jediný pirms 7 gadiem
vecāks
revīzija
d577cb5c36
2 mainītis faili ar 45 papildinājumiem un 0 dzēšanām
  1. +19
    -0
      README.rst
  2. +26
    -0
      linux/network/interface.sls

+ 19
- 0
README.rst Parādīt failu

@@ -847,6 +847,25 @@ OpenVswitch Bridges
use_interfaces:
- eth1

Concatinating and removing interface files

Debian based distributions have `/etc/network/interfaces.d/` directory, where
you can store configuration of network interfaces in separate files. You can
concatinate the files to the defined destination when needed, this operation
removes the file from the `/etc/network/interfaces.d/`. If you just need to
remove iface files, you can use the `remove_iface_files` key.

.. code-block:: yaml

linux:
network:
concat_iface_files:
- src: '/etc/network/interfaces.d/50-cloud-init.cfg'
dst: '/etc/network/interfaces'
remove_iface_files:
- '/etc/network/interfaces.d/90-custom.cfg'


DHCP client configuration

None of the keys is mandatory, include only those you really need. For full list

+ 26
- 0
linux/network/interface.sls Parādīt failu

@@ -20,6 +20,32 @@ linux_network_bridge_pkgs:

{%- 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 %}


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

{%- set interface_name = interface.get('name', interface_name) %}

Notiek ielāde…
Atcelt
Saglabāt