I have written a cloudconfig-lxd utility that configures LXD containers by applying
cloud-config files, in the format used by cloud-init, using the LXD API.
It does not require that the guest OS has cloud-init installed.
It can be used as a Go library or as an executable.
I use it both ways, and I’ve converted my container configuration procedures to this.
Supported cloud-init features
The following cloud-init modules (sections) are supported and applied in this order:
-
packages
-
write_files (only plain text, without any encoding)
-
users
-
runcmd
Standalone Usage
cloudconfig-lxd apply [-ostype <ostype>] -i <instance> <cloud-config-file>...
Visit the project page for more details: https://github.com/melato/cloudconfiglxd
I hope the instructions are clear. Let me know if anything needs clarification.