Metal As A Service is software which allows you to deal with physical hardware just as easily as virtual nodes. MAAS lets you treat physical servers like virtual machines in the cloud. Rather than having to manage each server individually, MAAS turns your bare metal into an elastic cloud-like resource. Specifically, MAAS allows for services to be deployed to bare metal via Juju. For more information about MAAS, see maas.ubuntu.com.
Note: This version of Juju (1.25.x), is only compatible with versions of MAAS up to and including 1.9. To support later versions of MAAS, please upgrade Juju to a more recent version.
To enable Juju to work with MAAS, you should start by generating a generic configuration file using the command:
This will generate a file,
environments.yaml, which, for Linux, will live in
~/.juju/ directory (and will create the directory if it doesn't already
You'll need an API key from MAAS so that the Juju client can access it. Each user account in MAAS can have as many API keys as desired. One hard and fast rule is that you'll need to use a different API key for each Juju environment you set up within a single MAAS cluster.
To get the API key:
- Go to your MAAS preferences page, or go to your MAAS home page and choose Preferences from the drop-down menu that appears when clicking your username at the top-right of the page.
- Optionally add a new MAAS key. Do this if you're setting up another environment within the same MAAS cluster.
- Copy the key value - you will need it shortly!
Create or modify
environments.yaml with the following content:
maas: type: maas maas-server: 'http://<my-maas-server>:80/MAAS' maas-oauth: 'MAAS-API-KEY'
Substitute the API key from earlier into the
MAAS_API_KEY slot. You may need
to modify the
my-maas-server setting too; if you're running from the maas
package it should be something like "http://hostname.xxxx.yyy/MAAS".
It is also useful to add your SSH keys to the configuration, as MAAS will then be able to automatically add them to each unit. This may be done simply by adding the following option to the config:
...or point to any other appropriate key file.
An admin password will be generated when you try and bootstrap the Juju instance. This can optionally be specified in the configuration:
The default series for MAAS will automatically be set to 'precise'. You can override this setting by adding the optional configuration:
Juju automatically detects MAAS networks, and recognises physical and
virtual networks on each machine.
juju status will show the discovered
networks. See Juju Constraints and Deploying
Services to learn how to select machines with networks
and enable the networks for use.
Juju recognises MAAS-controlled hostnames. You can use the hostname when bootstrapping the state-server on a specific machine and add existing MAAS-controlled machines to the Juju environment. For example:
juju bootstrap --to <hostname> juju add-machine <hostname>
MAAS 1.8 introduced a new feature called "devices". This allows the association of a "device", that requires an IP address, with a parent machine managed by MAAS. There is a view in the MAAS UI showing all devices.
With the "address-allocation" feature flag enabled, Juju will register LXC and KVM containers as devices on MAAS 1.8+. They are visible in the MAAS UI. If the environment is forcibly shut down, the IP addresses allocated to the containers will be released by MAAS.
You can enable "address-allocation" in new Juju environments like so:
For further information on using Juju with MAAS, see the MAAS and Juju Quick Start guide.
See General config options for additional and advanced customization of your environment.