canonical / microcloud

Automated private cloud based on LXD, Ceph and OVN
https://microcloud.is
GNU Affero General Public License v3.0
260 stars 36 forks source link

Support environment variable for preseed #316

Open hayone1 opened 1 month ago

hayone1 commented 1 month ago

The ask is simple. Environment variables increase the ease and option of automation by a lot.

You could read stdin first and if it's nil or empty then read the environment variable next.

cat preseed.yml | microcloud init --preseed

and

export PRESEED=$(cat preseed.yml)
microcloud init --preseed
roosterfish commented 4 weeks ago

Hi @hayone1, can you please elaborate more on your specific automation use case? Why can't you pass the preseed file via stdin?

hayone1 commented 4 weeks ago

Well, more options allow for more choices and where certain environments are limited in the use of stdin, they can defer to environment variables.

eg. I tried to debug main_init_preseed in vscode, but vscode debug cannot read from stdin. When using ansible also, I'd prefer to set the pressed content as an environment variable because it makes things more. And this is just me.

As potential adoption of microcloud grows, you'd definitely find cases where the ability to set env variables would be the deciding factor in choosing microcloud over other options.