Grid環境構築用のChefリポジトリです。
リビジョン | 68448aee1ab043003104ede8f93ff35e8d8338a6 (tree) |
---|---|
日時 | 2017-01-15 12:57:02 |
作者 | whitestar <whitestar@gaea...> |
コミッター | whitestar |
bind-grid initial release.
@@ -0,0 +1 @@ | ||
1 | +~FC001 |
@@ -0,0 +1,37 @@ | ||
1 | +AllCops: | |
2 | + Exclude: | |
3 | + - vendor/**/* | |
4 | + | |
5 | +AlignParameters: | |
6 | + Enabled: false | |
7 | +LineLength: | |
8 | + Enabled: false | |
9 | +Lint/UnusedBlockArgument: | |
10 | + Enabled: false | |
11 | +Metrics/AbcSize: | |
12 | + Enabled: false | |
13 | +Style/BlockComments: | |
14 | + Enabled: false | |
15 | +Style/BlockDelimiters: | |
16 | + Enabled: false | |
17 | +Style/ExtraSpacing: | |
18 | + Enabled: false | |
19 | +Style/FileName: | |
20 | + Enabled: false | |
21 | +Style/LeadingCommentSpace: | |
22 | + Enabled: false | |
23 | +Style/RescueModifier: | |
24 | + Enabled: false | |
25 | +Style/SpaceBeforeFirstArg: | |
26 | + Enabled: false | |
27 | +Style/TrailingCommaInLiteral: | |
28 | + EnforcedStyleForMultiline: comma | |
29 | +Style/WordArray: | |
30 | + Enabled: false | |
31 | + | |
32 | +#Style/AccessorMethodName: | |
33 | +# Enabled: false | |
34 | +#Style/MethodLength: | |
35 | +# Max: 30 | |
36 | +#Style/ModuleLength: | |
37 | +# Max: 150 |
@@ -0,0 +1,23 @@ | ||
1 | +# | |
2 | +# Copyright 2017 whitestar | |
3 | +# | |
4 | +# Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | +# you may not use this file except in compliance with the License. | |
6 | +# You may obtain a copy of the License at | |
7 | +# | |
8 | +# http://www.apache.org/licenses/LICENSE-2.0 | |
9 | +# | |
10 | +# Unless required by applicable law or agreed to in writing, software | |
11 | +# distributed under the License is distributed on an "AS IS" BASIS, | |
12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | +# See the License for the specific language governing permissions and | |
14 | +# limitations under the License. | |
15 | +# | |
16 | + | |
17 | +#grid_chef_repo = 'git://git.osdn.jp/gitroot/metasearch/grid-chef-repo.git' | |
18 | + | |
19 | +# for ver. 3.x | |
20 | +#source 'https://berks-api.io.example.com:6280' | |
21 | +source 'https://supermarket.chef.io' | |
22 | + | |
23 | +metadata |
@@ -0,0 +1,5 @@ | ||
1 | +# bind-grid CHANGELOG | |
2 | + | |
3 | +0.1.0 | |
4 | +----- | |
5 | +- Initial release of bind-grid |
@@ -0,0 +1,194 @@ | ||
1 | +bind-grid Cookbook | |
2 | +================== | |
3 | + | |
4 | +This cookbook sets up BIND server. | |
5 | + | |
6 | +## Contents | |
7 | + | |
8 | +- [Requirements](#requirements) | |
9 | + - [Platforms](#platforms) | |
10 | + - [Cookbooks](#cookbooks) | |
11 | +- [Attributes](#attributes) | |
12 | +- [Usage](#usage) | |
13 | + - [Recipes](#recipes) | |
14 | + - [bind-grid::default](#bind-griddefault) | |
15 | + - [bind-grid::bind](#bind-gridbind) | |
16 | + - [Add your customized zone files by wrapper cookbook](#add-your-customized-zone-files-by-wrapper-cookbook) | |
17 | + - [Role Examples](#role-examples) | |
18 | +- [License and Authors](#license-and-authors) | |
19 | + | |
20 | +## Requirements | |
21 | + | |
22 | +### Platforms | |
23 | + | |
24 | +- Debian, Ubuntu | |
25 | + | |
26 | +### Cookbooks | |
27 | + | |
28 | +- None. | |
29 | + | |
30 | +## Attributes | |
31 | + | |
32 | +|Key|Type|Description, example|Default| | |
33 | +|:--|:--|:--|:--| | |
34 | +|`['bind-grid']['role']`|String|`'master'` or `'slave'`|`'master'`| | |
35 | +|`['bind-grid']['acl']`|Hash|acl statements.|See `attribute/default.rb`| | |
36 | +|`['bind-grid']['acl']['internal']`|Array|Predefined `internal` acl.|`['127.0.0.1']`| | |
37 | +|`['bind-grid']['extra_statements']`|String|Your arbitrary statements string.|`''`| | |
38 | +|`['bind-grid']['options']['directory']`|String||`'/var/cache/bind'`| | |
39 | +|`['bind-grid']['options']['listen-on']`|String|IP v4 listen configurarions|`''`| | |
40 | +|`['bind-grid']['options']['listen-on']['port']`|String||`'53'`| | |
41 | +|`['bind-grid']['options']['listen-on']['ipaddresses']`|Array||`[]` (= `['127.0.0.1', node['ipaddress']]`)| | |
42 | +|`['bind-grid']['options']['listen-on-v6']`|String|IP v6 listen configurarions|`''`| | |
43 | +|`['bind-grid']['options']['listen-on-v6']['port']`|String||`'53'`| | |
44 | +|`['bind-grid']['options']['listen-on-v6']['ipaddresses']`|Array|`'any'` or `'none'`|`[]` (= `'none'`)| | |
45 | +|`['bind-grid']['options']['auth-nxdomain']`|String||`'no'`| | |
46 | +|`['bind-grid']['options']['allow-query']`|Array||`['internal']`| | |
47 | +|`['bind-grid']['options']['recursion']`|String||`'yes'`| | |
48 | +|`['bind-grid']['options']['allow-recursion']`|Array||`['internal']`| | |
49 | +|`['bind-grid']['options']['allow-transfer']`|Array||`[]`| | |
50 | +|`['bind-grid']['options']['forwarders']`|Array||`[]`| | |
51 | +|`['bind-grid']['options']['extra_statements']`|String|Your arbitrary options statements string.|`''`| | |
52 | +|`['bind-grid']['zone']['files']`|Array|e.g. `['db.192.168.1', 'db.example.com']`|`[]`| | |
53 | +|`['bind-grid']['zone'] ...`|Hash|Optional: Zone file's common settings.|| | |
54 | +|`['bind-grid']['zone']['SOA']['MNAME']`|String|e.g. `dns.example.com`|`''`| | |
55 | +|`['bind-grid']['zone']['SOA']['RNAME']`|String|e.g. `root.example.com`|`''`| | |
56 | +|`['bind-grid']['zone']['NS']`|Array|e.g. `['dns.example.com']`|`[]`| | |
57 | +|`['bind-grid']['zone']['masters']`|String|e.g. `['192.168.1.53']`|`''`| | |
58 | +|`['bind-grid']['zone']['allow-transfer']`|String|e.g. `['192.168.1.54']`|`''`| | |
59 | + | |
60 | +## Usage | |
61 | + | |
62 | +### Recipes | |
63 | + | |
64 | +#### bind-grid::default | |
65 | + | |
66 | +This recipe is the same as `bind-grid::bind`. | |
67 | + | |
68 | +#### bind-grid::bind | |
69 | + | |
70 | +This recipe sets up BIND server. | |
71 | + | |
72 | +### Add your customized zone files by wrapper cookbook | |
73 | + | |
74 | +- Create a wrapper cookbook (e.g. `bind-wrapper`). | |
75 | + | |
76 | +- `metadata.rb`: add the `bind-grid` dependency. | |
77 | + | |
78 | +```ruby | |
79 | +# ... | |
80 | +depends 'bind-grid' | |
81 | +``` | |
82 | + | |
83 | +- Add your zone file templates to the directory `templates/default/var/cache/bind` | |
84 | + | |
85 | +- `attributes/default.rb`: add the zone file list to the `['bind-grid']['zone']['files']` attribute. | |
86 | + | |
87 | +```ruby | |
88 | +default['bind-grid']['zone'] = { | |
89 | + 'files' => [ | |
90 | + 'db.192.168.1', | |
91 | + 'db.example.com', | |
92 | + ], | |
93 | + # options | |
94 | + 'SOA' => { | |
95 | + 'MNAME' => 'dns.example.com', | |
96 | + 'RNAME' => 'root.example.com', | |
97 | + }, | |
98 | + 'NS' => [ | |
99 | + 'dns.example.com', | |
100 | + ], | |
101 | + 'masters' => [ | |
102 | + '192.168.1.53', | |
103 | + ], | |
104 | + 'allow-transfer' => [ | |
105 | + '192.168.1.54', | |
106 | + ], | |
107 | +} | |
108 | +``` | |
109 | + | |
110 | +- `recipes/bind.rb`: override the `bind` recipe. | |
111 | + | |
112 | +```ruby | |
113 | +base_cookbook = 'bind-grid' | |
114 | +this_cookbook = 'bind-wrapper' | |
115 | + | |
116 | +node.from_file(run_context.resolve_attribute(base_cookbook, 'default')) | |
117 | +include_recipe "#{base_cookbook}::bind" | |
118 | + | |
119 | +if node['bind-grid']['role'] == 'master' | |
120 | + zone_dir = node['bind-grid']['options']['directory'] | |
121 | + | |
122 | + # override zone files. | |
123 | + node['bind-grid']['zone']['files'].each {|db_file| | |
124 | + res = resources(template: "#{zone_dir}/#{db_file}") | |
125 | + res.cookbook this_cookbook | |
126 | + } | |
127 | +end | |
128 | +``` | |
129 | + | |
130 | +### Role Examples | |
131 | + | |
132 | +- `roles/bind.rb` | |
133 | + | |
134 | +```ruby | |
135 | +name 'bind' | |
136 | +description 'BIND server' | |
137 | + | |
138 | +run_list( | |
139 | + 'recipe[bind-wrapper::bind]', | |
140 | +) | |
141 | + | |
142 | +override_attributes( | |
143 | + 'bind-grid' => { | |
144 | + 'role' => 'master', # or 'slave' | |
145 | + 'acl' => { | |
146 | + 'internal' => [ | |
147 | + '127.0.0.1', | |
148 | + '192.168.1.0/24', | |
149 | + ], | |
150 | + }, | |
151 | + 'options' => { | |
152 | + 'forwarders' => [ | |
153 | + '8.8.8.8', | |
154 | + '8.8.4.4', | |
155 | + ], | |
156 | + }, | |
157 | + 'zone' => { | |
158 | + 'SOA' => { | |
159 | + 'MNAME' => 'dns.example.com', | |
160 | + 'RNAME' => 'root.example.com', | |
161 | + }, | |
162 | + 'NS' => [ | |
163 | + 'dns.example.com', | |
164 | + ], | |
165 | + 'masters' => [ | |
166 | + '192.168.1.53', | |
167 | + ], | |
168 | + 'allow-transfer' => [ | |
169 | + '192.168.1.54', | |
170 | + ], | |
171 | + }, | |
172 | + }, | |
173 | +) | |
174 | +``` | |
175 | + | |
176 | +## License and Authors | |
177 | + | |
178 | +- Author:: whitestar at osdn.jp | |
179 | + | |
180 | +```text | |
181 | +Copyright 2017, whitestar | |
182 | + | |
183 | +Licensed under the Apache License, Version 2.0 (the "License"); | |
184 | +you may not use this file except in compliance with the License. | |
185 | +You may obtain a copy of the License at | |
186 | + | |
187 | + http://www.apache.org/licenses/LICENSE-2.0 | |
188 | + | |
189 | +Unless required by applicable law or agreed to in writing, software | |
190 | +distributed under the License is distributed on an "AS IS" BASIS, | |
191 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
192 | +See the License for the specific language governing permissions and | |
193 | +limitations under the License. | |
194 | +``` |
@@ -0,0 +1,23 @@ | ||
1 | +require 'rspec/core/rake_task' | |
2 | +require 'rubocop/rake_task' | |
3 | +require 'foodcritic' | |
4 | + | |
5 | +namespace :style do | |
6 | + desc 'Run Ruby style checks' | |
7 | + RuboCop::RakeTask.new(:ruby) | |
8 | + | |
9 | + desc 'Run Chef style checks' | |
10 | + FoodCritic::Rake::LintTask.new(:chef) do |t| | |
11 | + t.options = { | |
12 | + fail_tags: ['any'], | |
13 | + } | |
14 | + end | |
15 | +end | |
16 | + | |
17 | +desc 'Run all style checks' | |
18 | +task style: ['style:chef', 'style:ruby'] | |
19 | + | |
20 | +desc 'Run ChefSpec examples' | |
21 | +RSpec::Core::RakeTask.new(:spec) | |
22 | + | |
23 | +task default: ['style', 'spec'] |
@@ -0,0 +1,71 @@ | ||
1 | +# | |
2 | +# Cookbook Name:: bind-grid | |
3 | +# Attributes:: default | |
4 | +# | |
5 | +# Copyright 2017, whitestar | |
6 | +# | |
7 | +# Licensed under the Apache License, Version 2.0 (the "License"); | |
8 | +# you may not use this file except in compliance with the License. | |
9 | +# You may obtain a copy of the License at | |
10 | +# | |
11 | +# http://www.apache.org/licenses/LICENSE-2.0 | |
12 | +# | |
13 | +# Unless required by applicable law or agreed to in writing, software | |
14 | +# distributed under the License is distributed on an "AS IS" BASIS, | |
15 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
16 | +# See the License for the specific language governing permissions and | |
17 | +# limitations under the License. | |
18 | +# | |
19 | + | |
20 | +default['bind-grid']['role'] = 'master' # or 'slave' | |
21 | +default['bind-grid']['acl'] = { | |
22 | + 'internal' => [ | |
23 | + '127.0.0.1', | |
24 | + ], | |
25 | +} | |
26 | +default['bind-grid']['extra_statements'] = '' | |
27 | +default['bind-grid']['options'] = { | |
28 | + 'directory' => '/var/cache/bind', | |
29 | + 'listen-on' => { | |
30 | + 'port' => '53', | |
31 | + 'ipaddresses' => [], | |
32 | + }, | |
33 | + 'listen-on-v6' => { | |
34 | + 'port' => '53', | |
35 | + 'ipaddresses' => [], # 'any' or 'none' (default) | |
36 | + }, | |
37 | + 'auth-nxdomain' => 'no', | |
38 | + 'allow-query' => [ | |
39 | + 'internal', | |
40 | + ], | |
41 | + 'recursion' => 'yes', | |
42 | + 'allow-recursion' => [ | |
43 | + 'internal', | |
44 | + ], | |
45 | + 'allow-transfer' => [], | |
46 | + 'forwarders' => [ | |
47 | + #'8.8.8.8', | |
48 | + #'8.8.4.4', | |
49 | + ], | |
50 | + 'extra_statements' => '', | |
51 | +} | |
52 | +# Option attributes for zone file templates added in wrapper cookbook. | |
53 | +default['bind-grid']['zone'] = { | |
54 | + 'files' => [ | |
55 | + #'db.192.168.1', | |
56 | + #'db.example.com', | |
57 | + ], | |
58 | + 'SOA' => { | |
59 | + 'MNAME' => '', # 'dns.example.com' | |
60 | + 'RNAME' => '', # 'root.example.com' | |
61 | + }, | |
62 | + 'NS' => [ | |
63 | + #'', # 'dns.example.com' | |
64 | + ], | |
65 | + 'masters' => [ | |
66 | + #'192.168.1.53', | |
67 | + ], | |
68 | + 'allow-transfer' => [ | |
69 | + #'192.168.1.54', | |
70 | + ], | |
71 | +} |
@@ -0,0 +1,14 @@ | ||
1 | +# $ knife supermarket share bind-grid "Databases" | |
2 | +name 'bind-grid' | |
3 | +maintainer 'whitestar' | |
4 | +maintainer_email '' | |
5 | +license 'Apache 2.0' | |
6 | +description 'Installs/Configures BIND' | |
7 | +long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) | |
8 | +version '0.1.0' | |
9 | +source_url 'http://scm.osdn.jp/gitroot/metasearch/grid-chef-repo.git' | |
10 | +issues_url 'https://osdn.jp/projects/metasearch/ticket' | |
11 | + | |
12 | +%w( debian ubuntu ).each do |os| | |
13 | + supports os | |
14 | +end |
@@ -0,0 +1,62 @@ | ||
1 | +# | |
2 | +# Cookbook Name:: bind-grid | |
3 | +# Recipe:: bind | |
4 | +# | |
5 | +# Copyright 2017, whitestar | |
6 | +# | |
7 | +# Licensed under the Apache License, Version 2.0 (the "License"); | |
8 | +# you may not use this file except in compliance with the License. | |
9 | +# You may obtain a copy of the License at | |
10 | +# | |
11 | +# http://www.apache.org/licenses/LICENSE-2.0 | |
12 | +# | |
13 | +# Unless required by applicable law or agreed to in writing, software | |
14 | +# distributed under the License is distributed on an "AS IS" BASIS, | |
15 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
16 | +# See the License for the specific language governing permissions and | |
17 | +# limitations under the License. | |
18 | +# | |
19 | + | |
20 | +package 'bind9' do | |
21 | + action :install | |
22 | +end | |
23 | + | |
24 | +service 'bind9' do | |
25 | + action [:enable, :start] | |
26 | + supports status: true, restart: true, reload: true | |
27 | +end | |
28 | + | |
29 | +conf_files = [ | |
30 | + 'named.conf.local', | |
31 | + 'named.conf.options', | |
32 | +] | |
33 | + | |
34 | +conf_files.each {|conf_file| | |
35 | + template "/etc/bind/#{conf_file}" do | |
36 | + source "etc/bind/#{conf_file}" | |
37 | + owner 'root' | |
38 | + group 'bind' | |
39 | + mode '0644' | |
40 | + notifies :reload, 'service[bind9]' | |
41 | + end | |
42 | +} | |
43 | + | |
44 | +zone_dir = node['bind-grid']['options']['directory'] | |
45 | +directory zone_dir do | |
46 | + owner 'root' | |
47 | + group 'bind' | |
48 | + mode '0775' | |
49 | + recursive true | |
50 | +end | |
51 | + | |
52 | +if node['bind-grid']['role'] == 'master' | |
53 | + node['bind-grid']['zone']['files'].each {|db_file| | |
54 | + template "#{zone_dir}/#{db_file}" do | |
55 | + source "var/cache/bind/#{db_file}" | |
56 | + owner 'root' | |
57 | + group 'root' | |
58 | + mode '0644' | |
59 | + notifies :reload, 'service[bind9]' | |
60 | + end | |
61 | + } | |
62 | +end |
@@ -0,0 +1,20 @@ | ||
1 | +# | |
2 | +# Cookbook Name:: bind-grid | |
3 | +# Recipe:: default | |
4 | +# | |
5 | +# Copyright 2017, whitestar | |
6 | +# | |
7 | +# Licensed under the Apache License, Version 2.0 (the "License"); | |
8 | +# you may not use this file except in compliance with the License. | |
9 | +# You may obtain a copy of the License at | |
10 | +# | |
11 | +# http://www.apache.org/licenses/LICENSE-2.0 | |
12 | +# | |
13 | +# Unless required by applicable law or agreed to in writing, software | |
14 | +# distributed under the License is distributed on an "AS IS" BASIS, | |
15 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
16 | +# See the License for the specific language governing permissions and | |
17 | +# limitations under the License. | |
18 | +# | |
19 | + | |
20 | +include_recipe 'bind-grid::bind' |
@@ -0,0 +1,9 @@ | ||
1 | +require_relative '../spec_helper' | |
2 | + | |
3 | +describe 'bind-grid::default' do | |
4 | + let(:chef_run) { ChefSpec::SoloRunner.new.converge(described_recipe) } | |
5 | + | |
6 | + #it 'does something' do | |
7 | + # expect(chef_run).to do_something('...') | |
8 | + #end | |
9 | +end |
@@ -0,0 +1,25 @@ | ||
1 | +# Added by ChefSpec | |
2 | +require 'chefspec' | |
3 | + | |
4 | +# Uncomment to use ChefSpec's Berkshelf extension | |
5 | +# require 'chefspec/berkshelf' | |
6 | + | |
7 | +RSpec.configure do |config| | |
8 | + # Specify the path for Chef Solo to find cookbooks | |
9 | + # config.cookbook_path = '/var/cookbooks' | |
10 | + | |
11 | + # Specify the path for Chef Solo to find roles | |
12 | + # config.role_path = '/var/roles' | |
13 | + | |
14 | + # Specify the Chef log_level (default: :warn) | |
15 | + # config.log_level = :debug | |
16 | + | |
17 | + # Specify the path to a local JSON file with Ohai data | |
18 | + # config.path = 'ohai.json' | |
19 | + | |
20 | + # Specify the operating platform to mock Ohai data from | |
21 | + # config.platform = 'ubuntu' | |
22 | + | |
23 | + # Specify the operating version to mock Ohai data from | |
24 | + # config.version = '12.04' | |
25 | +end |
@@ -0,0 +1,64 @@ | ||
1 | +// This file is generated by Chef | |
2 | +// Do NOT edit it manually. | |
3 | +// | |
4 | +// Do any local configuration here | |
5 | +// | |
6 | + | |
7 | +// Consider adding the 1918 zones here, if they are not used in your | |
8 | +// organization | |
9 | +//include "/etc/bind/zones.rfc1918"; | |
10 | + | |
11 | +<% | |
12 | +role = node['bind-grid']['role'] | |
13 | +masters = node['bind-grid']['zone']['masters'] | |
14 | +allow_transfer = node['bind-grid']['zone']['allow-transfer'] | |
15 | + | |
16 | +node['bind-grid']['zone']['files'].sort.each {|zfile| | |
17 | + zarray = zfile.split('.') | |
18 | + zarray.shift | |
19 | + zname = '' | |
20 | + | |
21 | + if zarray[0] =~ /^\d+$/ | |
22 | + zname = "#{zarray.reverse.join('.')}.in-addr.arpa" | |
23 | + else | |
24 | + zname = zarray.join('.') | |
25 | + end | |
26 | + | |
27 | + case role | |
28 | + when 'master' | |
29 | +-%> | |
30 | +zone "<%= zname %>" { | |
31 | + type master; | |
32 | + file "<%= zfile %>"; | |
33 | + allow-transfer { | |
34 | +<% | |
35 | + allow_transfer.each {|ip| | |
36 | +-%> | |
37 | + <%= ip %>; | |
38 | +<% | |
39 | + } | |
40 | +-%> | |
41 | + }; | |
42 | +}; | |
43 | + | |
44 | +<% | |
45 | + when 'slave' | |
46 | +-%> | |
47 | +zone "<%= zname %>" { | |
48 | + type slave; | |
49 | + masters { | |
50 | +<% | |
51 | + masters.each {|ip| | |
52 | +-%> | |
53 | + <%= ip %>; | |
54 | +<% | |
55 | + } | |
56 | +-%> | |
57 | + }; | |
58 | + file "<%= zfile %>"; | |
59 | +}; | |
60 | + | |
61 | +<% | |
62 | + end | |
63 | +} | |
64 | +-%> |
@@ -0,0 +1,106 @@ | ||
1 | +// This file is generated by Chef | |
2 | +// Do NOT edit it manually. | |
3 | + | |
4 | +<% | |
5 | +acls = node['bind-grid']['acl'] | |
6 | +acls.each {|name, cidrs| | |
7 | +-%> | |
8 | +acl "<%= name %>" { | |
9 | +<% cidrs.each {|cidr| %> | |
10 | + <%= cidr %>; | |
11 | +<% } %> | |
12 | +}; | |
13 | + | |
14 | +<% | |
15 | +} | |
16 | +-%> | |
17 | +<% | |
18 | +extra_statements = node['bind-grid']['extra_statements'] | |
19 | +unless extra_statements.empty? | |
20 | +-%> | |
21 | +<%= extra_statements %> | |
22 | + | |
23 | +<% | |
24 | +end | |
25 | +-%> | |
26 | +options { | |
27 | + directory "<%= node['bind-grid']['options']['directory'] %>"; | |
28 | + | |
29 | + // If there is a firewall between you and nameservers you want | |
30 | + // to talk to, you may need to fix the firewall to allow multiple | |
31 | + // ports to talk. See http://www.kb.cert.org/vuls/id/800113 | |
32 | + | |
33 | + // If your ISP provided one or more IP addresses for stable | |
34 | + // nameservers, you probably want to use them as forwarders. | |
35 | + // Uncomment the following block, and insert the addresses replacing | |
36 | + // the all-0's placeholder. | |
37 | + | |
38 | + // forwarders { | |
39 | + // 0.0.0.0; | |
40 | + // }; | |
41 | + | |
42 | +<% | |
43 | +listen_on_conf = node['bind-grid']['options']['listen-on'] | |
44 | + | |
45 | +ips = listen_on_conf['ipaddresses'] | |
46 | +ips = [node['ipaddress']] if ips.empty? | |
47 | +-%> | |
48 | + listen-on port <%= listen_on_conf['port'] %> { | |
49 | + 127.0.0.1; | |
50 | +<% ips.each {|ip| %> | |
51 | + <%= ip %>; | |
52 | +<% } %> | |
53 | + }; | |
54 | +<% | |
55 | +listen_on_v6_conf = node['bind-grid']['options']['listen-on-v6'] | |
56 | + | |
57 | +ips = listen_on_v6_conf['ipaddresses'] | |
58 | +ips = ['none'] if ips.empty? | |
59 | +-%> | |
60 | + listen-on-v6 port <%= listen_on_conf['port'] %> { | |
61 | +<% ips.each {|ip| %> | |
62 | + <%= ip %>; | |
63 | +<% } %> | |
64 | + }; | |
65 | + | |
66 | + auth-nxdomain <%= node['bind-grid']['options']['auth-nxdomain'] %>; # conform to RFC1035 | |
67 | + //listen-on-v6 { any; }; | |
68 | + | |
69 | + allow-query { | |
70 | +<% node['bind-grid']['options']['allow-query'].each {|id| %> | |
71 | + <%= id %>; | |
72 | +<% } %> | |
73 | + }; | |
74 | + | |
75 | + recursion <%= node['bind-grid']['options']['recursion'] %>; | |
76 | + allow-recursion { | |
77 | +<% node['bind-grid']['options']['allow-recursion'].each {|id| %> | |
78 | + <%= id %>; | |
79 | +<% } %> | |
80 | + }; | |
81 | + | |
82 | + allow-transfer { | |
83 | +<% | |
84 | +allow_transfer = node['bind-grid']['options']['allow-transfer'] | |
85 | +allow_transfer = ['none'] if allow_transfer.empty? | |
86 | +allow_transfer.each {|ip| | |
87 | +-%> | |
88 | + <%= ip %>; | |
89 | +<% } %> | |
90 | + }; | |
91 | + | |
92 | + forwarders { | |
93 | +<% node['bind-grid']['options']['forwarders'].each {|ip| %> | |
94 | + <%= ip %>; | |
95 | +<% } %> | |
96 | + }; | |
97 | +<% | |
98 | +extra_statements = node['bind-grid']['options']['extra_statements'] | |
99 | +unless extra_statements.empty? | |
100 | +-%> | |
101 | +<%= extra_statements %> | |
102 | + | |
103 | +<% | |
104 | +end | |
105 | +-%> | |
106 | +}; |
@@ -0,0 +1,21 @@ | ||
1 | +$TTL 604800 | |
2 | +@ IN SOA <%= node['bind-grid']['zone']['SOA']['MNAME'] %> <%= node['bind-grid']['zone']['SOA']['RNAME'] %> ( | |
3 | + 2017010101 ; Serial | |
4 | + 3600 ; Refresh | |
5 | + 900 ; Retry | |
6 | + 604800 ; Expire | |
7 | + 86400 ; Negative Cache TTL | |
8 | +) | |
9 | +<% | |
10 | +node['bind-grid']['zone']['NS'].each {|ns| | |
11 | +-%> | |
12 | + IN NS <%= ns %> | |
13 | +<% | |
14 | +} | |
15 | +-%> | |
16 | + | |
17 | + IN PTR example.com. | |
18 | + IN A 255.255.255.0 | |
19 | + | |
20 | +10 IN PTR node00.example.com. | |
21 | +11 IN PTR node01.example.com. |
@@ -0,0 +1,20 @@ | ||
1 | +$TTL 604800 | |
2 | +@ IN SOA <%= node['bind-grid']['zone']['SOA']['MNAME'] %> <%= node['bind-grid']['zone']['SOA']['RNAME'] %> ( | |
3 | + 2017010101 ; Serial | |
4 | + 3600 ; Refresh | |
5 | + 900 ; Retry | |
6 | + 604800 ; Expire | |
7 | + 86400 ; Negative Cache TTL | |
8 | +) | |
9 | +<% | |
10 | +node['bind-grid']['zone']['NS'].each {|ns| | |
11 | +-%> | |
12 | + IN NS <%= ns %> | |
13 | +<% | |
14 | +} | |
15 | +-%> | |
16 | + | |
17 | +node00 IN A 192.168.1.10 | |
18 | +node01 IN A 192.168.1.11 | |
19 | + | |
20 | +www IN CNAME node00 |