Browse Source

Add support routes using salt.states.network. Testing on ubuntu 14.04

tags/v0.1
root 10 years ago
parent
commit
383cd25a5a
3 changed files with 33 additions and 0 deletions
  1. +1
    -0
      network/defaults.yaml
  2. +23
    -0
      network/routes.sls
  3. +9
    -0
      pillar.example.sls

+ 1
- 0
network/defaults.yaml View File

# vim: sts=2 ts=2 sw=2 et ai
{% load_yaml as rawmap %} {% load_yaml as rawmap %}
Debian: Debian:
interfaces: interfaces:

+ 23
- 0
network/routes.sls View File

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

#{% from "network/defaults.yaml" import rawmap with context %}
{% set datamap = salt['pillar.get']('network') %}
{% set routes = datamap.routes %}

{% if salt['pillar.get']('network:routes', False) %}

{% for r in routes %}
{{ r.name }}:
network.routes:
- name: {{ r.name }}
- routes:
{% for n in r.networks %}
- name: {{ n.name }}
ipaddr: {{ n.ipaddr }}
netmask: {{ n.netmask }}
gateway: {{ n.gateway }}
{% endfor %}
{% endfor %}

{% endif %}

+ 9
- 0
pillar.example.sls View File

- name: example.net - name: example.net
ip: 192.168.2.200 ip: 192.168.2.200
ensure: absent ensure: absent

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

Loading…
Cancel
Save