Home ~ Start Here ~ Computers ~ Communication ~ Organization ~ Family Photos

MAAS from the CLI

Table of Contents

MAAS: Install ~ Configure ~ DHCP ~ Commission ~ Deploy ~ jq ~ SSH ~ More jq

Installing MAAS via the command line

I really want to write docs and create doc tools, and Canonical pays me to do those things for the MAAS project. I'd really like to share some things with you, off the clock, because I enjoy doing it.

In this sequence, I'm going to configure MAAS via the command-line only. MAAS has a really nice UI that's super-easy to use, and a CLI backed by a REST API. I'd really like to try to see how much I can do, and how far I can get, using just the CLI.
So my goals for this project are simple: run MAAS through its paces using only the CLI and take good notes.

Installing MAAS is a CLI thing, anyway

It starts with installation. I'm doing this experiment on my largest laptop, wintermute (named after the character in Neuromancer). I mention that only because you'll sometimes see that hostname behind the prompt in the examples below.

Let's be naive and start from first installation. I've cleared MAAS off wintermute, as well as PostgreSQL, so I can try a true, out of box experience. I haven't cleaned off libvirt or any of my KVMs I've got on here, nor the bridge I created to network them, because I use those for other things -- and because it's reasonable to expect that someone who's looking at MAAS would have some kind of virtual machine capability around already.

So starting at the top of the MAAS 2.8 install instructions, I'm going to first "install (but not initialize) the MAAS snap":

Looking over my MAAS initialisation modes, I see that region+rack mode will do fine for this install, as I don't have to add the complexity of separate rack controllers just yet. I can do that later, if I get that far. But it's not quite time to initialise, though; I need to make a decision whether I want a production install or just a proof-of-concept setup. I've already removed PostgreSQL so that I can choose either one.

Production postgres

For now, I think I'm going with the production configuration (more to see and do), and that starts with a local PostgreSQL install, from packages. And, like most Debian installs, that starts with an update, to grab any packages that might need to be available for the install to succeed:

Then I can install PostgreSQL, probably version 12 or something like that:

Yep, version 12. I like keeping up. Anyway, now I need to set up a PostgreSQL user:

And create a suitable MAAS database:

Note that there's no system response (the old UNIX rule of "no news is good news"). Next, I need to add the database to the PostgreSQL HBA configuration, by editing `/etc/postgres/12/main/pghba.conf', adding a line to the bottom of the file:

Initialising MAAS

Finally, I can initialise MAAS, like this:

This command offers me a bit of important feedback, the MAAS URL, which will be needed for the CLI login. That's followed by a running commentary on the steps MAAS is taking to start up. It all ends with the following admonition:

Well, that's an easy call. Let me just run <code>createadmin</code> real quick:


Next, I'm going to try getting MAAS configured with the CLI. Should be fun!

Copyright (C) 2020-2023 by Stormrider.
All rights reserved.