forked from benhoskings/babushka-deps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dns.rb
25 lines (22 loc) · 1.15 KB
/
dns.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
dep 'dnsmasq' do
requires 'dnsmasq.managed'
def dnsmasq_conf
"/etc/dnsmasq.conf".p
end
setup {
define_var :dhcp_network,
:type => :ip_range,
:default => '10.0.1.x',
:message => "What network range would you like to serve DHCP on?"
set :dhcp_subnet, L{ Babushka::IPRange.new(var(:dhcp_network)).subnet }
set :dhcp_broadcast_ip, L{ Babushka::IPRange.new(var(:dhcp_network)).broadcast }
define_var :dns_domain, :message => "The network's domain", :default => 'example.org'
define_var :dns_server_ip, :message => "The DNS server itself", :default => L{ Babushka::IPRange.new(var(:dhcp_network)).first }
define_var :dhcp_router_ip, :message => "Default gateway", :default => L{ var :dns_server_ip }
define_var :dhcp_start_address, :message => "DHCP starting address", :default => L{ Babushka::IP.new(var(:dns_server_ip)).next }
define_var :dhcp_end_address, :message => "DHCP ending address", :default => L{ Babushka::IPRange.new(var(:dhcp_network)).last.prev }
}
met? { babushka_config? dnsmasq_conf }
meet { render_erb "dnsmasq/dnsmasq.conf.erb", :to => dnsmasq_conf, :sudo => true }
end
dep 'dnsmasq.managed'