Przeglądaj źródła

modernize network.interfaces

tags/v0.1
Arnold Bechtoldt 10 lat temu
rodzic
commit
87e7dfa3bf
2 zmienionych plików z 14 dodań i 12 usunięć
  1. +3
    -3
      README.rst
  2. +11
    -9
      network/interfaces.sls

+ 3
- 3
README.rst Wyświetl plik

@@ -67,12 +67,12 @@ Salt Compatibility

Tested with:

* 2014.1.3
* 2014.1.4

OS Compatibility
================

Tested with:

* GNU/ Linux Debian Wheezy 7.5
* CentOS 6.5
* GNU/ Linux Debian Wheezy
* CentOS 6

+ 11
- 9
network/interfaces.sls Wyświetl plik

@@ -1,7 +1,9 @@
#!jinja|yaml

{% from "network/defaults.yaml" import rawmap with context %}
{% set datamap = salt['grains.filter_by'](rawmap, merge=salt['pillar.get']('network:lookup')) %}

{% set interfaces = datamap['interfaces']['def_entries'] %}
{% set interfaces = datamap.interfaces.def_entries %}

{%- macro set_p(paramname, dictvar) -%}
{%- if paramname in dictvar -%}
@@ -14,19 +16,19 @@
{% endif %}

{% for n in interfaces %}
network-{{ n['name'] }}:
network-{{ n.name }}:
network:
- managed
- name: {{ n['name'] }}
- enabled: {{ n['enabled']|default(datamap['interfaces']['values']['enabled']) }}
- proto: {{ n['proto']|default(datamap['interfaces']['values']['proto']) }}
- type: {{ n['type']|default(datamap['interfaces']['values']['type']) }}
{% for p in datamap['interfaces']['params_supported'] %}
- name: {{ n.name }}
- enabled: {{ n.enabled|default(datamap.interfaces.values.enabled) }}
- proto: {{ n.proto|default(datamap.interfaces.values.proto) }}
- type: {{ n.type|default(datamap.interfaces.values.type) }}
{% for p in datamap.interfaces.params_supported %}
{{ set_p(p, n) }}
{% endfor %}
{% if n['use'] is defined %}
{% if n.use is defined %}
- use:
{% for u in n['use'] %}
{% for u in n.use %}
- network: network-{{ u }}
{% endfor %}
{% endif %}

Ładowanie…
Anuluj
Zapisz