How to configure ssh-keys from meta-data with NoCloud ds

Asked by Alexis Camilleri on 2021-02-26

I'm trying to configure ssh keys on my instance through meta-data, but it not works. I don't want to use user-data for this.

I configured a NoCloud-net datasource with a valid URL. The public-ssh-keys field is not filled.

```
root@bm-node01:~# cloud-id --json
{
 "_beta_keys": [
  "subplatform"
 ],
 "availability-zone": null,
 "availability_zone": null,
 "cloud-name": "unknown",
 "cloud_id": "nocloud",
 "cloud_name": "unknown",
 "distro": "ubuntu",
 "distro_release": "bionic",
 "distro_version": "18.04",
 "instance-id": "nocloud",
 "instance_id": "nocloud",
 "kernel_release": "4.15.0-135-generic",
 "local-hostname": "node01",
 "local_hostname": "node01",
 "machine": "x86_64",
 "platform": "nocloud",
 "public_ssh_keys": [],
 "python_version": "3.6.9",
 "region": null,
 "subplatform": "seed-dir (ds_config_seedfrom,http://192.168.50.254:8129/v1/metadata/node/f7dbfbe3-98b8-4a98-8720-d5d361e823ca/)",
 "system_platform": "Linux-4.15.0-135-generic-x86_64-with-Ubuntu-18.04-bionic",
 "variant": "ubuntu"
}
```

How can I do this ?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu cloud-init Edit question
Assignee:
No assignee Edit question
Solved by:
Alexis Camilleri
Solved:
Last query:
Last reply:
Alexis Camilleri (krysenn) said : #2

I don't understand your reply, i think it's not related ...

I found an example here: https://github.com/canonical/cloud-init/blob/master/doc/examples/seed/meta-data
I switch my meta-data response as yaml, with public-keys field instead of public_ssh_keys, now it's working.

Thanks.