Projet

Général

Profil

dhcpd.conf.patch

Benjamin Bohard, 11/09/2024 13:39

Télécharger (5,32 ko)

Voir les différences:

modif/dhcpd.conf 2024-09-11 13:37:40.828932620 +0200
153 153
}
154 154
%end if
155 155

  
156

  
156 157
# déclaration des hôtes des plages statiques
157 158
%if %%ead3 == 'non'
158 159
include "/etc/dhcp/fixed-address/fixed-addresses.txt";
......
164 165
 %else
165 166
  %set %%hosts = []
166 167
 %end if
168

  
167 169
 %for %%idx, %%group in %%enumerate(%%groups)
168 170
  %set %%grouped_hosts = [h for h in %%hosts if h[3] == group]
169 171
  %if %%grouped_hosts != []
170 172
group %%group {
171 173
  option subnet-mask %%groups[%%group].get('adresse_netmask_dhcp');
174

  
172 175
   %if %%groups[%%group].get('adresse_ip_gw_dhcp') is not None
173 176
  option routers %%groups[%%group].get('adresse_ip_gw_dhcp');
174 177
   %end if
178

  
175 179
   %if %%groups[%%group].get('nom_domaine_dhcp') is not None
176 180
  option domain-name "%%groups[%%group].get('nom_domaine_dhcp')";
177 181
   %end if
182

  
178 183
  %if %%groups[%%group].get('adresse_ip_dns_dhcp') is not None
179 184
  option domain-name-servers %%groups[%%group].get('adresse_ip_dns_dhcp')%slurp
180
   %if %%groups[%%group].get('adresse_ip_dns_secondaire_dhcp') is not None
185

  
186
  %if %%groups[%%group].get('adresse_ip_dns_secondaire_dhcp') is not None
181 187
, %%groups[%%group].get('adresse_ip_dns_secondaire_dhcp')%slurp
182 188
   %end if
183 189
;
184 190
  %end if
191

  
185 192
  %if %%groups[%%group].get('adresse_ip_wins_primaire_dhcp') is not None
186 193
  option netbios-name-servers %%groups[%%group].get('adresse_ip_wins_primaire_dhcp')%slurp
187
   %if %%groups[%%group].get('adresse_ip_wins_secondaire_dhcp') is not None
194

  
195
  %if %%groups[%%group].get('adresse_ip_wins_secondaire_dhcp') is not None
188 196
, %%groups[%%group].get('adresse_ip_wins_secondaire_dhcp')%slurp
189 197
   %end if
190 198
;
......
195 203
;
196 204
  option netbios-node-type 8;
197 205
  %end if
206

  
198 207
  %if %%groups[%%group].get('adresse_ip_ntp_dhcp') is not None
199 208
  option ntp-servers %%groups[%%group].get('adresse_ip_ntp_dhcp');
200 209
  %end if
201
  %if %%activer_tftp == 'oui' and %%groups[%%group].get('fichier_pxe_dhcp') is not None
210

  
211
  %if %%activer_tftp == 'oui'
212
   %if %%groups[%%group].get('fichier_pxe_dhcp') and not %%groups[%%group].get('fichier_pxe_dhcp_uefi')
202 213
  next-server %%adresse_ip_tftp;
203
   %if %%groups[%%group].get('fichier_pxe_dhcp_uefi') is not None
204
  class "Legacy-eoleglobal-%%idx" {
205
    match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
206
    if substring (option vendor-class-identifier, 15, 5) = "00000" {
207
      # LEGACY
208
      filename "%%groups[%%group].get('fichier_pxe_dhcp')";
209
    } else {
210
      # UEFI
211
      filename "%%groups[%%group].get('fichier_pxe_dhcp_uefi')";
212
    }
213
  }
214
   %else
215
    filename "%%groups[%%group].get('fichier_pxe_dhcp')";
214
  filename "%%groups[%%group].get('fichier_pxe_dhcp')";
215
   %else if %%groups[%%group].get('fichier_pxe_dhcp_uefi') and not %%groups[%%group].get('fichier_pxe_dhcp')
216
  next-server %%adresse_ip_tftp;
217
  filename "%%groups[%%group].get('fichier_pxe_dhcp_uefi')";
216 218
   %end if
217 219
  %end if
218 220
  %if %%groups[%%group].get('domain_wpad_dhcp') is not None
......
259 261
include "/etc/dhcp/host-classes/%%{pools[%%pool]['ip_basse_dhcp']}-%%{pools[%%pool]['ip_haute_dhcp']}.txt";
260 262
   %else
261 263
class "pool-%%{pools[%%pool]['ip_basse_dhcp']}-%%{pools[%%pool]['ip_haute_dhcp']}" {
262
	match hardware;
264
    match hardware;
263 265
}
264 266
    %set %%filtered_hosts = [h for h in %%hosts if h[3] == pool]
265 267
    %for %%filtered_host in %%filtered_hosts
......
329 331
  %if %%adresses_ip_ntp
330 332
  option ntp-servers %%custom_join(%%adresses_ip_ntp, ', ');
331 333
  %end if
332
  %if %%activer_tftp == 'oui'
333
  next-server %%adresse_ip_tftp;
334
    %if %%chemin_fichier_pxe_uefi is not None
335
  class "Legacy-local%%idx" {
336
    match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
337
    if substring (option vendor-class-identifier, 15, 5) = "00000" {
338
      # LEGACY
339
      filename "%%chemin_fichier_pxe";
340
    } else {
341
      # UEFI
342
      filename "%%chemin_fichier_pxe_uefi";
343
    }
344
  }
345
    %else
346
        filename "%%chemin_fichier_pxe";
347
    %end if
348
  %end if
349 334

  
350 335
    # plages d'ip
351 336
  %for %%idx2, %%pool in %%enumerate([p for p in %%subnets[%%subnet] if p in pools and pools[p]['adressage_statique'] == 'non'])
......
397 382
 %if not %%lease_max == None
398 383
     max-lease-time 	%%lease_max;
399 384
 %end if
400
 %if %%activer_tftp == 'oui' and %%pools[%%pool].get('fichier_pxe_dhcp') is not None
401
     next-server %%adresse_ip_tftp;
402
    %if %%pools[%%pool].get('fichier_pxe_dhcp_uefi') is not None
403
     class "Legacy-local-%%idx-%%idx2" {
404
       match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
405
       if substring (option vendor-class-identifier, 15, 5) = "00000" {
385
 %if %%activer_tftp == 'oui'
386
 %if %%pools[%%pool].get('fichier_pxe_dhcp')
387
     if substring (option vendor-class-identifier, 0, 9) = "PXEClient" and substring (option vendor-class-identifier, 15, 5) = "00000" {
406 388
         # LEGACY
389
         next-server %%adresse_ip_tftp;
407 390
         filename "%%pools[%%pool].get('fichier_pxe_dhcp')";
408
       } else {
391
     }
392
 %end if
393
 %if %%pools[%%pool].get('fichier_pxe_dhcp_uefi')
394
     if substring (option vendor-class-identifier, 0, 9) = "PXEClient" and not (substring (option vendor-class-identifier, 15, 5) = "00000") {
409 395
         # UEFI
396
         next-server %%adresse_ip_tftp;
410 397
         filename "%%pools[%%pool].get('fichier_pxe_dhcp_uefi')";
411
       }
412 398
     }
413
    %else
414
        filename "%%pools[%%pool].get('fichier_pxe_dhcp')";
415
    %end if
416 399
 %end if
417

  
418
    }
400
 %end if
401
  }
419 402
%end for
420 403
}
421 404