Read machine tags from commissioning scripts


We use HPE machines with hardware RAID. We have create customs commissioning scripts to create HW Raids. We have one script to each kind of configuration.

The main problem with this approach is that Maas by default enables all commissioning scripts, so we need to have one commissioning script (with high priority 00-xxx) to disable all others scripts executions and manually select the desired script.

If we can read the tags of a machine (and storage) from the commissioning script, we could use a single partitioning script that, according to which tag, will perform one configuration or another.

This solution is quite powerful, as it gives full control over how to create the partition making practically all the HW compatible.

From it looks like this is supported already. I recall that we have used script metadata to selectively run some scripts and not others on certain machines at certain times, but I don’t recall the details, since we don’t have that hardware any more and don’t currently need custom scripts.


I understand that if I put one tag in a machine, if matches with the field tag defined in the script metadata, the script will run at the commissioning.

I want to have the ability to read all the tags from a commissioning script. Something like the the environment variables.

It will by easy, that maas creates a environmet varible named ‘MACHINE_TAGS’ with contains a list or a json. So with a bash or python script will be easy to read/process.

@adolfo94, iiuc, you want to build a series of if statements, based on machine tags; for each tag that is present, you want to run a certain script associated with that tag. do i understand you correctly?

Hi @billwear,

The objective it’s automatize the HW RAID creation. Actually we need to select which script we need when we commission a machine. This approach isn’t optimal, because maas by default runs all commissioning script, so when we enlist a machine or re-commission it run all HW RAID creation script (which carries failed results).

The idea it’s launch a script when a machine has a specific tag, or read the machine tags so the script can select what do.

@adolfo94, not the answers you’re looking for but FYI you can add the commissioning script tag noauto so it won’t run automatically. There’s also the for_hardware field where you can select specific PCI devices such as RAID controllers.

1 Like

Old thread but still the same - I’m trying to run specific commissioning script for specific machine type. I’ve tried tagging machine and script, but it does not work. It was like:

Machine has tag “node”
commissioning script (41-xxxx) hast tags “node,noauto”

and while commissioning the 41-xxxx script is not started. When I remove “noauto” it is started for every machine, regardless of the tag. How can I start specific commissioning script for specific machine/group of machines?? I can’t find any good documentation for using tags, I would really appreciate someone’s help - thanks in advance.