I'm using the C7.2 GenericCloud image with KVM and am trying to inject my own ssh key by adding it to /etc/cloud/cloud.cfg.d:
sudo virt-customize --upload ~/local/cloud/20_centos_sshkey.cfg:/etc/cloud/cloud.cfg.d/20_centos_sshkey.cfg -d c7-template
Contents of the file:
#cloud-config
ssh_authorized_keys: - ssh-rsa [mysshkeyhere]
The good news is that it puts something in the authorized_keys file (which does not occur without it). The bad news is it's complete garbage (from guestfish) -- http://pastebin.centos.org/42526/
Any suggestion on either how to fix this or a better way to inject the key for this usage?
On 30/03/16 03:46, Tom Sorensen wrote:
I'm using the C7.2 GenericCloud image with KVM and am trying to inject my own ssh key by adding it to /etc/cloud/cloud.cfg.d:
Have you considered using a Config Drive instead ? That way you can actually do whatever contexutalisation you need. Here is an example you can likely clone and extend:
https://github.com/kbsingh/atomic-ci/blob/master/tests/z_0-genConfigDrive/1-...
You would then just need to boot the instance with this config drive .iso attached as the cdrom to the machine, which should also just be scriptable.
Regards