Browse Source

Add concat and remove for interfaces.d

Change-Id: Ia97c5a79c5298f24aca6ca9148ce48546f3bcb70
pull/115/head
Petr Jediný 7 years ago
parent
commit
d577cb5c36
2 changed files with 45 additions and 0 deletions
  1. +19
    -0
      README.rst
  2. +26
    -0
      linux/network/interface.sls

+ 19
- 0
README.rst View File

use_interfaces: use_interfaces:
- eth1 - 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 DHCP client configuration


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

+ 26
- 0
linux/network/interface.sls View File



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


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


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

Loading…
Cancel
Save