updated preseed templates for ubuntu xenial and bionic
[noc.git] / ansible / roles / preseed / templates / preseed_ubuntu-xenial.cfg.j2
index 5f4c49e..8af9dc0 100644 (file)
@@ -11,14 +11,14 @@ d-i console-setup/ask_detect boolean false
 d-i keyboard-configuration/xkb-keymap select us
 d-i keyboard-configuration/layoutcode string us
 
-
-#d-i netcfg/choose_interface select enp1s1
-#d-i netcfg/disable_autoconfig boolean false
-#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
+d-i netcfg/disable_dhcp boolean true
+d-i netcfg/choose_interface select {{ install_interface | default(hostvars[hostname].network_cooked.primary.interface) }}
+d-i netcfg/disable_autoconfig boolean false
+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
 
 d-i netcfg/get_hostname string {{ hostname }}
 d-i netcfg/get_domain string {{ hostvars[hostname].network_cooked.domain }}
@@ -49,6 +49,8 @@ d-i partman-auto-lvm/new_vg_name string {{ hostname }}
 d-i partman-auto-lvm/guided_size string max
 
 d-i partman-lvm/device_remove_lvm boolean true
+d-i partman-md/device_remove_md boolean true
+
 d-i partman-lvm/confirm boolean true
 d-i partman-lvm/confirm_nooverwrite boolean true
 
@@ -110,5 +112,10 @@ d-i finish-install/reboot_in_progress note
 d-i preseed/late_command string \
     lvremove -f {{ hostname }}/dummy; \
     in-target bash -c "apt-get update -q && apt-get full-upgrade -y -q"; \
-    in-target bash -c "passwd -d root; passwd -l root; umask 077; mkdir -p /root/.ssh/; echo -e '{{ noc_ssh_keys | join('\\n') }}' > /root/.ssh/authorized_keys"; \
-    in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port 22000/' -i /etc/ssh/sshd_config"
+    in-target bash -c "passwd -d root && passwd -l root"; \
+    in-target bash -c "sed -e 's/^allow-hotplug/auto/' -i /etc/network/interfaces"; \
+    mkdir -p -m 0700 /target/root/.ssh; \
+    cp /authorized_keys /target/root/.ssh/; \
+{% if hostvars[hostname].ansible_port is defined %}
+    in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[hostname].ansible_port }}/' -i /etc/ssh/sshd_config"
+{% endif %}