From d48936e76fe966764ab541a41c6450ab7f4ee016 Mon Sep 17 00:00:00 2001 From: mischa Date: Thu, 4 May 2023 14:56:02 +0200 Subject: [PATCH] still allow predefined IPs with dhcpd --- deploy.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/deploy.pl b/deploy.pl index 37b576d..1a16ee2 100755 --- a/deploy.pl +++ b/deploy.pl @@ -198,6 +198,7 @@ sub render_install_conf { my $jot_pass = qx(jot -rcs '' 20 46 125); chomp($jot_pass); my $_ipv4 = $vms{$vm_name}{'ipv4'} || "autoconf"; + $_ipv4 = "autoconf" if $conf{'conf'}{'DHCPD'} eq "yes"; my $_ipv4_gateway = $vms{$vm_name}{'ipv4_gw'} || $conf{'conf'}{'ROUTER'}; my $_ipv6 = $vms{$vm_name}{'ipv6'} || $conf{'conf'}{'IPV6_PREFIX'} . ":" . ($conf{'conf'}{'IPV6_START'} + $vms{$vm_name}{'vm_number'}) . "::" . ($conf{'conf'}{'IP_START'} + $vms{$vm_name}{'vm_number'}); my $_ipv6_gateway = $vms{$vm_name}{'ipv6_gw'} || $conf{'conf'}{'IPV6_PREFIX'} . ":" . ($conf{'conf'}{'IPV6_START'} + $vms{$vm_name}{'vm_number'}) . "::1"; @@ -362,12 +363,12 @@ my %vms; my @files = glob "$conf{'conf'}{'VMS'}/*.txt"; %vms = get_variables('vms', @files); -my $DHCP = $conf{'conf'}{'DHCP'} || "yes"; +$conf{'conf'}{'DHCPD'} = "yes" if ! $conf{'conf'}{'DHCPD'}; # run all functions #debug_parse(\%conf, \%vms); render_vm_conf(\%conf, \%vms); -render_dhcpd_conf(\%conf, \%vms) if $DHCP eq "yes"; +render_dhcpd_conf(\%conf, \%vms) if $conf{'conf'}{'DHCPD'} eq "yes"; render_install_conf(\%conf, \%vms); create_accounts(\%conf, \%vms); create_img_files(\%conf, \%vms);