MAAS treats physical servers (or KVM guests) as a public cloud treats cloud instances.
Starting with juju v.3.0
, versions of MAAS <2 are no longer supported.
Contents:
Add a MAAS cloud
There are two methods to define a cloud for Juju.
- Use an interactive prompt
- Define a YAML file
Both methods make use of the juju add-cloud
command. You will need to supply a name you wish to call your cloud and the unique MAAS API endpoint.
To access detailed help about all of its options, use this command:
juju help add-cloud
What does --local do?
Using the --local
option instructs Juju to store the cloud definition on the machine that you’re executing the command from.
Omitting it will store the cloud definition on the controller machine. This enables controllers to control models on multiple clouds, but isn’t recommended while you are creating your first model.
Use an interactive prompt
Using the add-cloud
command without providing its name or an API endpoint will begin an interactive session.
juju add-cloud --local
Example user session specifying maas-cloud
as the cloud name and http://10.55.60.29:5240/MAAS
as its API endpoint :
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
.
Define a YAML file
The manual method makes use of configuration files defined in YAML. To define a configuration file that mimics the parameters provided by the interactive example, use this:
clouds: # clouds key is required.
maas-cloud: # cloud's name
type: maas
auth-types: [oauth1]
endpoint: http://10.55.60.29:5240/MAAS
Assuming that we’ve saved this YAML snippet as maas-cloud.yaml
, adding it to Juju looks like this:
juju add-cloud --local maas-cloud maas-cloud.yaml
Add multiple clouds from the same file
A single configuration file can define multiple clouds. They can be loaded into Juju one at a time.
Here is an example defines that three MAAS clouds, devmaas
, testmaas
and prodmaas
:
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
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 testmaas maas-clouds.yaml
juju add-cloud --local prodmaas maas-clouds.yaml
See the Adding clouds manually page for further information.
Confirm that you’ve added the cloud correctly
Ask Juju to report the clouds that it has registered:
juju clouds --local
Add credentials
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.
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 apikey --username=<username>
For more information about credentials, read through the Credentials page.
Confirm that you’ve added the credentials correctly
To view the credentials that Juju knows about, use the credentials
command and inspect both remote and locally stored credentials:
juju credentials
juju credentials --local
Bootstrap a controller
You are now ready to create a Juju controller for maas-cloud
:
juju bootstrap maas-cloud
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 and Configuring Controllers pages.