mirror of
https://github.com/saltstack-formulas/bind-formula.git
synced 2025-04-17 02:00:23 +00:00
Merge pull request #71 from jdsieci/redhat_config_update
Redhat config update
This commit is contained in:
commit
bc3db8644c
5 changed files with 129 additions and 32 deletions
|
@ -20,6 +20,7 @@ bind_restart:
|
||||||
|
|
||||||
{{ map.log_dir }}/query.log:
|
{{ map.log_dir }}/query.log:
|
||||||
file.managed:
|
file.managed:
|
||||||
|
- replace: False
|
||||||
- user: {{ salt['pillar.get']('bind:config:user', map.user) }}
|
- user: {{ salt['pillar.get']('bind:config:user', map.user) }}
|
||||||
- group: {{ salt['pillar.get']('bind:config:group', map.group) }}
|
- group: {{ salt['pillar.get']('bind:config:group', map.group) }}
|
||||||
- mode: {{ salt['pillar.get']('bind:config:log_mode', map.log_mode) }}
|
- mode: {{ salt['pillar.get']('bind:config:log_mode', map.log_mode) }}
|
||||||
|
@ -132,7 +133,7 @@ bind_default_zones:
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% for zone, zone_data in salt['pillar.get']('bind:configured_zones', {}).items() -%}
|
{% for zone, zone_data in salt['pillar.get']('bind:configured_zones', {}).items() -%}
|
||||||
{%- set file = salt['pillar.get']("bind:available_zones:" + zone + ":file") %}
|
{%- set file = salt['pillar.get']("bind:available_zones:" + zone + ":file", zone_data.get('file')) %}
|
||||||
{% if file and zone_data['type'] == "master" -%}
|
{% if file and zone_data['type'] == "master" -%}
|
||||||
zones-{{ zone }}:
|
zones-{{ zone }}:
|
||||||
file.managed:
|
file.managed:
|
||||||
|
@ -161,7 +162,7 @@ signed-{{ zone }}:
|
||||||
|
|
||||||
{%- for view, view_data in salt['pillar.get']('bind:configured_views', {}).items() %}
|
{%- for view, view_data in salt['pillar.get']('bind:configured_views', {}).items() %}
|
||||||
{% for zone, zone_data in view_data.get('configured_zones', {}).items() -%}
|
{% for zone, zone_data in view_data.get('configured_zones', {}).items() -%}
|
||||||
{%- set file = salt['pillar.get']("bind:available_zones:" + zone + ":file") %}
|
{%- set file = salt['pillar.get']("bind:available_zones:" + zone + ":file", zone_data.get('file')) %}
|
||||||
{% if file and zone_data['type'] == "master" -%}
|
{% if file and zone_data['type'] == "master" -%}
|
||||||
zones-{{ view }}-{{ zone }}:
|
zones-{{ view }}-{{ zone }}:
|
||||||
file.managed:
|
file.managed:
|
||||||
|
|
|
@ -8,19 +8,23 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
options {
|
options {
|
||||||
//listen-on port 53 { 127.0.0.1; };
|
|
||||||
listen-on port 53 { any; };
|
|
||||||
listen-on-v6 port 53 { ::1; };
|
|
||||||
directory "/var/named";
|
directory "/var/named";
|
||||||
dump-file "/var/named/data/cache_dump.db";
|
dump-file "/var/named/data/cache_dump.db";
|
||||||
statistics-file "/var/named/data/named_stats.txt";
|
statistics-file "/var/named/data/named_stats.txt";
|
||||||
memstatistics-file "/var/named/data/named_mem_stats.txt";
|
memstatistics-file "/var/named/data/named_mem_stats.txt";
|
||||||
allow-query { any; };
|
|
||||||
recursion yes;
|
|
||||||
|
|
||||||
dnssec-enable yes;
|
{#- Allow inclusion of arbitrary statements #}
|
||||||
dnssec-validation yes;
|
{%- for statement, value in salt['pillar.get']('bind:config:options', map.get('options', {})).items() -%}
|
||||||
dnssec-lookaside auto;
|
{%- if value is iterable and value is not string %}
|
||||||
|
{{ statement }} {
|
||||||
|
{%- for item in value %}
|
||||||
|
{{ item }};
|
||||||
|
{%- endfor %}
|
||||||
|
};
|
||||||
|
{%- else %}
|
||||||
|
{{ statement }} {{ value }};
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
|
||||||
/* Path to ISC DLV key */
|
/* Path to ISC DLV key */
|
||||||
bindkeys-file "/etc/named.iscdlv.key";
|
bindkeys-file "/etc/named.iscdlv.key";
|
||||||
|
@ -33,6 +37,39 @@ logging {
|
||||||
file "data/named.run";
|
file "data/named.run";
|
||||||
severity dynamic;
|
severity dynamic;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
{%- for channel, value in salt['pillar.get']('bind:config:logging:channels', {}).items() -%}
|
||||||
|
{%- if value is iterable %}
|
||||||
|
channel {{ channel }} {
|
||||||
|
{%- for statement, item in value.items() %}
|
||||||
|
{{ statement }} {{ item }};
|
||||||
|
{%- endfor %}
|
||||||
|
};
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
|
||||||
|
{%- for statement, value in salt['pillar.get']('bind:config:logging:category', {}).items() %}
|
||||||
|
category {{ statement }} {
|
||||||
|
{%- for item in value %}
|
||||||
|
{{ item }};
|
||||||
|
{%- endfor %}
|
||||||
|
};
|
||||||
|
{%- endfor %}
|
||||||
|
|
||||||
|
{%- for statement, value in salt['pillar.get']('bind:config:logging', {}).items() -%}
|
||||||
|
{%- if statement not in ( 'channels', 'category' ) %}
|
||||||
|
{%- if value is iterable and value is not string %}
|
||||||
|
{{ statement }} {
|
||||||
|
{%- for item in value %}
|
||||||
|
{{ item }};
|
||||||
|
{%- endfor %}
|
||||||
|
};
|
||||||
|
{%- else %}
|
||||||
|
{{ statement }} {{ value }};
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
zone "." IN {
|
zone "." IN {
|
||||||
|
|
|
@ -6,35 +6,77 @@
|
||||||
// organization
|
// organization
|
||||||
//include "/etc/bind/zones.rfc1918";
|
//include "/etc/bind/zones.rfc1918";
|
||||||
|
|
||||||
{% for key,args in salt['pillar.get']('bind:configured_zones', {}).items() -%}
|
{%- macro zone(key, args, file, masters) %}
|
||||||
{%- set file = salt['pillar.get']("bind:available_zones:" + key + ":file") %}
|
zone "{{ key }}" IN {
|
||||||
{%- set masters = salt['pillar.get']("bind:available_zones:" + key + ":masters") %}
|
type {{ args['type'] }};
|
||||||
zone "{{ key }}" {
|
|
||||||
type {{ args['type'] }};
|
|
||||||
{% if args['type'] == 'forward' -%}
|
{% if args['type'] == 'forward' -%}
|
||||||
{% if args['forward'] is defined -%}
|
{% if args['forward'] is defined -%}
|
||||||
forward {{ args['forward'] }};
|
forward {{ args['forward'] }};
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
forwarders {
|
forwarders {
|
||||||
{% for forwarder in args.forwarders -%}
|
{% for forwarder in args.forwarders -%}
|
||||||
{{ forwarder }};
|
{{ forwarder }};
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
};
|
};
|
||||||
{% else -%}
|
{% else -%}
|
||||||
file "data/{{ file }}";
|
{% if args['dnssec'] is defined and args['dnssec'] -%}
|
||||||
{%- if args['also-notify'] is defined %}
|
file "{{ file }}.signed";
|
||||||
also-notify { {{ args.get('also-notify', []) | join('; ') }}; };
|
|
||||||
{%- endif %}
|
|
||||||
{% if args['type'] == "master" -%}
|
|
||||||
{% if args['notify'] -%}
|
|
||||||
notify yes;
|
|
||||||
{% else -%}
|
|
||||||
notify no;
|
|
||||||
{%- endif -%}
|
|
||||||
{% else -%}
|
{% else -%}
|
||||||
notify no;
|
file "{{ file }}";
|
||||||
masters { {{ masters }} };
|
{%- endif %}
|
||||||
|
{%- if args['allow-update'] is defined %}
|
||||||
|
allow-update { {{args['allow-update']}}; };
|
||||||
|
{%- endif %}
|
||||||
|
{%- if args.update_policy is defined %}
|
||||||
|
update-policy {
|
||||||
|
{%- for policy in args.update_policy %}
|
||||||
|
{{ policy }};
|
||||||
|
{%- endfor %}
|
||||||
|
};
|
||||||
|
{%- endif %}
|
||||||
|
{%- if args['allow-transfer'] is defined %}
|
||||||
|
allow-transfer { {{ args.get('allow-transfer', []) | join('; ') }}; };
|
||||||
|
{%- endif %}
|
||||||
|
{%- if args['also-notify'] is defined %}
|
||||||
|
also-notify { {{ args.get('also-notify', []) | join('; ') }}; };
|
||||||
|
{%- endif %}
|
||||||
|
{%- if args['type'] == 'slave' %}
|
||||||
|
{%- if args['allow-notify'] is defined %}
|
||||||
|
allow-notify { {{ args.get('allow-notify', []) | join('; ') }}; };
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if args['type'] == "master" -%}
|
||||||
|
{% if args['notify'] %}
|
||||||
|
notify yes;
|
||||||
|
{% else %}
|
||||||
|
notify no;
|
||||||
|
{%- endif -%}
|
||||||
|
{% else %}
|
||||||
|
notify no;
|
||||||
|
{%- if masters is iterable and masters is not string %}
|
||||||
|
masters {
|
||||||
|
{%- for item in masters %}
|
||||||
|
{{ item }};
|
||||||
|
{%- endfor %}
|
||||||
|
};
|
||||||
|
{%- else %}
|
||||||
|
masters { {{ masters }} };
|
||||||
|
{%- endif %}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
};
|
};
|
||||||
|
{%- endmacro %}
|
||||||
|
|
||||||
|
{% for key, args in salt['pillar.get']('bind:configured_zones', {}).items() -%}
|
||||||
|
{%- set file = args.get('file', salt['pillar.get']("bind:available_zones:" + key + ":file")) %}
|
||||||
|
{%- set masters = args.get('masters', salt['pillar.get']("bind:available_zones:" + key + ":masters")) %}
|
||||||
|
{{ zone(key, args, file, masters) }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
{%- for name, data in salt['pillar.get']('bind:configured_acls', {}).items() %}
|
||||||
|
acl {{ name }} {
|
||||||
|
{%- for d in data %}
|
||||||
|
{{ d }};
|
||||||
|
{%- endfor %}
|
||||||
|
};
|
||||||
|
{%- endfor %}
|
||||||
|
|
|
@ -25,12 +25,20 @@
|
||||||
'config': '/etc/named.conf',
|
'config': '/etc/named.conf',
|
||||||
'local_config': '/etc/named.conf.local',
|
'local_config': '/etc/named.conf.local',
|
||||||
'default_config': '/etc/sysconfig/named',
|
'default_config': '/etc/sysconfig/named',
|
||||||
'named_directory': '/var/named/data',
|
'named_directory': '/var/named',
|
||||||
'log_dir': '/var/log/named',
|
'log_dir': '/var/log/named',
|
||||||
'log_mode': '640',
|
'log_mode': '640',
|
||||||
'user': 'root',
|
'user': 'root',
|
||||||
'group': 'named',
|
'group': 'named',
|
||||||
'mode': '640'
|
'mode': '640',
|
||||||
|
'options': {
|
||||||
|
'listen-on': 'port 53 { 127.0.0.1; }',
|
||||||
|
'listen-on-v6': 'port 53 { ::1; }',
|
||||||
|
'allow-query': '{ localhost; }',
|
||||||
|
'recursion': 'yes',
|
||||||
|
'dnssec-enable': 'yes',
|
||||||
|
'dnssec-validation': 'yes'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
'Arch': {
|
'Arch': {
|
||||||
'pkgs': ['bind', 'bind-tools', 'dnssec-tools'],
|
'pkgs': ['bind', 'bind-tools', 'dnssec-tools'],
|
||||||
|
|
|
@ -24,6 +24,14 @@ bind:
|
||||||
mode: 640 # File & Directory mode
|
mode: 640 # File & Directory mode
|
||||||
options:
|
options:
|
||||||
allow-recursion: '{ any; }' # Never include this on a public resolver
|
allow-recursion: '{ any; }' # Never include this on a public resolver
|
||||||
|
# RedHat defaults, needed to generate default config file
|
||||||
|
listen-on: 'port 53 { 127.0.0.1; }'
|
||||||
|
listen-on-v6: 'port 53 { ::1; }'
|
||||||
|
allow-query: '{ localhost; }'
|
||||||
|
recursion: 'yes'
|
||||||
|
dnssec-enable: 'yes'
|
||||||
|
dnssec-validation: 'yes'
|
||||||
|
# End RedHat defaults
|
||||||
|
|
||||||
protocol: 4 # Force bind to serve only one IP protocol
|
protocol: 4 # Force bind to serve only one IP protocol
|
||||||
# (ipv4: 4, ipv6: 6). Omitting this reverts to
|
# (ipv4: 4, ipv6: 6). Omitting this reverts to
|
||||||
|
@ -38,6 +46,7 @@ bind:
|
||||||
|
|
||||||
# End Debian based systems
|
# End Debian based systems
|
||||||
|
|
||||||
|
|
||||||
### Keys, Zones, ACLs and Views ###
|
### Keys, Zones, ACLs and Views ###
|
||||||
bind:
|
bind:
|
||||||
keys:
|
keys:
|
||||||
|
|
Loading…
Add table
Reference in a new issue