Cloud-init seed URL

Hi,

when using qemu and cloud-init, it’s possible to use a metadata server with this qemu cli parameter:

-smbios type=1,serial=ds=nocloud-net;s=http://10.10.0.1:8000/

Is it possible to use a metadata server with lxd, too?

Regards
Volker

There may be a cloud-init option you can set in user.user-data to tell it to go look somewhere for the actual data.

Otherwise, you can probably update its configuration either in a custom image or through lxc file push, overriding the default way it fetches its configuration from the nocloud-net provider that’s normally used for LXD to using a remote server.

Hi Stéphane,

thanks for your reply. It seems that user.user-data is too late for changing the datasource settings. I was not successful with this.

Pushing a file to the initialized container worked for me. I am now doing this:

#!/bin/bash

hostname=test2
mac=52:54:00:3f:e3:12

user_data="#cloud-config
datasource_list: [ NoCloud, None ]
datasource:
 NoCloud:
   seedfrom: http://10.10.0.1:8000/
"

echo "Initializing $hostname..."
lxc init -c volatile.eth0.hwaddr=$mac ubuntu:18.04 $hostname
echo "Writing cloud-init configuration..."
tmpfile=$(mktemp /tmp/cloud-init.XXXXXX)
echo "$user_data" > $tmpfile
lxc file push $tmpfile $hostname/etc/cloud/cloud.cfg.d/99_nocloud.cfg
rm -f $tmpfile
echo "Starting $hostname..."
lxc start $hostname

Thank you very much for your assistance.

Regards
Volker