Browse Source

improving the new code a bit

tags/v0.1
Arnold Bechtoldt 10 years ago
parent
commit
59f8bf903f
4 changed files with 20 additions and 13 deletions
  1. +4
    -0
      README.rst
  2. +2
    -2
      network/defaults.yaml
  3. +10
    -7
      network/routes.sls
  4. +4
    -4
      pillar.example.sls

+ 4
- 0
README.rst View File

-------------------- --------------------
Sets the resolver configuration Sets the resolver configuration


``network.routes``
------------------
Manages network routes

Additional resources Additional resources
==================== ====================



+ 2
- 2
network/defaults.yaml View File

- pre_down_cmds - pre_down_cmds
- post_up_cmds - post_up_cmds
- post_down_cmds - post_down_cmds
# bonding
{#- bonding #}
- master - master
- mode - mode
- slaves - slaves
- pre_down_cmds - pre_down_cmds
- post_up_cmds - post_up_cmds
- post_down_cmds - post_down_cmds
# bonding
{#- bonding #}
- master - master
- mode - mode
- slaves - slaves

+ 10
- 7
network/routes.sls View File

#!jinja|yaml #!jinja|yaml
# vim: sts=2 ts=2 sw=2 et ai # vim: sts=2 ts=2 sw=2 et ai

{% 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')) %} {% set datamap = salt['grains.filter_by'](rawmap, merge=salt['pillar.get']('network')) %}


{% for r in datamap.routes %}
{# TODO: The function name 'routes' in 'network.routes' should be moved into the list as soon as it's possible
for code convention reasons. Unfortunately 'routes' is also used in **kwargs when calling ip.build_routes
in salt.states.network #}
{% for r in datamap.routes|default([]) %}
{{ r.name }}: {{ r.name }}:
network.routes: network.routes:
- name: {{ r.name }}
- routes: - routes:
{% for n in r.networks %}
- name: {{ n.name }}
{% for n in r.networks %}
- name: {{ n.name }}
ipaddr: {{ n.ipaddr }} ipaddr: {{ n.ipaddr }}
netmask: {{ n.netmask }}
gateway: {{ n.gateway }}
{% endfor %}
netmask: {{ n.netmask }}
gateway: {{ n.gateway }}
{% endfor %}
{% endfor %} {% endfor %}

+ 4
- 4
pillar.example.sls View File

routes: routes:
- name: eth1 - name: eth1
networks: networks:
- name: for_lan
ipaddr: 172.16.0.0
- name: for_lan
ipaddr: 172.16.0.0
netmask: 255.255.0.0 netmask: 255.255.0.0
gateway: 192.168.2.1
gateway: 192.168.2.1

Loading…
Cancel
Save