diff --git a/multi-node-aio/playbooks/deploy-vms.yml b/multi-node-aio/playbooks/deploy-vms.yml index 289a0d3b..bad7289a 100644 --- a/multi-node-aio/playbooks/deploy-vms.yml +++ b/multi-node-aio/playbooks/deploy-vms.yml @@ -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: diff --git a/multi-node-aio/playbooks/pxe/debian/vm-post-install-script.sh.j2 b/multi-node-aio/playbooks/pxe/debian/vm-post-install-script.sh.j2 index 20034141..ee9ee5f6 100644 --- a/multi-node-aio/playbooks/pxe/debian/vm-post-install-script.sh.j2 +++ b/multi-node-aio/playbooks/pxe/debian/vm-post-install-script.sh.j2 @@ -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 <