MAAS create MACHINE by API : how to define VLAN/network part


By a API calll i create a machine under MAAS, with a json file.

but i dont find the way to configure the network part of the machine

here my json, for the headers:
“architecture”: “amd64/generic”,
“mac_addresses”: “xx:xx:xx:xx:xx:xx”,
“domain”: “maas”,
“pool”: “Project1”,
“hostname”: “maxou-srv02”,
“power_type”: “redfish”,
“power_parameters_power_user”: “root”,
“power_parameters_power_pass”: “ADMIN”,
“commission”: “False”,
“zone”: “eu-west-0-z”,

I dont find parameter or method to configure network part( definition of the Fabric, ans dhcp to yes)

the documentation API from Canonical is not really helpfull ( perhaps i am not enough good on scriptiing.)

any helps is welcome.

@PouicPouic, what do you mean by “network part of the machine”?

in your JSON, you set the MAC address and gave the power address. the IP address will be assigned by MAAS when you commission / deploy it. what parts are you wanting to specify that you don’t have the json keys for?

why is there no storage defined? How could you do that?


when i create a machine. yes Adresse mac is ok . but i dont find the way to define Fabric and DHCP mode.

|Name|MAC|Link speed|Fabric|DHCP|SR-IOV|
|eth0|14:18:77:6b:03:4e|0 Mbps|Unknown|No DHCP|No|

i d ont find those “f…ing” paramaters ^^

You can have a look at some ansible-playbooks I wrote communicating with the api. It does pretty much everything. Create fabrics, vlans, configure dhcp, rename interfaces on machines, create bonds, vlans, bridges, ips and storage.

You might not need much ansible knowledge to parse out the urls you need to interact with and look up the documentation.

The files of interest are probably configure-maas-fabrics.yml, configure-maas-fabric-vlans.yml and quite possibly any of the configure-machine-interface-*.yml files.

In the case you’re familiar with ansible, the configuration variables for the fabrics come from the inventory here and this inventory sample for machines.

1 Like

thx a lot.
your playbook help, i am not real strong in API.
if i understand , it s only when the machine is ready you can change network part?
i search to create machine with the network well config before the commissionning.

thx a lot again for you playbook, i hope to find the way to do what i want.

a real big thanks. i manage MAAS by ansible … without you i didn t do it.

love you

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.