mirror of
https://github.com/saltstack-formulas/bind-formula.git
synced 2025-04-15 17:20:21 +00:00
Split bind formula into two states; added map; added pillar examples
This commit is contained in:
parent
499ea4cbd5
commit
f43b760240
5 changed files with 87 additions and 24 deletions
37
README.rst
37
README.rst
|
@ -1,7 +1,38 @@
|
|||
====
|
||||
bind
|
||||
====
|
||||
|
||||
bind
|
||||
----
|
||||
Formulas to set up and configure the bind DNS server.
|
||||
|
||||
Set up a caching bind nameserver
|
||||
.. note::
|
||||
|
||||
See the full `Salt Formulas installation and usage instructions
|
||||
<http://docs.saltstack.com/topics/conventions/formulas.html>`_.
|
||||
|
||||
Available states
|
||||
================
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
|
||||
``bind``
|
||||
--------
|
||||
|
||||
Install the bind package and start the bind service.
|
||||
|
||||
``bind.config``
|
||||
---------------
|
||||
|
||||
Manage the bind configuration file.
|
||||
|
||||
Example Pillar:
|
||||
|
||||
.. code:: yaml
|
||||
|
||||
bind:
|
||||
config:
|
||||
name: /etc/named.conf
|
||||
source: salt://bind/files/named.conf
|
||||
user: root
|
||||
group: named
|
||||
mode: 640
|
||||
|
|
17
bind/config.sls
Normal file
17
bind/config.sls
Normal file
|
@ -0,0 +1,17 @@
|
|||
{% from "bind/map.jinja" import map with context %}
|
||||
|
||||
include:
|
||||
- bind
|
||||
|
||||
bind_config:
|
||||
file:
|
||||
- managed
|
||||
- name: {{ map.config }}
|
||||
- source: {{ salt['pillar.get']('bind:config:tmpl', 'salt://bind/files/named.conf') }}
|
||||
- user: {{ salt['pillar.get']('bind:config:user', 'root') }}
|
||||
- group: {{ salt['pillar.get']('bind:config:group', 'named') }}
|
||||
- mode: {{ salt['pillar.get']('bind:config:mode', '640') }}
|
||||
- require:
|
||||
- pkg: bind
|
||||
- watch_in:
|
||||
- service: bind
|
|
@ -1,22 +1,10 @@
|
|||
bind9:
|
||||
pkg.installed:
|
||||
{% if grains['os_family'] == 'Debian' %}
|
||||
- pkgs:
|
||||
- bind9
|
||||
- bind9-doc
|
||||
- bind9utils
|
||||
{% else %}
|
||||
- name: bind
|
||||
file.managed:
|
||||
- name: /etc/named.conf
|
||||
- source: salt://bind/files/named.conf
|
||||
- user: root
|
||||
- group: named
|
||||
- mode: 640
|
||||
- require:
|
||||
- pkg: bind9
|
||||
service.running:
|
||||
- name: named
|
||||
{% from "bind/map.jinja" import map with context %}
|
||||
|
||||
bind:
|
||||
pkg:
|
||||
- installed
|
||||
- pkgs: {{ map.pkgs|json }}
|
||||
service:
|
||||
- running
|
||||
- name: {{ map.service }}
|
||||
- enable: True
|
||||
- watch:
|
||||
- file: bind9
|
||||
|
|
14
bind/map.jinja
Normal file
14
bind/map.jinja
Normal file
|
@ -0,0 +1,14 @@
|
|||
{% set map = salt['grains.filter_by']({
|
||||
'Debian': {
|
||||
'pkgs': ['bind9', 'bind9utils'],
|
||||
'service': 'named',
|
||||
|
||||
'config': '/etc/named.conf',
|
||||
},
|
||||
'RedHat': {
|
||||
'pkgs': ['bind'],
|
||||
'service': 'named',
|
||||
|
||||
'config': '/etc/named.conf',
|
||||
},
|
||||
}, merge=salt['pillar.get']('bind:lookup')) %}
|
|
@ -0,0 +1,13 @@
|
|||
bind:
|
||||
lookup:
|
||||
pkgs:
|
||||
- bind
|
||||
service:
|
||||
- named
|
||||
|
||||
bind:
|
||||
config:
|
||||
tmpl: salt://bind/files/named.conf
|
||||
user: root
|
||||
group: named
|
||||
mode: 640
|
Loading…
Add table
Reference in a new issue