@@ -0,0 +1,5 @@ | |||
pkg/ | |||
metadata.json | |||
*.idea | |||
*.swp | |||
*.tmp |
@@ -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. |
@@ -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 |
@@ -0,0 +1 @@ | |||
0.1.0 |
@@ -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 %} |
@@ -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 %} |
@@ -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 |