I am running a HyperV environment with Ubuntu 14.04 server running in generation 1 guests setups. It runs nicely.
I want to be able to clone the system (while shut down), give it a new name, and have the new system reconfigure itself slightly - different static IP, different LVS setup, different Apache2 setup, etc. I am doing that by copying over the appropriate configuration files (i.e. the system has multiple copies, it replaces files like /etc/network/interfaces with the right one)
I cannot find an appropriate place in upstart to do this. Doing it before local-file-systems the file system is not available read/write. Doing it after, e.g. in if-pre-up.d during network startup collides with the system's own configuration (i.e. I'm replacing /etc/network/interfaces after it has started using it).
It is not desirable to have it fully boot and run a script as it will pop up on the network with an IP conflict, potentially affecting the parent of this clone. So I want to do it during boot.
I have somewhat gotten this to work by rebooting a second time from if-pre-up.d, after moving the files, before allowing it to finish coming up. But that seems a bit wrong for various reasons, not the least of which it then stops in grub (or whatever that boot screen is) and requires an ENTER key. [I've posted a question on this elsewhere, if you can help with that, please answer there.]
Is there an appropriate place in upstart's sequence that I can overwrite network interface files (and related service files like keepaloved, apache2, haproxy) and have them processed normally?