瀏覽代碼

updating readme, extending network.interfaces with bridge config support

tags/v0.1
Arnold Bechtoldt 10 年之前
父節點
當前提交
29252a6812
共有 3 個文件被更改,包括 46 次插入13 次删除
  1. +18
    -3
      README.md
  2. +14
    -0
      network/defaults.yaml
  3. +14
    -10
      network/interfaces.sls

+ 18
- 3
README.md 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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…
取消
儲存