Artem Karamyshev vor 10 Jahren
Ursprung
Commit
aac9275db8
4 geänderte Dateien mit 45 neuen und 0 gelöschten Zeilen
  1. +1
    -0
      network/defaults.yaml
  2. +12
    -0
      network/interfaces.sls
  3. +23
    -0
      network/routes.sls
  4. +9
    -0
      pillar.example.sls

+ 1
- 0
network/defaults.yaml Datei anzeigen

@@ -1,3 +1,4 @@
# vim: sts=2 ts=2 sw=2 et ai
{% load_yaml as rawmap %}
Debian:
interfaces:

+ 12
- 0
network/interfaces.sls Datei anzeigen

@@ -33,6 +33,18 @@ network-{{ n.name }}:
- network: network-{{ u }}
{% endfor %}
{% endif %}
{% if n.provider is defined %}
- provider: {{ n.provider }}
{% endif %}
{% if n.user is defined %}
- user: {{ n.user }}
{% endif %}
{% if n.password is defined %}
- password: {{ n.password }}
{% endif %}
{% if n.pppoe_iface is defined %}
- pppoe_iface: {{ n.pppoe_iface }}
{% endif %}
{% if n.type|default(datamap.interfaces.default_values.type) == 'vlan' and datamap.interfaces.vlan_pkg|default('vlan') %}
{% do pkgs.append(datamap.interfaces.vlan_pkg|default('vlan')) %}
- require:

+ 23
- 0
network/routes.sls Datei anzeigen

@@ -0,0 +1,23 @@
#!jinja|yaml
# vim: sts=2 ts=2 sw=2 et ai

#{% from "network/defaults.yaml" import rawmap with context %}
{% set datamap = salt['pillar.get']('network') %}
{% set routes = datamap.routes %}

{% if salt['pillar.get']('network:routes', False) %}

{% for r in routes %}
{{ r.name }}:
network.routes:
- name: {{ r.name }}
- routes:
{% for n in r.networks %}
- name: {{ n.name }}
ipaddr: {{ n.ipaddr }}
netmask: {{ n.netmask }}
gateway: {{ n.gateway }}
{% endfor %}
{% endfor %}

{% endif %}

+ 9
- 0
pillar.example.sls Datei anzeigen

@@ -63,3 +63,12 @@ network:
- name: example.net
ip: 192.168.2.200
ensure: absent

routes:
- name: eth1
networks:
- name: for_lan
ipaddr: 172.16.0.0
netmask: 255.255.0.0
gateway: 192.168.2.1

Laden…
Abbrechen
Speichern