Browse Source

modernize network.interfaces

tags/v0.1
Arnold Bechtoldt 10 years ago
parent
commit
87e7dfa3bf
2 changed files with 14 additions and 12 deletions
  1. +3
    -3
      README.rst
  2. +11
    -9
      network/interfaces.sls

+ 3
- 3
README.rst View File



Tested with: Tested with:


* 2014.1.3
* 2014.1.4


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


Tested with: Tested with:


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

+ 11
- 9
network/interfaces.sls View File

#!jinja|yaml

{% from "network/defaults.yaml" import rawmap with context %} {% from "network/defaults.yaml" import rawmap with context %}
{% set datamap = salt['grains.filter_by'](rawmap, merge=salt['pillar.get']('network:lookup')) %} {% 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) -%} {%- macro set_p(paramname, dictvar) -%}
{%- if paramname in dictvar -%} {%- if paramname in dictvar -%}
{% endif %} {% endif %}


{% for n in interfaces %} {% for n in interfaces %}
network-{{ n['name'] }}:
network-{{ n.name }}:
network: network:
- managed - 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) }} {{ set_p(p, n) }}
{% endfor %} {% endfor %}
{% if n['use'] is defined %}
{% if n.use is defined %}
- use: - use:
{% for u in n['use'] %}
{% for u in n.use %}
- network: network-{{ u }} - network: network-{{ u }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}

Loading…
Cancel
Save