diff --git a/lib/refrepo/gen/puppet/templates/kavlan-dhcp.conf.erb b/lib/refrepo/gen/puppet/templates/kavlan-dhcp.conf.erb index b536c9e59c74acc0d072dbdc47c840f926ffabe8..87db5afb40293afe11373170af76e1e83d13448e 100644 --- a/lib/refrepo/gen/puppet/templates/kavlan-dhcp.conf.erb +++ b/lib/refrepo/gen/puppet/templates/kavlan-dhcp.conf.erb @@ -3,14 +3,11 @@ # GENERATED by kavlang5k.rb <% if dhcpkind == 'dhcpd'-%> -ddns-update-style none; -option space pxelinux; -option pxelinux.magic code 208 = string; -option pxelinux.configfile code 209 = text; -option pxelinux.pathprefix code 210 = text; -option pxelinux.reboottime code 211 = unsigned integer 32; -option vendorinfo code 43 = string; +authoritative; + +allow booting; +allow bootp; # define Option for the PXE class option space PXE; option PXE.mtftp-ip code 1 = ip-address; @@ -21,7 +18,16 @@ option PXE.mtftp-delay code 5 = unsigned integer 8; option PXE.discovery-control code 6 = unsigned integer 8; option PXE.discovery-mcast-addr code 7 = ip-address; option arch code 93 = unsigned integer 16; +option space pxelinux; +option pxelinux.magic code 208 = string; +option pxelinux.configfile code 209 = text; +option pxelinux.pathprefix code 210 = text; +option pxelinux.reboottime code 211 = unsigned integer 32; +site-option-space "pxelinux"; + +option pxelinux.magic f1:00:74:7e; +option pxelinux.reboottime 300; # create the Class PXE class "PXE" { # if the vendor-class-identifier is set to PXEClient in the client dhcp request @@ -51,6 +57,7 @@ class "PXE" { <% kavlan = refapi['sites'][site_uid]['kavlans'][kavlan_id.to_s] # TODO fix needed conversion kavlan_ip = IPAddress::IPv4::new(kavlan['network']) +kadeploy_ip = refapi['sites'][site_uid]['servers']['kadeploy']['network_adapters']['default']['ip'] -%> <% end -%> @@ -63,13 +70,19 @@ subnet6 <%= kavlan['network_ipv6'] %> { <% end -%> default-lease-time 86400; max-lease-time 604800; +<% if kavlan_id.to_i <= 9 -%> + option domain-name "<%= "#{site_uid}.grid5000.fr" %>"; + option domain-search "<%= "#{site_uid}.grid5000.fr" %>", "grid5000.fr"; +<% end -%> option domain-name-servers <%= kavlan_id.to_i.between?(1, 3)? kavlan['gateway'] : "dns.#{site_uid}.grid5000.fr" %>; option ntp-servers <%= kavlan_id.to_i.between?(1, 3)? kavlan['gateway'] : "ntp.#{site_uid}.grid5000.fr" %>; option routers <%= kavlan['gateway'] %>; <% if dhcpkind == 'dhcpd' -%> option subnet-mask <%= kavlan_ip.netmask %>; option broadcast-address <%= kavlan_ip.broadcast %>; - next-server <%= "kadeploy.#{site_uid}.grid5000.fr" %>; +<% if kavlan_id.to_i <= 9 -%> + next-server <%= kavlan_id.to_i <= 3 ? kadeploy_ip : "kadeploy.#{site_uid}.grid5000.fr" %>; +<% end -%> <% end -%> } @@ -95,8 +108,10 @@ refapi['sites'].sort.to_h.each_key do |site| host <%= node_uid %><%= interface['mounted']? "" : "-"+interface['device'] %>-kavlan-<%= kavlan_id %>.<%= site %>.grid5000.fr { hardware ethernet <%= interface['mac'].downcase() %>; option host-name "<%= node_uid %><%= interface['mounted']? "" : "-"+interface['device'] %>-kavlan-<%= kavlan_id %>"; +<% if kavlan_id.to_i > 9 -%> option domain-name "<%= site %>.grid5000.fr"; option domain-search "<%= site %>.grid5000.fr", "grid5000.fr"; +<% end -%> fixed-address <%= node['kavlan'][interface['device']]["kavlan-#{kavlan_id}"] %>; <% if kavlan_id.to_i > 9 -%> next-server kadeploy.<%= site %>.grid5000.fr; @@ -108,8 +123,10 @@ host <%= node_uid %><%= interface['mounted']? "" : "-"+interface['device'] %>-ka host <%= node_uid %><%= interface['mounted']? "" : "-"+interface['device'] %>-kavlan-<%= kavlan_id %>-ipv6.<%= site %>.grid5000.fr { hardware ethernet <%= interface['mac'].downcase() %>; option host-name "<%= node_uid %><%= interface['mounted']? "" : "-"+interface['device'] %>-kavlan-<%= kavlan_id %>-ipv6"; +<% if kavlan_id.to_i > 9 -%> option domain-name "<%= site %>.grid5000.fr"; option domain-search "<%= site %>.grid5000.fr", "grid5000.fr"; +<% end -%> fixed-address6 <%= node['kavlan6'][interface['device']]["kavlan-#{kavlan_id}"] %>; } <%