mirror of
https://github.com/saltstack-formulas/bind-formula.git
synced 2025-04-17 02:00:23 +00:00
Merge pull request #1 from saltstack-formulas/master
Pull from saltstack.
This commit is contained in:
commit
6f4292c3cf
6 changed files with 81 additions and 91 deletions
|
@ -6,22 +6,22 @@ include:
|
|||
{{ map.log_dir }}:
|
||||
file.directory:
|
||||
- user: root
|
||||
- group: bind
|
||||
- group: {{ salt['pillar.get']('bind:config:group', map.group) }}
|
||||
- mode: 775
|
||||
- require:
|
||||
- pkg: bind
|
||||
|
||||
bind_restart:
|
||||
service.running:
|
||||
- name: bind9
|
||||
- name: {{ map.service }}
|
||||
- reload: False
|
||||
- watch:
|
||||
- file: {{ map.log_dir }}/query.log
|
||||
- require:
|
||||
- file: {{ map.log_dir }}/query.log
|
||||
|
||||
{{ map.log_dir }}/query.log:
|
||||
file.managed:
|
||||
- user: bind
|
||||
- group: bind
|
||||
- group: {{ salt['pillar.get']('bind:config:group', map.group) }}
|
||||
- mode: 644
|
||||
- require:
|
||||
- file: {{ map.log_dir }}
|
||||
|
@ -36,15 +36,16 @@ named_directory:
|
|||
- require:
|
||||
- pkg: bind
|
||||
|
||||
{% if grains['os_family'] == 'RedHat' %}
|
||||
bind_config:
|
||||
file.managed:
|
||||
- name: {{ map.config }}
|
||||
- source: 'salt://bind/files/redhat/named.conf'
|
||||
- source: 'salt://{{ map.config_source_dir }}/named.conf'
|
||||
- template: jinja
|
||||
- user: {{ salt['pillar.get']('bind:config:user', map.user) }}
|
||||
- group: {{ salt['pillar.get']('bind:config:group', map.group) }}
|
||||
- mode: {{ salt['pillar.get']('bind:config:mode', '640') }}
|
||||
- mode: {{ salt['pillar.get']('bind:config:mode', map.mode) }}
|
||||
- context:
|
||||
map: {{ map }}
|
||||
- require:
|
||||
- pkg: bind
|
||||
- watch_in:
|
||||
|
@ -53,48 +54,7 @@ bind_config:
|
|||
bind_local_config:
|
||||
file.managed:
|
||||
- name: {{ map.local_config }}
|
||||
- source: 'salt://bind/files/redhat/named.conf.local'
|
||||
- template: jinja
|
||||
- user: {{ salt['pillar.get']('bind:config:user', map.user) }}
|
||||
- group: {{ salt['pillar.get']('bind:config:group', map.group) }}
|
||||
- mode: {{ salt['pillar.get']('bind:config:mode', '644') }}
|
||||
- require:
|
||||
- pkg: bind
|
||||
- watch_in:
|
||||
- service: named
|
||||
{% endif %}
|
||||
|
||||
{% if grains['os_family'] == 'Debian' %}
|
||||
bind_config:
|
||||
file.managed:
|
||||
- name: {{ map.config }}
|
||||
- source: 'salt://bind/files/debian/named.conf'
|
||||
- template: jinja
|
||||
- user: {{ salt['pillar.get']('bind:config:user', map.user) }}
|
||||
- group: {{ salt['pillar.get']('bind:config:group', map.group) }}
|
||||
- mode: {{ salt['pillar.get']('bind:config:mode', '644') }}
|
||||
- require:
|
||||
- pkg: bind
|
||||
- watch_in:
|
||||
- service: bind
|
||||
|
||||
bind_key_config:
|
||||
file.managed:
|
||||
- name: {{ map.key_config }}
|
||||
- source: 'salt://bind/files/debian/named.conf.key'
|
||||
- template: jinja
|
||||
- user: {{ salt['pillar.get']('bind:config:user', map.user) }}
|
||||
- group: {{ salt['pillar.get']('bind:config:group', map.group) }}
|
||||
- mode: {{ salt['pillar.get']('bind:config:mode', '644') }}
|
||||
- require:
|
||||
- pkg: bind
|
||||
- watch_in:
|
||||
- service: bind
|
||||
|
||||
bind_local_config:
|
||||
file.managed:
|
||||
- name: {{ map.local_config }}
|
||||
- source: 'salt://bind/files/debian/named.conf.local'
|
||||
- source: 'salt://{{ map.config_source_dir }}/named.conf.local'
|
||||
- template: jinja
|
||||
- user: {{ salt['pillar.get']('bind:config:user', map.user) }}
|
||||
- group: {{ salt['pillar.get']('bind:config:group', map.group) }}
|
||||
|
@ -107,10 +67,24 @@ bind_local_config:
|
|||
- watch_in:
|
||||
- service: bind
|
||||
|
||||
{% if grains['os_family'] == 'Debian' %}
|
||||
bind_key_config:
|
||||
file.managed:
|
||||
- name: {{ map.key_config }}
|
||||
- source: 'salt://{{ map.config_source_dir }}/named.conf.key'
|
||||
- template: jinja
|
||||
- user: {{ salt['pillar.get']('bind:config:user', map.user) }}
|
||||
- group: {{ salt['pillar.get']('bind:config:group', map.group) }}
|
||||
- mode: {{ salt['pillar.get']('bind:config:mode', '644') }}
|
||||
- require:
|
||||
- pkg: bind
|
||||
- watch_in:
|
||||
- service: bind
|
||||
|
||||
bind_options_config:
|
||||
file.managed:
|
||||
- name: {{ map.options_config }}
|
||||
- source: 'salt://bind/files/debian/named.conf.options'
|
||||
- source: 'salt://{{ map.config_source_dir }}/named.conf.options'
|
||||
- template: jinja
|
||||
- user: {{ salt['pillar.get']('bind:config:user', map.user) }}
|
||||
- group: {{ salt['pillar.get']('bind:config:group', map.group) }}
|
||||
|
@ -123,7 +97,7 @@ bind_options_config:
|
|||
bind_default_zones:
|
||||
file.managed:
|
||||
- name: {{ map.default_zones_config }}
|
||||
- source: 'salt://bind/files/debian/named.conf.default-zones'
|
||||
- source: 'salt://{{ map.config_source_dir }}/named.conf.default-zones'
|
||||
- template: jinja
|
||||
- user: {{ salt['pillar.get']('bind:config:user', map.user) }}
|
||||
- group: {{ salt['pillar.get']('bind:config:group', map.group) }}
|
||||
|
@ -135,14 +109,12 @@ bind_default_zones:
|
|||
|
||||
/etc/logrotate.d/{{ map.service }}:
|
||||
file.managed:
|
||||
- source: salt://bind/files/debian/logrotate_bind
|
||||
- source: salt://{{ map.config_source_dir }}/logrotate_bind
|
||||
- template: jinja
|
||||
- user: root
|
||||
- group: root
|
||||
- template: jinja
|
||||
- context:
|
||||
map: {{ map }}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% for key, args in salt['pillar.get']('bind:configured_zones', {}).iteritems() -%}
|
||||
|
@ -158,7 +130,7 @@ zones-{{ file }}:
|
|||
- watch_in:
|
||||
- service: bind
|
||||
- require:
|
||||
- file: {{ map.named_directory }}
|
||||
- file: named_directory
|
||||
|
||||
{% if args['dnssec'] is defined and args['dnssec'] -%}
|
||||
signed-{{ file }}:
|
||||
|
@ -186,7 +158,7 @@ zones-{{ file }}:
|
|||
- watch_in:
|
||||
- service: bind
|
||||
- require:
|
||||
- file: {{ map.named_directory }}
|
||||
- file: named_directory
|
||||
|
||||
{% if args['dnssec'] is defined and args['dnssec'] -%}
|
||||
signed-{{ file }}:
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
//
|
||||
// If you are just adding zones, please do that in /etc/bind/named.conf.local
|
||||
|
||||
include "/etc/bind/named.conf.key";
|
||||
include "/etc/bind/named.conf.options";
|
||||
include "/etc/bind/named.conf.local";
|
||||
include "{{ map.options_config }}";
|
||||
include "{{ map.local_config }}";
|
||||
{%- if salt['pillar.get']('bind:keys', {}) is defined %}
|
||||
include "{{ map.key_config }}";
|
||||
{% endif %}
|
||||
|
|
|
@ -38,8 +38,8 @@ zone "{{ key }}" {
|
|||
};
|
||||
{%- endmacro %}
|
||||
|
||||
{%- if not pillar.bind.configured_views is defined %}
|
||||
include "/etc/bind/named.conf.default-zones";
|
||||
{%- if salt['pillar.get']('bind:configured_views', {}) is not defined %}
|
||||
include "{{ map.default_zones_config }}";
|
||||
{%- endif %}
|
||||
|
||||
{% for key, args in salt['pillar.get']('bind:configured_zones', {}).iteritems() -%}
|
||||
|
@ -52,7 +52,7 @@ include "/etc/bind/named.conf.default-zones";
|
|||
|
||||
view {{ view }} {
|
||||
{%- if view == 'default' %}
|
||||
include "/etc/bind/named.conf.default-zones";
|
||||
include "{{ map.default_zones_config }}";
|
||||
{%- endif %}
|
||||
|
||||
match-clients {
|
||||
|
@ -70,6 +70,9 @@ match-clients{
|
|||
{%- endfor %}
|
||||
|
||||
logging {
|
||||
channel "querylog" { file "{{ map.log_dir }}/query.log"; print-time yes; };
|
||||
channel "querylog" {
|
||||
file "{{ map.log_dir }}/query.log";
|
||||
print-time yes;
|
||||
};
|
||||
category queries { querylog; };
|
||||
};
|
||||
|
|
|
@ -15,12 +15,21 @@ options {
|
|||
// };
|
||||
|
||||
auth-nxdomain no; # conform to RFC1035
|
||||
{% if salt['pillar.get']('bind:config:ipv6', 'False') %}
|
||||
listen-on-v6 { {{ salt['pillar.get']('bind:config:ipv6_listen', 'any') }}; };
|
||||
{% endif -%}
|
||||
|
||||
{# Allow inclusion of arbitrary statements -#}
|
||||
{% for statement, value in salt['pillar.get']('bind:config:options', {}).iteritems() -%}
|
||||
{{ statement }} {{ value}}
|
||||
{% endfor -%}
|
||||
{%- if salt['pillar.get']('bind:config:ipv6', False) %}
|
||||
listen-on-v6 { {{ salt['pillar.get']('bind:config:ipv6_listen', 'any') }}; };
|
||||
{%- endif -%}
|
||||
|
||||
{#- Allow inclusion of arbitrary statements #}
|
||||
{%- for statement, value in salt['pillar.get']('bind:config:options', {}).iteritems() -%}
|
||||
{%- if value is iterable and value is not string %}
|
||||
{{ statement }} {
|
||||
{%- for item in value %}
|
||||
{{ item }};
|
||||
{%- endfor %}
|
||||
};
|
||||
{%- else %}
|
||||
{{ statement }} {{ value }};
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
};
|
||||
|
|
|
@ -41,5 +41,5 @@ zone "." IN {
|
|||
};
|
||||
|
||||
include "/etc/named.rfc1912.zones";
|
||||
include "/etc/named.conf.local";
|
||||
include "{{ map.local_config }}";
|
||||
include "/etc/named.root.key";
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
'Debian': {
|
||||
'pkgs': ['bind9', 'bind9utils', 'dnssec-tools'],
|
||||
'service': 'bind9',
|
||||
'config_source_dir': 'bind/files/debian',
|
||||
'config': '/etc/bind/named.conf',
|
||||
'local_config': '/etc/bind/named.conf.local',
|
||||
'key_config': '/etc/bind/named.conf.key',
|
||||
|
@ -10,17 +11,20 @@
|
|||
'named_directory': '/var/cache/bind/zones',
|
||||
'log_dir': '/var/log/bind9',
|
||||
'user': 'root',
|
||||
'group': 'bind'
|
||||
'group': 'bind',
|
||||
'mode': '644'
|
||||
},
|
||||
'RedHat': {
|
||||
'pkgs': ['bind'],
|
||||
'service': 'named',
|
||||
'config_source_dir': 'bind/files/redhat',
|
||||
'config': '/etc/named.conf',
|
||||
'local_config': '/etc/named.conf.local',
|
||||
'named_directory': '/var/named/data',
|
||||
'log_dir': '/var/log/named',
|
||||
'user': 'root',
|
||||
'group': 'named'
|
||||
'group': 'named',
|
||||
'mode': '640'
|
||||
},
|
||||
}, merge=salt['grains.filter_by']({
|
||||
'Ubuntu': {
|
||||
|
|
Loading…
Add table
Reference in a new issue