Add custom commissioning scripts

Add custom commissioning scriptsΒΆ

Using MAAS, you can extend the default commissioning logic with additional user-defined scripts. Each defined script will be applied to a VM commissioning by default.

For example, to set custom NIC names that are oneXX for a 1 GB Ethernet and tenXX for a 10 GB Ethernet, refer to the following procedures.

In the examples below, the default 00-maas-05-simplify-network-interfaces script from the salt-formulas-maas package is used. The script is located on the Salt Master node in the /srv/salt/env/prd/maas/files/commisioning_scripts/ directory.

To automatically add the commissioning script using Salt:

  1. Prepare a script for commissioning and save it on the MAAS control node, which is located on the Salt Master node. For example, use the default script from the salt-formulas-maas package.

  2. Enable automatic importing of the script by defining it in /srv/salt/reclass/classes/cluster/<CLUSTER_NAME>/infra/maas.yml:

    ...
    parameters:
      maas:
        region:
          commissioning_scripts:
            00-maas-05-simplify-network-interfaces: /etc/maas/files/commisioning_scripts/00-maas-05-simplify-network-interfaces
          machines:
     ...
    

    Caution

    The commissioning script name is important. If you have several scripts, they will run in the alphanumeric order depending on their name.

  3. Run the following command:

    salt-call -l debug --no-color maas.process_commissioning_scripts
    

    Example of system response:

    ...
    local:
    ----------
    errors:
        ----------
    success:
        - 00-maas-05-simplify-network-interfaces
    

    The script 00-maas-05-simplify-network-interfaces is uploaded to MAAS from the /etc/maas/files/commisioning_scripts/ directory.

After the importing is done, proceed with commissioning depending on your use case as described in Provision physical nodes using MAAS.

To clean up old software RAID:

If you re-install the operating system on the nodes where the software RAID was set up and was not correctly removed, MAAS may encounter the problem while attempting to provision the system. Therefore, you may want to enable the cleanup commissioning script before you proceed with the comissioning of such a hardware node.

Note

The cleanup commissioning script is not included in MAAS by default.

Caution

If the cleanup commissioning script is allowed, it erases all data located on the disks.

To enable the cleanup commissioning script, select from the following options:

  • Enable the script through the Reclass model:

    1. Log in to the Salt Master node.

    2. Open the cluster level of your Reclass model.

    3. Define the script:

      parameters:
        maas:
          region:
            commissioning_scripts:
              00-maas-01-disk-cleanup: /etc/maas/files/commisioning_scripts/00-maas-01-disk-cleanup
            ...
      
    4. Apply the change:

      salt -C 'I@maas:region' maas.process_commissioning_scripts
      
  • Define the script through the MAAS web UI as described in Upload procedure in the official MAAS documentation.

After the script is enabled, proceed with commissioning depending on your use case as described in Provision physical nodes using MAAS.

To manually add the commissioning script using the MAAS web UI:

  1. Log in to the MAAS web UI through salt_master_management_address/MAAS with the following credentials:

    • Username: mirantis
    • Password: r00tme
  2. Go to the Settings tab.

  3. Scroll to Commissioning scripts.

  4. Click Upload script to chose a file for uploading. For example, use the default script from the salt-formulas-maas package.

    Caution

    The commissioning script name is important. If you have several scripts, they will run in the alphanumeric order depending on their name.

After the importing is done, proceed with commissioning depending on your use case as described in Provision physical nodes using MAAS.