Browse Source

adding resolver config

tags/v0.1
Arnold Bechtoldt 10 years ago
parent
commit
4ffff2d7c9
5 changed files with 54 additions and 8 deletions
  1. +8
    -4
      README.md
  2. +3
    -1
      network/defaults.yaml
  3. +3
    -3
      network/interfaces.sls
  4. +31
    -0
      network/resolver.sls
  5. +9
    -0
      pillar.example.sls

+ 8
- 4
README.md View File



## TODO ## TODO


None
* Use more of the available options in interfaces.sls of network.managed


## Instructions ## Instructions




## Available states ## Available states


### network
### network.interfaces

Sets the network interfaces configuration

### network.resolver


\#TODO
Sets the resolver configuration


## Additional resources ## Additional resources




*DOES* work on: *DOES* work on:


* GNU/ Linux Debian Wheezy
* GNU/ Linux Debian Wheezy (Salt: 2014.1.0)

+ 3
- 1
network/defaults.yaml View File

{% load_yaml as rawmap %} {% load_yaml as rawmap %}
Debian: Debian:
defaults:
interface_defaults:
enabled: True enabled: True
proto: dhcp proto: dhcp
type: eth type: eth
resolver:
path: /etc/resolv.conf
default_interfaces: default_interfaces:
- name: lo - name: lo
proto: loopback proto: loopback

network/init.sls → network/interfaces.sls View File

network: network:
- managed - managed
- name: {{ n['name'] }} - name: {{ n['name'] }}
- enabled: {{ n['enabled']|default(datamap['defaults']['enabled']) }}
- proto: {{ n['proto']|default(datamap['defaults']['proto']) }}
- type: {{ n['type']|default(datamap['defaults']['type']) }}
- enabled: {{ n['enabled']|default(datamap['interface_defaults']['enabled']) }}
- proto: {{ n['proto']|default(datamap['interface_defaults']['proto']) }}
- type: {{ n['type']|default(datamap['interface_defaults']['type']) }}
{% if n['proto'] in ['static'] %} {% if n['proto'] in ['static'] %}
{% if n['ipaddr'] is defined %} {% if n['ipaddr'] is defined %}
- ipaddr: {{ n['ipaddr'] }} - ipaddr: {{ n['ipaddr'] }}

+ 31
- 0
network/resolver.sls View File

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

resolver:
file:
- managed
- name: {{ datamap['resolver']['path'] }}
- mode: '0644'
- user: root
- group: root
- contents: |
{%- if salt['pillar.get']('network:resolver:file_prepend') is defined %}
{{ salt['pillar.get']('network:resolver:file_prepend') }}
{%- endif -%}
{% if salt['pillar.get']('network:resolver:domain') is defined %}
domain: {{ salt['pillar.get']('network:resolver:domain') }}
{%- endif -%}
{%- if salt['pillar.get']('network:resolver:search') is defined %}
search: {{ salt['pillar.get']('network:resolver:search') }}
{%- endif -%}
{%- if salt['pillar.get']('network:resolver:nameservers') is defined -%}
{%- for n in salt['pillar.get']('network:resolver:nameservers') %}
nameserver: {{ n }}
{%- endfor -%}
{%- endif -%}
{%- if salt['pillar.get']('network:resolver:options') is defined %}
options: {{ salt['pillar.get']('network:resolver:options')|join(' ') }}
{%- endif -%}
{%- if salt['pillar.get']('network:resolver:file_append') is defined %}
{{ salt['pillar.get']('network:resolver:file_append') }}
{%- endif %}

+ 9
- 0
pillar.example.sls View File

netmask: 255.255.255.0 netmask: 255.255.255.0
gateway: 192.168.2.1 gateway: 192.168.2.1
- name: eth2 - name: eth2
resolver:
domain: domain.local
search: domain.local
nameservers:
- 192.168.2.1
- 2002::beef
options:
- rotate
- timeout:1

Loading…
Cancel
Save