Browse Source

updating readme, extending network.interfaces with bridge config support

tags/v0.1
Arnold Bechtoldt 11 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

@@ -40,8 +40,23 @@ 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

@@ -5,6 +5,20 @@ Debian:
enabled: True
proto: dhcp
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:
- name: lo
proto: loopback

+ 14
- 10
network/interfaces.sls View File

@@ -3,6 +3,12 @@

{% 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) %}
{% set interfaces = interfaces + salt['pillar.get']('network:interfaces') %}
{% endif %}
@@ -15,15 +21,13 @@ network-{{ 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']) }}
{% 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 %}
{% endfor %}

Loading…
Cancel
Save