-1

I want to add ssh key to the SUSPEND_CLOUD_SERVER vsi.

When I execute the commend below, I get "Item sshkey does not exist for package SUSPEND_CLOUD_SERVER" and the vsi does not be created.

Please advice me to add sshkey.

slcli order place --verify SUSPEND_CLOUD_SERVER TOKYO --complex-type SoftLayer_Container_Product_Order_Virtual_Guest --preset B1_8X16X100 REBOOT_REMOTE_CONSOLE 1_GBPS_PUBLIC_PRIVATE_NETWORK_UPLINKS BANDWIDTH_0_GB_2 1_IP_ADDRESS OS_UBUNTU_18_04_LTS_BIONIC_BEAVER_MINIMAL_64_BIT MONITORING_HOST_PING NOTIFICATION_EMAIL_AND_TICKET AUTOMATED_NOTIFICATION UNLIMITED_SSL_VPN_USERS_1_PPTP_VPN_USER_PER_ACCOUNT NESSUS_VULNERABILITY_ASSESSMENT_REPORTING --extras '{ "virtualGuests": [{"hostname": "server1", "domain": "test.dom"}] }' sshkey mysshkey

*) mysshkey is stored in my account.

1 Answers1

0

The slcli order place command doesn't have any option to add sshkeys, but that command uses the API method SoftLayer_Product_Order::placeOrder so the data like provisionScripts, sshkeys, userData, etc., can be added into --extras option.

Since the sshKeys is an array of SoftLayer_Container_Product_Order_SshKeys, see SoftLayer_Container_Product_Order_Virtual_Guest, the --extras should be something like below:

 --extras '{ "virtualGuests": [{"hostname": "server1", "domain": "test.dom"}],"sshKeys":[{"sshKeyIds": [123456]}]}'
Albert Camacho
  • 1,129
  • 1
  • 7
  • 13
  • I did it . But /root/.ssh/authorized_keys is empty. So I can't login by using private key. – user26575 Apr 22 '19 at 14:58
  • weird, that should works. hmm check if the sshkey was added to the vsi with `slcli --format=json call-api Virtual_Guest getSshKeys --id 789456`, if there isn't any you can add it with a osreload `slcli vs reload 789456 --key=123456` – Albert Camacho Apr 23 '19 at 15:50
  • I reviewed it and i was wrong before, sorry for that. I updated the example with the correct structure – Albert Camacho Apr 23 '19 at 16:08