# MAAS

> A MAAS resource handler connects Cloud Management Platform (CMP) to Canonical Metal as a Service (MAAS) and provisions physical machines, or virtual machines on MAAS VM hosts

---

Site [llms.txt](/llms.txt)

---

Each imported MAAS zone becomes a CMP environment. For a physical server, CMP asks MAAS to allocate a Ready machine that meets the order's requirements, then deploys the chosen image to it. [MAAS server selection](/docs/cmp/configure/infrastructure/resource-handlers/maas/server-selection/) explains how machines and VM hosts are chosen.

## Before you begin

- A MAAS user account for CMP, with a username and password.
- An SSH key pair, with the public key added to that MAAS account so that MAAS installs it on the machines it deploys.
- Network access from CMP to the MAAS region controller.

## Add a MAAS resource handler

1. Go to **Admin** > **Resource Handlers**, select **Add**, then select **MAAS**.
1. Complete the credentials fields described below, then select **Continue**. CMP checks the connection at this point.
1. Enter a **Name**, and optionally a **Description** and **VM Names to Ignore**, then select **Done**.

| Field | Description |
| --- | --- |
| **Region Controller** | The host name or IP address of the MAAS region controller. |
| **Protocol** | **https** is recommended and selected by default. Select **http** if HTTPS is not enabled on the region controller. |
| **Port** | The port the MAAS API listens on. The dialog opens with `443`; change it if you change the protocol. MAAS serves HTTP on port `5240` by default. |
| **Account username** | The username of the MAAS account for CMP. |
| **Password** | The password for that account. |
| **SSL Verification** | Whether CMP verifies the region controller's SSL certificate. If the certificate is self-signed or issued by a private certificate authority, see [SSL root certificates](/docs/cmp/configure/access-and-security/security/ssl-root-certificates/). |

## Import locations

A new handler has no environments until you import a location. Locations are MAAS availability zones, and CMP creates one environment for each selected zone.

1. On the handler, open the **Locations** tab and select **Import Locations**.
1. Select zones, then select **Import selected locations**.

To add another environment for an imported zone, select the plus icon beside it and select **Create**.

## Import images

An environment cannot provision until an image is imported and linked to it. CMP imports the operating system images available in MAAS.

1. On the handler, open the **Images** tab and select **Import Images**.
1. Select images, then select **Import selected Images**.
1. In the **OS Build Environments** column, select the edit icon for an image, choose the environments that may use it, then select **Save changes**.

## Import networks

CMP imports MAAS subnets as networks, so that orders can request them.

1. On the handler, open the **Networks** tab and select **Import Networks**.
1. Select subnets, then select **Import selected networks**.
1. Add the networks to each environment that should offer them.

For a physical server, MAAS allocates only a machine that already has an interface on every network the order requests.

## Add SSH key material

CMP runs scripts on a MAAS server over SSH, with the private key that matches the key selected under **Key pair name** for that server. Upload each private key to CMP once.

1. On the handler, open the **SSH Keys** tab. It lists the keys that the handler's environments offer under **Key pair name**.
1. Select the edit icon for the key.
1. Paste the full private key, then select **Save**. This replaces any stored material for that key.

CMP reads the account's keys from MAAS when an environment is created. If you add a key to the MAAS account later, refresh the list on each environment's **MAAS Parameters** tab by selecting the import icon in the **Key pair name** row.

For accepted key formats, see [Key material](/docs/cmp/configure/access-and-security/security/ssh-keys/).

## Sync and manage servers

To bring existing MAAS machines into CMP, open the handler's **Servers** tab and select **Sync VMs from** followed by the handler's name. The **Dry-run Sync VMs from** button beside it previews the sync without making changes.

From CMP, you can power MAAS servers on and off, and reboot them.

<div class="alert alert-danger" role="alert">


Deleting a MAAS server in CMP deletes a virtual machine. A physical machine is released back to MAAS, and its disks are securely erased.
</div>


## Related

- [SSH keys](/docs/cmp/configure/access-and-security/security/ssh-keys/): how CMP stores and uses private key material.

---

Section pages:

- [MAAS parameters](/docs/cmp/configure/infrastructure/resource-handlers/maas/parameters/): MAAS parameters set where a Cloud Management Platform (CMP) order is placed in MAAS, which machines qualify for it, and whether it becomes a physical machine or a virtual machine
- [MAAS server selection](/docs/cmp/configure/infrastructure/resource-handlers/maas/server-selection/): For each MAAS order, Cloud Management Platform (CMP) either asks MAAS to allocate a physical machine that meets the order's requirements or creates a virtual machine on a MAAS VM host
