How to do a interactive configuration LXD init

Hi everyone,
I am a student and I work to configure LXD, I am in charge to do a configurable script in bash to configure lxd. And I found that with the commande lxd init we can do this. But this configuration need to response to each question and I want to do a script that we give the argument ans this configure lxd.
I found that we can do lxd init --auto with –network-address to configure the ipv4 address but I didn’t find the other command to configure each question of lxd init.
Thank to all


for arg in "$@"; do
	case "$arg" in
		'--network-address') set -- "$@" '-a'  ;;
		'--network-port') set -- "$@" '-p' ;;
                "--"*)         set -- "$@" '-h';;
		*)	       set -- "$@" "$arg" ;;

while getopts a:b:f:h flag
    case "${flag}" in
        a) username=${OPTARG}
           FLAGS="${FLAGS} --network-address ${username}";;
        b) age=${OPTARG}
           FLAGS="${FLAGS} --network-port ${age}";;
        f) fullname=${OPTARG};;
	h) help

You can run it once and awnser “yes” to the pressed question to get the yaml you need, then see;

1 Like