I've got an application that we deploy via ovf template. I have it set up so that a customer can enter the network settings into vSphere and they come through via ovfTools. All that works just fine. My problem is when I try to set the network settings to the operating system. I have a script I wrote that extracts the values into variables, then writes out the /etc/network/interfaces file.
Following this answer, I call my script during network-pre.target, and the new /etc/network/interfaces file gets written out, but when the network comes up, the old values are still set to the interface. If I issue a systemctl restart the service will restart, and the new values will be reflected in the interface.
It seems to me that the networking driver is loading the interfaces file before the call to my script is made (somewhere earlier than pre-network?). I don't think it makes sense to call for a restart of the network interface during the pre-network stage, so what is the proper way to force the network server to use the new values?
Edit: Here is my service definition:
[Unit] Description=Updates network information from the OVF Before=network-pre.target Wants=network-pre.target [Service] Type=oneshot ExecStart=/seven10/bin/setEnvFromOvf [Install] WantedBy=multi-user.target