Browse Source

updating readme, extending network.interfaces with bridge config support

tags/v0.1
Arnold Bechtoldt 10 years ago
parent
commit
29252a6812
3 changed files with 46 additions and 13 deletions
  1. +18
    -3
      README.md
  2. +14
    -0
      network/defaults.yaml
  3. +14
    -10
      network/interfaces.sls

+ 18
- 3
README.md View File



None None


## Compatibility
## Contributions


*DOES* work on:
Contributions are always welcome. All development guidelines you have to know are


* GNU/ Linux Debian Wheezy (Salt: 2014.1.0)
* write clean code (proper YAML+Jinja syntax, no trailing whitespaces, no empty lines with whitespaces, LF only)
* set sane default settings
* test your code
* update README.md doc

## Salt Compatibility

Tested with:

* 2014.1.0

## OS Compatibility

Tested with:

* GNU/ Linux Debian Wheezy

+ 14
- 0
network/defaults.yaml View File

enabled: True enabled: True
proto: dhcp proto: dhcp
type: eth type: eth
params_supported:
- ipaddr
- gateway
- netmask
- bridge
- ports
- delay
- stp
- maxwait
- fd
- pre_up_cmds
- pre_down_cmds
- post_up_cmds
- post_down_cmds
def_entries: def_entries:
- name: lo - name: lo
proto: loopback proto: loopback

+ 14
- 10
network/interfaces.sls View File



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


{%- macro set_p(paramname, dictvar) -%}
{%- if paramname in dictvar -%}
- {{ paramname }}: {{ dictvar[paramname] }}
{%- endif -%}
{%- endmacro -%}

{% if salt['pillar.get']('network:interfaces', False) %} {% if salt['pillar.get']('network:interfaces', False) %}
{% set interfaces = interfaces + salt['pillar.get']('network:interfaces') %} {% set interfaces = interfaces + salt['pillar.get']('network:interfaces') %}
{% endif %} {% endif %}
- enabled: {{ n['enabled']|default(datamap['interfaces']['values']['enabled']) }} - enabled: {{ n['enabled']|default(datamap['interfaces']['values']['enabled']) }}
- proto: {{ n['proto']|default(datamap['interfaces']['values']['proto']) }} - proto: {{ n['proto']|default(datamap['interfaces']['values']['proto']) }}
- type: {{ n['type']|default(datamap['interfaces']['values']['type']) }} - type: {{ n['type']|default(datamap['interfaces']['values']['type']) }}
{% if n['proto'] in ['static'] %}
{% if n['ipaddr'] is defined %}
- ipaddr: {{ n['ipaddr'] }}
{% endif %}
{% if n['gateway'] is defined %}
- gateway: {{ n['gateway'] }}
{% endif %}
{% if n['netmask'] is defined %}
- netmask: {{ n['netmask'] }}
{% for p in datamap['interfaces']['params_supported'] %}
{{ set_p(p, n) }}
{% endfor %}
{% if n['use'] is defined %}
- use:
{% for u in n['use'] %}
- network: network-{{ u }}
{% endfor %}
{% endif %} {% endif %}
{% endif %}
{% endfor %} {% endfor %}

Loading…
Cancel
Save