Skip to content

Instantly share code, notes, and snippets.

@mrballcb
Last active December 31, 2015 04:39
Show Gist options
  • Save mrballcb/7935582 to your computer and use it in GitHub Desktop.
Save mrballcb/7935582 to your computer and use it in GitHub Desktop.
cookbooks/common/attributes/dns_server.rb:
# List of required packages for a DNS server, CentOS5
node.default[:iv][:packages][:dns]["5"] = %w{bind97 bind97-chroot bind97-libs}
# List of required packages for a DNS server, CentOS6
node.default[:iv][:packages][:dns]["6"] = %w{bind bind-chroot bind-libs}
cookbooks/common/recipes/dns_server.rb:
# Gets either a "5" or a "6"
centos_major = node.platform_version.sub(/(\d)\.\d/,'\1')
# Could have done instead: node.platform_version.to_i
node[:iv][:packages][:dns][centos_major].each do |pkg|
package pkg do
action :upgrade
notifies :restart, "service[named]"
end
end
cookbook_file "/etc/sysconfig/named" do
source "sysconfig-named"
owner "root"
group "root"
mode "0644"
action :create
notifies :restart, "service[named]"
end
directory "/var/named/chroot/var/log/default" do
owner "named"
group "named"
mode "0775"
recursive true
action :create
end
service "named" do
supports status: true, restart: true, reload: true
action [:enable,:start]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment