]> git.openstreetmap.org Git - chef.git/blob - cookbooks/dhcpd/recipes/default.rb
Drop custom ohai plugin path
[chef.git] / cookbooks / dhcpd / recipes / default.rb
1 #
2 # Cookbook:: dhcpd
3 # Recipe:: default
4 #
5 # Copyright:: 2011, OpenStreetMap Foundation
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 #     https://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 "networking"
21
22 package %w[
23   isc-dhcp-server
24   tftpd-hpa
25 ]
26
27 service "tftpd-hpa" do
28   action [:enable, :start]
29   supports :status => true, :restart => true
30 end
31
32 remote_file "/srv/tftp/netboot.xyz.efi" do
33   action :create
34   source "https://boot.netboot.xyz/ipxe/netboot.xyz.efi"
35   owner "root"
36   group "root"
37   mode "644"
38 end
39
40 remote_file "/srv/tftp/netboot.xyz-snp.efi" do
41   action :create
42   source "https://boot.netboot.xyz/ipxe/netboot.xyz-snp.efi"
43   owner "root"
44   group "root"
45   mode "644"
46 end
47
48 remote_file "/srv/tftp/netboot.xyz.kpxe" do
49   action :create
50   source "https://boot.netboot.xyz/ipxe/netboot.xyz.kpxe"
51   owner "root"
52   group "root"
53   mode "644"
54 end
55
56 domain = "#{node[:networking][:roles][:external][:zone]}.openstreetmap.org"
57
58 template "/etc/dhcp/dhcpd.conf" do
59   source "dhcpd.conf.erb"
60   owner "root"
61   group "root"
62   mode "644"
63   variables :domain => domain
64 end
65
66 template "/etc/default/isc-dhcp-server" do
67   source "default.erb"
68   owner "root"
69   group "root"
70   mode "644"
71 end
72
73 service "isc-dhcp-server" do
74   action [:enable, :start]
75   supports :status => true, :restart => true
76   subscribes :restart, "template[/etc/dhcp/dhcpd.conf]"
77   subscribes :restart, "template[/etc/default/isc-dhcp-server]"
78 end
79
80 service "isc-dhcp-server6" do
81   action [:disable, :stop]
82 end