Ask Your Question
1

How to set ssh key during rebuild?

asked 2013-10-11 20:48:31 -0500

trewq gravatar image

I am using pyrax to automate rebuild a server and set the ssh key during the rebuild process. The key does not get set.

I created my key like so:

with open(os.path.expanduser("~/.ssh/id_rsa.pub")) as keyfile:
    cs.keypairs.create("my_key", keyfile.read())

I kick off the rebuild like this:

staging_server.rebuild(ubu_image, password=os.environ['RAX_PASS'], key_name="my_key")

The server gets build but the key does not get set. What do I need to do to pass the key to my linux (ubuntu 12.04) server.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-03-01 10:43:40 -0500

Does your image have cloud-init installed in it? The key is passed via metadata. If cloud-init is not install. Then it will not install the key. Because cloud-init is what reads it from the metadata server and installs it.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2013-10-11 20:48:31 -0500

Seen: 200 times

Last updated: Oct 11 '13