summaryrefslogtreecommitdiff
path: root/roles/preseed/templates/preseed_ubuntu-bionic.cfg.j2
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2019-07-16 21:50:51 +0200
committerChristian Pointner <equinox@spreadspace.org>2019-07-16 21:50:51 +0200
commit911edf13676a9028d2c5c893248c9a1bde1dfa09 (patch)
treea63ba01d5e65417d196fb9e32da86df5297c704e /roles/preseed/templates/preseed_ubuntu-bionic.cfg.j2
parentpreseed: fix force namepolicy (diff)
final tests with net ifname namepolicy succeeded
Diffstat (limited to 'roles/preseed/templates/preseed_ubuntu-bionic.cfg.j2')
-rw-r--r--roles/preseed/templates/preseed_ubuntu-bionic.cfg.j212
1 files changed, 9 insertions, 3 deletions
diff --git a/roles/preseed/templates/preseed_ubuntu-bionic.cfg.j2 b/roles/preseed/templates/preseed_ubuntu-bionic.cfg.j2
index f4b0fff1..5fcab0aa 100644
--- a/roles/preseed/templates/preseed_ubuntu-bionic.cfg.j2
+++ b/roles/preseed/templates/preseed_ubuntu-bionic.cfg.j2
@@ -141,8 +141,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/