a_karamyshev преди 9 години
родител
ревизия
d57adc277a
променени са 7 файла, в които са добавени 96 реда и са изтрити 74 реда
  1. +10
    -17
      LICENSE
  2. +60
    -53
      README.rst
  3. +11
    -0
      meta.yaml
  4. +4
    -1
      network/defaults.yaml
  5. +8
    -2
      network/interfaces.sls
  6. +1
    -1
      network/resolver.sls
  7. +2
    -0
      network/routes.sls

+ 10
- 17
LICENSE Целия файл

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

NOTICE THE LICENSE EXCEPTIONS BELOW.
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

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

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.


EXCEPTIONS:
You MAY NOT upload parts or the whole work of this product on Github or
any other platform again UNLESS you are in possession of an agreement
by the author OR use the function called "FORK" provided on Github itself.
Other parts of the specified license above are not affected.
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.

+ 60
- 53
README.rst Целия файл

@@ -2,85 +2,92 @@
saltstack-network-formula
=========================

.. image:: https://api.flattr.com/button/flattr-badge-large.png
:target: https://flattr.com/submit/auto?user_id=bechtoldt&url=https%3A%2F%2Fgithub.com%2Fbechtoldt%2Fsaltstack-network-formula

Salt Stack Formula to set up and configure a host's network configuration
.. image:: https://img.shields.io/badge/donate-flattr-red.svg
:alt: Donate via flattr
:target: https://flattr.com/profile/bechtoldt

NOTICE BEFORE YOU USE
=====================
.. image:: https://img.shields.io/gratipay/bechtoldt.svg
:alt: Donate via Gratipay
:target: https://www.gratipay.com/bechtoldt/

* This formula aims to follow the conventions and recommendations described at http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html#conventions-formula and http://docs.saltstack.com/en/latest/topics/best_practices.html
.. image:: https://img.shields.io/badge/license-Apache--2.0-blue.svg
:alt: Apache-2.0-licensed
:target: https://github.com/bechtoldt/saltstack-network-formula/blob/master/LICENSE

TODO
====
.. image:: https://img.shields.io/badge/chat-gitter-brightgreen.svg
:alt: Join Gitter Chat
:target: https://gitter.im/bechtoldt/saltstack-network-formula?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge

.. image:: https://img.shields.io/badge/chat-%23salt%20@%20Freenode-brightgreen.svg
:alt: Join Internet Relay Chat
:target: http://webchat.freenode.net/?channels=%23salt&uio=d4

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

.. contents::
:backlinks: none
:local:

* Use more of the available options in interfaces.sls of network.managed
* interfaces: configure broadcast if set

Instructions
============
------------

1. Add this repository as a `GitFS <http://docs.saltstack.com/topics/tutorials/gitfs.html>`_ backend in your Salt master config.
Please refer to https://github.com/bechtoldt/formula-docs to learn how to use
this formula, how it is built and how you can add your changes.

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

3. Include this Formula within another Formula or simply define your needed states within the Salt top file (``/srv/salt/top.sls``).
**NOTICE:** This formula might uses the formhelper module which is a very useful Salt execution module that isn't available in upstream yet. Please consider retrieving it manually from https://github.com/bechtoldt/salt-modules and make it available to your Salt installation. Read `SaltStack documentation <http://docs.saltstack.com/en/latest/ref/modules/#modules-are-easy-to-write>`_ to see how this can be achieved.

Available states
================
Take a look at older releases (branches) to get a version that isn't using the formhelper yet (if any).

.. contents::
:local:

``network.hosts``
-----------------
Sets the static lookup table for hostnames

``network.interfaces``
----------------------
Sets the network interfaces configuration
Contributing
------------

``network.resolver``
--------------------
Sets the resolver configuration
Contributions are welcome! All development guidelines we ask you to follow can
be found at https://github.com/bechtoldt/formula-docs.

``network.routes``
------------------
Manages network routes
In general:

Additional resources
====================
1. Fork this repo on Github
2. Add changes, test them, update docs (README.rst) if possible
3. Submit your pull request (PR) on Github, wait for feedback

None
But it’s better to `file an issue <https://github.com/bechtoldt/saltstack-network-formula/issues/new>`_ with your idea first.

Formula Dependencies
====================

None
TODO
----

* add instructions how to use formhelper, add information about it in the formula-docs (dependency), show up alternative?
* table/ matrix: os/salt compatibility (dedicated file)
* add list of available states
* add tests
* Use more of the available options in interfaces.sls of network.managed
* interfaces: configure broadcast if set
* rewrite using #!py renderer

Contributions
=============

Contributions are always welcome. All development guidelines you have to know are
Authors
-------

* write clean code (proper YAML+Jinja syntax, no trailing whitespaces, no empty lines with whitespaces, LF only)
* set sane default settings
* test your code
* update README.rst doc
* Alan Pearce <alan@alanpearce.co.uk>
* Arnold Bechtoldt <mail@arnoldbechtoldt.com>
* Krzysztof Pawłowski <krzysztof.pawlowski@firma.interia.pl>
* René Jochum <rene@jochums.at>
* Simon Lloyd <simon@slloyd.net>
* root <root@saltmaster01.(none)>

Salt Compatibility
==================

Tested with:
Miscellaneous
-------------

* 2014.1
* 2014.7
Recommended formulas:

OS Compatibility
================
* SaltStack management: `saltstack-salt-formula <https://github.com/bechtoldt/saltstack-salt-formula>`_

Tested with:
Further reading:

* GNU/ Linux Debian Wheezy
* CentOS 6 (not completly tested)
* Documentation and Standardisation of SaltStack formulas: https://github.com/bechtoldt/formula-docs

+ 11
- 0
meta.yaml Целия файл

@@ -0,0 +1,11 @@
name: saltstack-network-formula
source: https://github.com/bechtoldt/saltstack-network-formula
summary: SaltStack Formula to set up and configure a host's network configuration
todo:
- add instructions how to use formhelper, add information about it in the formula-docs (dependency), show up alternative?
- 'table/ matrix: os/salt compatibility (dedicated file)'
- add list of available states
- add tests
- Use more of the available options in interfaces.sls of network.managed
- 'interfaces: configure broadcast if set'
- 'rewrite using #!py renderer'

+ 4
- 1
network/defaults.yaml Целия файл

@@ -20,6 +20,7 @@ Debian:
- pre_down_cmds
- post_up_cmds
- post_down_cmds
- noifupdown
{#- bonding #}
- master
- mode
@@ -82,6 +83,7 @@ RedHat:
- pre_down_cmds
- post_up_cmds
- post_down_cmds
- noifupdown
{#- bonding #}
- master
- mode
@@ -126,7 +128,8 @@ RedHat:
routes: {}
FreeBSD:
interfaces:
resolver: {}
resolver:
group: wheel
hosts: {}
routes: {}
{% endload %}

+ 8
- 2
network/interfaces.sls Целия файл

@@ -16,8 +16,14 @@
{% set interfaces = interfaces + salt['pillar.get']('network:interfaces') %}
{% endif %}

{% for n in interfaces %}
network_{{ n.name }}:
{% for n in interfaces -%}
{%- if 'ipaddr' in n -%}
{%- set state_id = 'network_' ~ n.name ~ '_' ~ n.ipaddr -%}
{%- else %}
{%- set state_id = 'network_' ~ n.name -%}
{%- endif %}

{{ state_id }}:
network:
- managed
- name: {{ n.name }}

+ 1
- 1
network/resolver.sls Целия файл

@@ -7,9 +7,9 @@ resolver:
file:
- managed
- name: {{ datamap.resolver.path|default('/etc/resolv.conf') }}
- mode: {{ datamap.resolver.mode|default(644) }}
- user: {{ datamap.resolver.user|default('root') }}
- group: {{ datamap.resolver.group|default('root') }}
- mode: {{ datamap.resolver.mode|default(644) }}
- contents: |
{%- if salt['pillar.get']('network:resolver:file_prepend', False) %}
{{ salt['pillar.get']('network:resolver:file_prepend') }}

+ 2
- 0
network/routes.sls Целия файл

@@ -16,6 +16,8 @@ routes_{{ v.name|default(k) }}:
- name: {{ net.name }}
ipaddr: {{ net.ipaddr }}
netmask: {{ net.netmask }}
{% if net.gateway is defined %}
gateway: {{ net.gateway }}
{% endif %}
{% endfor %}
{% endfor %}

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