Using MAAS with Juju

MAAS treats physical servers (or KVM guests) as a public cloud treats cloud instances.

The Juju 2.x series is compatible with both the 1.x and 2.x series of MAAS.

Adding a MAAS cloud

Use the add-cloud command to interactively add your MAAS cloud to Juju’s list of clouds. You will need to supply a name you wish to call your cloud and the unique MAAS API endpoint.

For the manual method of adding a MAAS cloud, see below section Manually adding MAAS clouds.

To interactively add a cloud definition to the local client cache (just add-cloud on versions prior to v.2.6.1):

juju add-cloud --local

Example user session:

Cloud Types

Select cloud type: maas

Enter a name for your maas cloud: maas-cloud

Enter the API endpoint url:

Cloud "maas-cloud" successfully added

You will need to add credentials for this cloud (`juju add-credential maas-cloud`)
before creating a controller (`juju bootstrap maas-cloud`).

We’ve called the new cloud ‘maas-cloud’ and used an endpoint of ‘’.

Confirm the addition of the cloud with the clouds --local command (just clouds on versions prior to v.2.6.1).

Manually adding MAAS clouds

This example covers manually adding a MAAS cloud to Juju (see Adding clouds manually for background information). It also demonstrates how multiple clouds of the same type can be defined and added.

The manual method necessitates the use of a YAML-formatted configuration file. Here is an example:

    type: maas
    auth-types: [oauth1]
    endpoint: http://devmaas/MAAS
    type: maas
    auth-types: [oauth1]
    type: maas
    auth-types: [oauth1]
    endpoint: http://prodmaas/MAAS

Adding a cloud manually can be done locally or, since v.2.6.1, remotely (on a controller). Here, we’ll show how to do it locally (client cache).

This defines three MAAS clouds and refers to them by their respective region controllers.

To add clouds ‘devmaas’ and ‘prodmaas’, assuming the configuration file is maas-clouds.yaml in the current directory, we would run:

juju add-cloud --local devmaas maas-clouds.yaml
juju add-cloud --local prodmaas maas-clouds.yaml

In versions prior to v.2.6.1 the add-cloud command only operates locally (there is no --local option).

Adding credentials

The Credentials page offers a full treatment of credential management.

Use the add-credential command to interactively add your credentials to the new cloud:

juju add-credential maas-cloud

Example user session:

Enter credential name: maas-cloud-creds

Using auth-type "oauth1".

Enter maas-oauth:

Credentials added for cloud maas-cloud.

We’ve called the new credential ‘maas-cloud-creds’. When prompted for ‘maas-oauth’, you should paste your MAAS API key. It will not be echoed back to the screen.

Typically you will have a MAAS user of your own. The MAAS API key can be found on your user preferences page in the MAAS web UI, or by using the MAAS CLI, providing you have sudo access:

sudo maas-region apikey --username=$PROFILE

Where $PROFILE is to be replaced by the MAAS username.

Creating a controller

You are now ready to create a Juju controller for cloud ‘maas-cloud’:

juju bootstrap maas-cloud maas-controller

Above, the name given to the new controller is ‘maas-controller’. MAAS will allocate a node from its pool to run the controller on.

For a detailed explanation and examples of the bootstrap command see the Creating a controller page.

Next steps

A controller is created with two models - the ‘controller’ model, which should be reserved for Juju’s internal operations, and a model named ‘default’, which can be used for deploying user workloads.

See these pages for ideas on what to do next:

Last updated 2 months ago. Help improve this document in the forum.