Possible to force cloud-init to run on already launched containers to pull ssh keys in?

Probably a silly question, but I’m trying to get a suite of already established LXD containers to have specific public keys already inside so I can SSH in with salt.

I can modify the default profile and newly launched containers will pull the ssh pubkey in as expected but is there a way I can force this script to run on an already running container?

Cheers!

Jon.

Cloud-init only triggers if the system identifier (in LXD’s case, the name) changes, so effectively, no.

You could use lxc file push to directly replace the file containing the public keys though.

1 Like