diff options
author | Christian Pointner <equinox@spreadspace.org> | 2019-07-16 21:50:51 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2019-07-16 21:50:51 +0200 |
commit | 911edf13676a9028d2c5c893248c9a1bde1dfa09 (patch) | |
tree | a63ba01d5e65417d196fb9e32da86df5297c704e /roles/preseed/templates/preseed_xubuntu-cosmic-desktop-with-raid.cfg.j2 | |
parent | preseed: fix force namepolicy (diff) |
final tests with net ifname namepolicy succeeded
Diffstat (limited to 'roles/preseed/templates/preseed_xubuntu-cosmic-desktop-with-raid.cfg.j2')
-rw-r--r-- | roles/preseed/templates/preseed_xubuntu-cosmic-desktop-with-raid.cfg.j2 | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/roles/preseed/templates/preseed_xubuntu-cosmic-desktop-with-raid.cfg.j2 b/roles/preseed/templates/preseed_xubuntu-cosmic-desktop-with-raid.cfg.j2 index 13c30e93..ac4f8bde 100644 --- a/roles/preseed/templates/preseed_xubuntu-cosmic-desktop-with-raid.cfg.j2 +++ b/roles/preseed/templates/preseed_xubuntu-cosmic-desktop-with-raid.cfg.j2 @@ -16,14 +16,19 @@ d-i console-setup/ask_detect boolean false 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 {{ hostvars[hostname].host_name }} d-i netcfg/get_hostname string {{ hostvars[hostname].host_name }} @@ -142,8 +147,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/ |