Преглед на файлове

providing initial configuration

tags/v0.1
Arnold Bechtoldt преди 10 години
родител
ревизия
b2ae19a3b8
променени са 7 файла, в които са добавени 110 реда и са изтрити 2 реда
  1. +5
    -0
      .gitignore
  2. +13
    -0
      LICENSE
  3. +37
    -2
      README.md
  4. +1
    -0
      VERSION
  5. +11
    -0
      network/defaults.yaml
  6. +32
    -0
      network/init.sls
  7. +11
    -0
      pillar.example.sls

+ 5
- 0
.gitignore Целия файл

@@ -0,0 +1,5 @@
pkg/
metadata.json
*.idea
*.swp
*.tmp

+ 13
- 0
LICENSE Целия файл

@@ -0,0 +1,13 @@
Copyright (c) 2014 Arnold Bechtoldt <mail@arnoldbechtoldt.com>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

+ 37
- 2
README.md Целия файл

@@ -1,4 +1,39 @@
network-formula
===============
# network-formula

Salt Stack Formula to set up and configure a host's network configuration

## NOTICE BEFORE YOU USE

* This formula aims to follow the conventions and recommendations described at [http://docs.saltstack.com/topics/conventions/formulas.html](http://docs.saltstack.com/topics/conventions/formulas.html)

## TODO

None

## Instructions

1. Add this repository as a [GitFS](http://docs.saltstack.com/topics/tutorials/gitfs.html) backend in your Salt master config.

2. Configure your Pillar top file (`/srv/pillar/top.sls`), see pillar.example

3. Include this Formula within another Formula or simply define your needed states within the Salt top file (`/srv/salt/top.sls`).

## Available states

### network

\#TODO

## Additional resources

None

## Formula Dependencies

None

## Compatibility

*DOES* work on:

* GNU/ Linux Debian Wheezy

+ 1
- 0
VERSION Целия файл

@@ -0,0 +1 @@
0.1.0

+ 11
- 0
network/defaults.yaml Целия файл

@@ -0,0 +1,11 @@
{% load_yaml as rawmap %}
Debian:
defaults:
enabled: True
proto: dhcp
type: eth
default_interfaces:
- name: lo
proto: loopback
type: eth
{% endload %}

+ 32
- 0
network/init.sls Целия файл

@@ -0,0 +1,32 @@
{% from "network/defaults.yaml" import rawmap with context %}
{% set datamap = salt['grains.filter_by'](rawmap, merge=salt['pillar.get']('network:lookup')) %}

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

{% if salt['pillar.get']('network:interfaces') is defined %}
{% set interfaces = interfaces + salt['pillar.get']('network:interfaces') %}
{% endif %}

{% for n in interfaces %}
network-{{ n['name'] }}:
network:
- managed
- name: {{ n['name'] }}
- enabled: {{ n['enabled']|default(datamap['defaults']['enabled']) }}
- proto: {{ n['proto']|default(datamap['defaults']['proto']) }}
- type: {{ n['type']|default(datamap['defaults']['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'] }}
{% endif %}
{% if n['broadcast'] is defined %}
- broadcast: {{ n['broadcast'] }}
{% endif %}
{% endif %}
{% endfor %}

+ 11
- 0
pillar.example.sls Целия файл

@@ -0,0 +1,11 @@
network:
interfaces:
- name: eth0
proto: dhcp
type: eth
- name: eth1
proto: static
ipaddr: 192.168.2.31
netmask: 255.255.255.0
gateway: 192.168.2.1
- name: eth2

Loading…
Отказ
Запис