Tutorial: Try the MAAS CLI

Errors or typos? Topics missing? Hard to read? Let us know.

This tutorial will walk you through the basics of the MAAS CLI.

Log in

  1. Fetch your API key: Generate your unique key with the following command:
    maas apikey --username=$MAAS_USER > api-key
  1. Login: Use your API key to authenticate:
    maas login admin http://<maas.domain>:5240/MAAS/api/2.0/ < api-key

Configure MAAS

  1. Set the DNS forwarder: If it’s your first time, set up DNS forwarding:
    maas $MAAS_USER maas set-config name=upstream_dns value=
  1. Import Ubuntu images: Again, if new, pull in Ubuntu images:
    maas $MAAS_USER boot-resources import

Manage nodes

  1. Enlist a node: Add a new machine to MAAS:
    maas $MAAS_USER machines create architecture=amd64 \
      power_type=virsh mac_addresses=52:54:00:00:00:01
  1. Review status: Confirm the node’s state:
    maas $MAAS_USER machines read | jq '.[].status_name' 
  1. Commission a node: Prepare the node for deployment:
    maas $MAAS_USER machine commission <node_id>
  1. Acquire a node: Claim the commissioned node:
    maas $MAAS_USER machines allocate system_id=<id>
  1. Deploy a node: Execute the deployment:
    maas $MAAS_USER machine deploy <id>

Connect nodes

  1. Fetch a node’s IP: Retrieve the IP of a deployed node:
    lxc list
  1. Gain SSH access: Just log in as ubuntu.

  2. File transfer: Use scp for transferring files, and apply your customisations.

Explore more

@billwear, I’m sure you are aware, but just a heads up that the UI and CLI snap pages all refer to installing with apt.

Issue with markdown formatting of hyperlink

Location in document - Importing images section

What should fix it up

Looks like the markdown formatting for the hyperlink to the main jq GitHub repository is broken. Changing the markdown formatting of the hyperlink should help fix it up:


If you use the above markdown formatting, the hyperlink will look like this: jq

thanks, @nuccitheboss! nice catch. sometimes those slip through.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.

I just noticed that it seems there’s some HTML-related artifacts in the current post. Specifically, I see &lt; and &gt; references in the code. This partially breaks the tutorial.