I'm trying to get cloud-init to not take any action if the metadata server cannot be reached. If cloud-init ignores the error and continues executing (which seems to be the default configuration), then it resets the host SSH key, administrative user password, etc., which is a problem if the virtual machine was being used already beforehand (if password login was configured, then users can no longer access the VM).
I'm seeing this problem in two situations:
- The metadata server goes down
- Software is installed that blocks connections to the metadata server during boot (most recently, seeing this with ubuntu-desktop)