Updates for Trusty VMs

Currently, attempting to use Trusty (14.04) VMs causes VMs to not
provision correctly due to a grub-install error.  With respect to this
specific issue, this commit updates vm.preseed.j2 by removing some
grub-installer options which were not present before the ansible
rewrite.

Secondly, with that change in place, VMs do not come online on their
10.0.236 addresses as something is overwriting
/etc/networking/interfaces, which wipes out the source of the
/etc/network/interfaces.d directory.  Bug [1] seems to indicate this
is in fact an issue and has been resolved, however attempts at using
this preseed option (netcfg/target_network_config) were not successful.
As a workaround, we simply chattr +i the interfaces file in
vm-post-install-script.sh.j2, and then remove the attr in
deploy-vms.yml when the instance is up an accessible.

[1] https://bugs.launchpad.net/ubuntu/+source/netcfg/+bug/1361902

Change-Id: I12d0c5108d1df0ab02b69d1b8cdb271a02999602
This commit is contained in:
Matt Thompson 2017-09-22 13:06:47 -04:00
parent 8a9d9ed96a
commit ce29ea23d1
3 changed files with 19 additions and 2 deletions

View File

@ -138,6 +138,20 @@
- src: "{{ lookup('env', 'HOME') }}/.ssh/id_rsa.pub"
dest: /root/.ssh/id_rsa.pub
# In vm-post-install-script.sh.j2 we chattr +i the interfaces file to prevent
# the preseed system from overwriting the file after we've modified it. The
# task below simply removes the immutable attribute.
- name: Remove immutable attr from /etc/network/interfaces
hosts: vm_servers
gather_facts: true
tasks:
- file:
path: /etc/network/interfaces
attr: ""
when:
- ansible_distribution | lower == "ubuntu"
- ansible_distribution_release | lower == "trusty"
environment: "{{ deployment_environment_variables | default({}) }}"
tags:

View File

@ -13,6 +13,11 @@ echo "{{ tftp_ssh_key }}" >> /root/.ssh/authorized_keys
wget --no-proxy http://{{ tftp_server }}/networking/$(cat /etc/hostname)-bridges.cfg -O /etc/network/interfaces.d/vm-bridges.cfg
wget --no-proxy http://{{ tftp_server }}/networking/basic-debian-interface.cfg -O /etc/network/interfaces
# Trusty VMs seem to have their interfaces file overwritten after we write to
# it, so we make it immutable to ensure no further changes take place
# NOTE: We remove the immutable attr in deploy-vms.yml once the instance is up
# and accessible.
[[ "$(lsb_release -sc)" == "trusty" ]] && chattr +i /etc/network/interfaces
cat > /etc/network/if-up.d/post-up-rules <<EOF
#!/usr/bin/env bash

View File

@ -215,8 +215,6 @@ d-i passwd/root-password-again password secrete
# This is fairly safe to set, it makes grub install automatically to the MBR
# if no other operating system is detected on the machine.
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
d-i grub-installer/bootdev string default
# Post Install