Well, you could, but there are other things that happen once
'per-instance' also. For instance, the runcmd and other things only
happen once.
The feature of cloud-init to allow someone to boot an instance shut it
down and then snapshot (manual_cache_clean: False) by default basically
forces dependency on a 'DataSource' on every boot. Its worse when that
DataSource depends on a network.
config-drive is a local source of information that tells us an
instance-id, but it is less than ideal in other ways. I went looking at
dmidata on a serverstack
instance (http://paste.ubuntu.com/15259269/) and found
id/product_name: OpenStack Nova
id/product_uuid: 8A5115B1-D38B-4776-833D-7F22949187D8
That info seems to match:
$ readlink -f /var/lib/cloud/instance
/var/lib/cloud/instances/8a5115b1-d38b-4776-833d-7f22949187d8
It seems like we could / should do something there.
cloud-init could choose to not go looking for instance data again if its
previous instance id == /sys/class/dmi/id/product_uuid
This is an example of a really nicely behaving cloud. dmi data wouldnt
straight up fix it on other arch though.