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
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
juju add-cloud --local
Example user session:
Cloud Types lxd maas manual openstack vsphere Select cloud type: maas Enter a name for your maas cloud: maas-cloud Enter the API endpoint url: http://10.55.60.29:5240/MAAS 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 ‘http://10.55.60.29:5240/MAAS’.
Confirm the addition of the cloud with the
clouds --local command (just
clouds on versions prior to
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:
clouds: devmaas: type: maas auth-types: [oauth1] endpoint: http://devmaas/MAAS testmaas: type: maas auth-types: [oauth1] endpoint: http://172.18.42.10/MAAS prodmaas: 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
add-cloud command only operates locally (there is no
The Credentials page offers a full treatment of credential management.
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.
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.
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: