From: Christian Pointner Date: Tue, 16 Jul 2019 20:15:39 +0000 (+0200) Subject: preseed: add option to allow installation using dhcp X-Git-Url: https://git.realraum.at/?p=noc.git;a=commitdiff_plain;h=74ca2b51ee23cf685661af93c0f3ac34f8ed070d preseed: add option to allow installation using dhcp --- diff --git a/ansible/roles/preseed/templates/preseed_debian-buster.cfg.j2 b/ansible/roles/preseed/templates/preseed_debian-buster.cfg.j2 index d5984f2..e1bfd15 100644 --- a/ansible/roles/preseed/templates/preseed_debian-buster.cfg.j2 +++ b/ansible/roles/preseed/templates/preseed_debian-buster.cfg.j2 @@ -9,14 +9,19 @@ d-i keyboard-configuration/xkb-keymap select us d-i hw-detect/load_firmware boolean false -d-i netcfg/disable_dhcp boolean true d-i netcfg/choose_interface select {{ install_interface | default(hostvars[hostname].network_cooked.primary.interface) }} +{% if 'install_dhcp' in hostvars[hostname] and hostvars[hostname].install_dhcp %} +d-i netcfg/disable_dhcp boolean false d-i netcfg/disable_autoconfig boolean false +{% else %} +d-i netcfg/disable_dhcp boolean true +d-i netcfg/disable_autoconfig boolean true d-i netcfg/get_ipaddress string {{ hostvars[hostname].network_cooked.primary.ip }} d-i netcfg/get_netmask string {{ hostvars[hostname].network_cooked.primary.mask }} d-i netcfg/get_gateway string {{ hostvars[hostname].network_cooked.primary.gateway }} d-i netcfg/get_nameservers string {{ hostvars[hostname].network_cooked.nameservers | join(' ') }} d-i netcfg/confirm_static boolean true +{% endif %} d-i netcfg/hostname string {{ hostname }} d-i netcfg/get_hostname string {{ hostname }} diff --git a/ansible/roles/preseed/templates/preseed_debian-stretch.cfg.j2 b/ansible/roles/preseed/templates/preseed_debian-stretch.cfg.j2 index 14d371f..55a0516 100644 --- a/ansible/roles/preseed/templates/preseed_debian-stretch.cfg.j2 +++ b/ansible/roles/preseed/templates/preseed_debian-stretch.cfg.j2 @@ -9,14 +9,19 @@ d-i keyboard-configuration/xkb-keymap select us d-i hw-detect/load_firmware boolean false -d-i netcfg/disable_dhcp boolean true d-i netcfg/choose_interface select {{ install_interface | default(hostvars[hostname].network_cooked.primary.interface) }} +{% if 'install_dhcp' in hostvars[hostname] and hostvars[hostname].install_dhcp %} +d-i netcfg/disable_dhcp boolean false d-i netcfg/disable_autoconfig boolean false +{% else %} +d-i netcfg/disable_dhcp boolean true +d-i netcfg/disable_autoconfig boolean true d-i netcfg/get_ipaddress string {{ hostvars[hostname].network_cooked.primary.ip }} d-i netcfg/get_netmask string {{ hostvars[hostname].network_cooked.primary.mask }} d-i netcfg/get_gateway string {{ hostvars[hostname].network_cooked.primary.gateway }} d-i netcfg/get_nameservers string {{ hostvars[hostname].network_cooked.nameservers | join(' ') }} d-i netcfg/confirm_static boolean true +{% endif %} d-i netcfg/hostname string {{ hostname }} d-i netcfg/get_hostname string {{ hostname }} diff --git a/ansible/roles/preseed/templates/preseed_ubuntu-bionic.cfg.j2 b/ansible/roles/preseed/templates/preseed_ubuntu-bionic.cfg.j2 index 9054dab..6ceaf86 100644 --- a/ansible/roles/preseed/templates/preseed_ubuntu-bionic.cfg.j2 +++ b/ansible/roles/preseed/templates/preseed_ubuntu-bionic.cfg.j2 @@ -13,14 +13,19 @@ d-i keyboard-configuration/layoutcode string us d-i hw-detect/load_firmware boolean false -d-i netcfg/disable_dhcp boolean true d-i netcfg/choose_interface select {{ install_interface | default(hostvars[hostname].network_cooked.primary.interface) }} +{% if 'install_dhcp' in hostvars[hostname] and hostvars[hostname].install_dhcp %} +d-i netcfg/disable_dhcp boolean false d-i netcfg/disable_autoconfig boolean false +{% else %} +d-i netcfg/disable_dhcp boolean true +d-i netcfg/disable_autoconfig boolean true d-i netcfg/get_ipaddress string {{ hostvars[hostname].network_cooked.primary.ip }} d-i netcfg/get_netmask string {{ hostvars[hostname].network_cooked.primary.mask }} d-i netcfg/get_gateway string {{ hostvars[hostname].network_cooked.primary.gateway }} d-i netcfg/get_nameservers string {{ hostvars[hostname].network_cooked.nameservers | join(' ') }} d-i netcfg/confirm_static boolean true +{% endif %} d-i netcfg/hostname string {{ hostname }} d-i netcfg/get_hostname string {{ hostname }} diff --git a/ansible/roles/preseed/templates/preseed_ubuntu-xenial.cfg.j2 b/ansible/roles/preseed/templates/preseed_ubuntu-xenial.cfg.j2 index 0252853..c981d34 100644 --- a/ansible/roles/preseed/templates/preseed_ubuntu-xenial.cfg.j2 +++ b/ansible/roles/preseed/templates/preseed_ubuntu-xenial.cfg.j2 @@ -13,14 +13,19 @@ d-i keyboard-configuration/layoutcode string us d-i hw-detect/load_firmware boolean false -d-i netcfg/disable_dhcp boolean true d-i netcfg/choose_interface select {{ install_interface | default(hostvars[hostname].network_cooked.primary.interface) }} +{% if 'install_dhcp' in hostvars[hostname] and hostvars[hostname].install_dhcp %} +d-i netcfg/disable_dhcp boolean false d-i netcfg/disable_autoconfig boolean false +{% else %} +d-i netcfg/disable_dhcp boolean true +d-i netcfg/disable_autoconfig boolean true d-i netcfg/get_ipaddress string {{ hostvars[hostname].network_cooked.primary.ip }} d-i netcfg/get_netmask string {{ hostvars[hostname].network_cooked.primary.mask }} d-i netcfg/get_gateway string {{ hostvars[hostname].network_cooked.primary.gateway }} d-i netcfg/get_nameservers string {{ hostvars[hostname].network_cooked.nameservers | join(' ') }} d-i netcfg/confirm_static boolean true +{% endif %} d-i netcfg/hostname string {{ hostname }} d-i netcfg/get_hostname string {{ hostname }}