MaaS CLI fails to add a Subnet to its VLAN, what I'm doing wrong here?


When I create Spaces, VLANs within Spaces, and Subnets within VLANs, using MaaS Web UI, it works!

However, when I try to do the same using MaaS CLI, I can’t achieve the same result.

The problem is that, the subnets that I’m creating, aren’t appearing within the requested VLANs!

So, after running MaaS CLI, I have to go to the MaaS UI and manually add the subnets on their respective VLANS…

So, what I’m doing wrong here:

Creating Spaces (okay):

maas admin spaces create name="mgmt"
maas admin spaces create name="infra"

Creating VLANs (also looks ok):

maas admin vlans create 0 space="infra" name="ipmi-1" vid=1000
maas admin vlans create 0 space="infra" name="srvs-1" vid=1001

However, apparently, the next command is accepted but, looks wrong somehow, because when I check the MaaS UI, the subnets aren’t on theirs VLANs:

maas admin subnets create name="IPMI" cidr= gateway_ip= vid=1000 fabric=0
maas admin subnets create name="Servers" cidr= gateway_ip= vid=1001 fabric=0


My playbook to run those commands is here:

BTW, I’m working on my SVAuto thing, to deploy MaaS on top of LXD Containers using Ansible, it’s quite cool! lol

So, every time that I run my Ansible to deploy MaaS, I have to go to its UI to manually fix all the subnets… :sob:



No one knows what I’m doing wrong? :-/

Cheers! :stuck_out_tongue:

This works for me:

root@maas-bionic:~# maas user1 vlans create 0 name=“srvs-1” vid=1001
Machine-readable output follows:
“vid”: 1001,
“mtu”: 1500,
“dhcp_on”: false,
“external_dhcp”: null,
“relay_vlan”: null,
“fabric”: “fabric-0”,
“name”: “srvs-1”,
“fabric_id”: 0,
“space”: “undefined”,
“secondary_rack”: null,
“primary_rack”: null,
“id”: 5003,
“resource_uri”: “/MAAS/api/2.0/vlans/5003/”

root@maas-bionic:~# maas user1 subnets create name=“test” cidr= gateway_ip= fabric=0 vid=1001
Machine-readable output follows:
“name”: “test”,
“vlan”: {
“vid”: 0,
“mtu”: 1500,
“dhcp_on”: true,
“external_dhcp”: null,
“relay_vlan”: null,
“fabric”: “fabric-0”,
“name”: “untagged”,
“fabric_id”: 0,
“space”: “undefined”,
“secondary_rack”: null,
“primary_rack”: “ksns67”,
“id”: 5001,
“resource_uri”: “/MAAS/api/2.0/vlans/5001/”
“cidr”: “”,
“rdns_mode”: 2,
“gateway_ip”: “”,
“dns_servers”: [],
“allow_dns”: true,
“allow_proxy”: true,
“active_discovery”: false,
“managed”: true,
“space”: “undefined”,
“id”: 4,
“resource_uri”: “/MAAS/api/2.0/subnets/4/”

I wonder if its the order of the vid/fabric parameter?