Read machine tags from commissioning scripts

Hi,

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 https://maas.io/docs/commissioning-scripts-reference 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.

2 Likes

Hi,
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.