How to compose VMs with vlans using MaaS CLI ?

Hi,

I’m fedup composing machines “by hand” using the MaaS UI because it is way too slow when you want to compose 10 VMs with exactly the same specs.
I know Juju can dynamically create machines based on constraints but doing this way, you can’t have finer indepth regarding network or machines specs.

So I tried with the MaaS CLI and ended up with something like this :

maas <PROFILE> vm-host compose <VM_HOST_ID> \
    cores=4 memory=16384 \
    storage=mylabel:50(default) \
    interfaces=ens4:space=SPACE-PXE \
    hostname=<VM_NAME>

This works well when creating a 4 vCPUs/16GB RAM/50GB disk and 1 interface plugged on the provisionning network.
But now, I’d like to add a few vlans on this interface.
I can do it very easily through the MaaS UI but I didn’t find a way to do it the CLI way.

Can somebody help me on this ?

Best regards.

interfaces is a list, so you can specify many of them in that one compose command

@sparkiegeek Thanks for the information but do you have an example ?
Because I tried many things without results and I don’t find a valuable answer in the documentation.

Let’s say that you have an interface called “ens4” on top of which you want to declare 2 vlans (vlan1, vlan2) with their corresponding subnet and autoassign an IP for vlan1 and defining a static IP for vlan2.
How would you do that ?