preseed: debian buster names interfaces differently than stretch and in a way that...
[noc.git] / ansible / roles / preseed / templates / preseed_ubuntu-xenial.cfg.j2
index 950472c..0252853 100644 (file)
@@ -65,35 +65,34 @@ d-i partman-md/device_remove_md boolean true
 d-i partman-lvm/confirm boolean true
 d-i partman-lvm/confirm_nooverwrite boolean true
 
-d-i partman-auto/expert_recipe string                                   \
-      boot-root ::                                                      \
-              1000 10000 -1 ext4                                        \
-                      $defaultignore{ } $primary{ } $bootable{ }        \
-                      method{ lvm } vg_name{ {{ hostname }} }           \
-              .                                                         \
-              2048 10000 2560 ext4                                      \
-                      $lvmok{ } in_vg{ {{ hostname }} }                 \
-                      method{ format } format{ }                        \
-                      use_filesystem{ } filesystem{ ext4 }              \
-                      mountpoint{ / }                                   \
-              .                                                         \
-              1024 11000 1280 ext4                                      \
-                      $lvmok{ } in_vg{ {{ hostname }} }                 \
-                      method{ format } format{ }                        \
-                      use_filesystem{ } filesystem{ ext4 }              \
-                      mountpoint{ /var }                                \
-              .                                                         \
-              768 10000 768 ext4                                        \
-                      $lvmok{ } in_vg{ {{ hostname }} }                 \
-                      method{ format } format{ }                        \
-                      use_filesystem{ } filesystem{ ext4 }              \
-                      mountpoint{ /var/log }                            \
-                      options/nodev{ nodev } options/noatime{ noatime } \
-                      options/noexec{ noexec }                          \
-              .                                                         \
-              16 20000 -1 ext4                                          \
-                      $lvmok{ } in_vg{ {{ hostname }} }                 \
-                      method( keep } lv_name{ dummy }                   \
+d-i partman-auto/expert_recipe string                                    \
+      boot-root ::                                                       \
+              1000 10000 -1 ext4                                         \
+                      $defaultignore{ } $primary{ } $bootable{ }         \
+                      method{ lvm } vg_name{ {{ hostname }} }            \
+              .                                                          \
+              2048 10000 2560 ext4                                       \
+                      $lvmok{ } in_vg{ {{ hostname }} }                  \
+                      method{ format } format{ }                         \
+                      use_filesystem{ } filesystem{ ext4 }               \
+                      mountpoint{ / }                                    \
+              .                                                          \
+              1024 11000 1280 ext4                                       \
+                      $lvmok{ } in_vg{ {{ hostname }} }                  \
+                      method{ format } format{ }                         \
+                      use_filesystem{ } filesystem{ ext4 }               \
+                      mountpoint{ /var }                                 \
+              .                                                          \
+              768 10000 768 ext4                                         \
+                      $lvmok{ } in_vg{ {{ hostname }} }                  \
+                      method{ format } format{ }                         \
+                      use_filesystem{ } filesystem{ ext4 }               \
+                      mountpoint{ /var/log }                             \
+                      options/nodev{ nodev } options/noatime{ noatime }  \
+                      options/noexec{ noexec }                           \
+              .                                                          \
+              16 20000 -1 ext4                                           \
+                      $lvmok{ } in_vg{ {{ hostname }} } lv_name{ dummy } \
               .
 
 d-i partman-auto-lvm/no_boot boolean true
@@ -108,7 +107,7 @@ d-i base-installer/install-recommends boolean false
 d-i apt-setup/security_host string debian.ffgraz.net
 
 tasksel tasksel/first multiselect
-d-i pkgsel/include string openssh-server python
+d-i pkgsel/include string openssh-server python python-apt
 d-i pkgsel/upgrade select safe-upgrade
 popularity-contest popularity-contest/participate boolean false
 d-i pkgsel/update-policy select none
@@ -125,8 +124,14 @@ d-i preseed/late_command string \
     in-target bash -c "apt-get update -q && apt-get full-upgrade -y -q"; \
     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 preseed_force_net_ifnames_policy is defined %}
+    mkdir -p /target/etc/systemd/network; \
+    in-target bash -c "echo '[Link]' > /etc/systemd/network/90-namepolicy.link"; \
+    in-target bash -c "echo 'NamePolicy={{ preseed_force_net_ifnames_policy }}' >> /etc/systemd/network/90-namepolicy.link"; \
+    in-target bash -c "update-initramfs -u"; \
+{% endif %}
 {% 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"
+    in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[hostname].ansible_port }}/' -i /etc/ssh/sshd_config"; \
 {% endif %}
+    mkdir -p -m 0700 /target/root/.ssh; \
+    cp /authorized_keys /target/root/.ssh/