How to manage machines

MAAS offers powerful tools to manage machines, from discovery and commissioning to deployment, configuration, and troubleshooting. This guide covers everything you need, whether working with bare metal servers, virtual machines, or pre-deployed systems.

Discover and find machines

Before managing machines, you need to discover, identify, and locate them.

Discover active devices

MAAS monitors network traffic to automatically detect connected devices, including machines, switches, bridges, and other network hardware.

UI
Networking > Network discovery

CLI

    maas $PROFILE discoveries read

Find a machine’s system ID

Everything in MAAS revolves around the system ID, which is easily located.

UI

  1. Machines > [machine]
  2. Check browser URL: ...machine/<SYSTEM_ID>/summary)

CLI

    maas admin machines read | jq -r '(["HOSTNAME","SYSID"] | (., map(length*"-"))),(.[] | [.hostname, .system_id]) | @tsv' | column -t

List machines

View all the machines in your MAAS instance.

UI
Machines (View list)

CLI

    maas $PROFILE machines read | jq -r '(["HOSTNAME","SYSID","STATUS"] | join(","))'

Related: Commission machines | Control power

Search for machines

Use MAAS search syntax to find specific machines.

UI
Hardware > *Machines > [Search bar] and enter a search term; MAAS updates the list dynamically.

Search syntax:

Type Example
Exact pod:=able-cattle
Partial pod:able,cattle
Negation pod:!cattle

CLI

    maas $PROFILE machines read | jq -r '(["HOSTNAME","SYSID","STATUS"] | join(","))'

Filter machines by parameters

UI
Hardware > Machines > Filters

MAAS dynamically builds search terms that you can mimic, copy and re-use.

Add & configure machines

Add a machine

To manually add a machine, provide architecture, MAC address, and power settings.

UI
Machines > Add hardware

CLI

    maas $PROFILE machines create architecture=$ARCH \
    mac_addresses=$MAC_ADDRESS power_type=$POWER_TYPE \
    power_parameters_power_id=$POWER_ID \
    power_parameters_power_address=$POWER_ADDRESS 
    power_parameters_power_pass=$POWER_PASSWORD

MAAS automatically commissions newly-added machines. To change this, enter:

    maas $PROFILE maas set-config name=enlist_commissioning value=false

Clone a machine

Quickly duplicate an existing machine’s configuration.

UI
Machines > [machine] > Take action > Clone*

CLI

    maas $PROFILE machine clone $SOURCE_SYSTEM_ID new_hostname=$NEW_HOSTNAME

Set power type

Set the correct power type so MAAS can control the machine.

UI
Machines > [machine] > Configuration > Power > Edit

CLI

    maas $PROFILE machine update $SYSTEM_ID power_type="$POWER_TYPE"

Verifying Redfish activation

You can check if a machine communicates via Redfish with the command:

    dmidecode -t 42

You can also review the 30-maas-01-bmc-config commissioning script’s output if the machine is already enlisted in MAAS.

Add LXD for VM hosts

LXD setup is straightforward.

Remove old LXD versions

    sudo apt-get purge -y *lxd* *lxc*
    sudo apt-get autoremove -y

Install & initialize LXD

    sudo snap install lxd
    sudo snap refresh
    sudo lxd init
  • Clustering: no
  • Storage: dir
  • MAAS Connection: no
  • Existing Bridge: yes (br0)
  • Trust Password: Provide a password

Disable DHCP for LXD’s bridge

    lxc network set lxdbr0 dns.mode=none
    lxc network set lxdbr0 ipv4.dhcp=false
    lxc network set lxdbr0 ipv6.dhcp=false

Add a VM HOST

UI

  1. KVM > LXD > Add LXD host > Enter Name, LXD address and select Generate new certificate
  2. Run the provided command in the terminal to add trust.
  3. Check authentication > Add new project | Select existing project > Save LXD host.

CLI

    maas $PROFILE vm-hosts create type=lxd power_address=$LXD_ADDRESS project=$PROJECT_NAME

Add VMs

UI
KVM > VM host name > Add VM > Name > Cores > RAM > Disks > Compose machine

CLI

    maas $PROFILE vm-host compose $VM_HOST_ID cores=4 memory=8G disks=1:size=20G

Move VMs between projects

    lxc move $VM_NAME $VM_NAME --project default --target-project $PROJECT_NAME

Remove VMs

UI
Machine > (Select machines) > Delete > Delete machine

CLI

maas $PROFILE machine delete $SYSTEM_ID

Control machine power

Turn on

UI
Machines > [machine] > Take action > Power on

CLI

maas $PROFILE machine start $SYSTEM_ID

Turn off

UI
Machines > [machine] > Take action > Power off

CLI

maas $PROFILE machine stop $SYSTEM_ID

Soft power-Off

maas $PROFILE machine stop $SYSTEM_ID force=false

Commission & test machines

Commission a machine

Required before deployment.

UI
Machines > [machine] > Take action > Commission

CLI

maas $PROFILE machine commission $SYSTEM_ID

Run tests

UI
Machines > [machine] > Take action > Test

CLI

maas $PROFILE machine test $SYSTEM_ID tests=cpu,storage

View test results

UI
Machines > [machine] > Test results

CLI

maas $PROFILE machine read $SYSTEM_ID | jq '.test_results'

Override failed tests

UI
Machines > [machine] > Take action > Override test results

CLI

maas $PROFILE machine set-test-result $SYSTEM_ID result=passed

Deploy machines

Allocate a machine

Locks ownership to the user who allocates it.

UI
Machines > [machine] > Take action > Allocate

CLI

maas $PROFILE machines allocate system_id=$SYSTEM_ID

Deploy a machine

UI
Machines > [machine] > Take action > Deploy

CLI

maas $PROFILE machine deploy $SYSTEM_ID

Deploy as a VM host

UI
Machines > [machine] > Take action > Deploy > Install KVM

CLI

maas $PROFILE machine deploy $SYSTEM_ID install_kvm=True

Deploy with cloud-init config

UI
Machines > [machine] > Take action > Deploy > Configuration options

CLI

maas $PROFILE machine deploy $SYSTEM_ID cloud_init_userdata="$(cat cloud-init.yaml)"

Configure machine settings

Set kernel version

System-wide default:
UI
Settings > Configuration > Commissioning > Default minimum kernel version

CLI

maas $PROFILE maas set-config name=default_min_hwe_kernel value=$KERNEL

Per-machine kernel:
UI
Machines > [machine] > Configuration > Edit > Minimum kernel

CLI

maas $PROFILE machine update $SYSTEM_ID min_hwe_kernel=$HWE_KERNEL

Deploy with a specific kernel:
UI
Machines > [machine] > Take action > Deploy > Choose kernel

CLI

maas $PROFILE machine deploy $SYSTEM_ID distro_series=$SERIES hwe_kernel=$KERNEL

Set boot options

System-wide default:
UI
Settings > Kernel parameters

CLI

maas $PROFILE maas set-config name=kernel_opts value='$KERNEL_OPTIONS'

Configure storage layout

Default layout for all machines:
UI
Settings > Storage > Default layout

CLI

maas $PROFILE maas set-config name=default_storage_layout value=$LAYOUT_TYPE

Per-machine layout:
UI
Machines > [machine] > Storage > Edit layout

CLI

maas $PROFILE machine set-storage-layout $SYSTEM_ID storage_layout=$LAYOUT_TYPE

Rescue & recovery

Enter rescue mode

UI
Machines > [machine] > Take action > Enter rescue mode

CLI

maas $PROFILE machine enter-rescue-mode $SYSTEM_ID

SSH into a machine

ssh ubuntu@$MACHINE_IP

Exit rescue mode

UI
Machines > [machine] > Take action > Exit rescue mode

CLI

maas $PROFILE machine exit-rescue-mode $SYSTEM_ID

Mark a machine as broken

UI
Machines > [machine] > Take action > Mark broken

CLI

maas $PROFILE machines mark-broken $SYSTEM_ID

Mark a machine as fixed

UI
Machines > [machine] > Take action > Mark fixed

CLI

maas $PROFILE machines mark-fixed $SYSTEM_ID

Release or remove machines

Release a machine

UI
Machines > [machine] > Take action > Release

CLI

maas $PROFILE machines release $SYSTEM_ID

Erase disks on release

UI
Machines > [machine] > Take action > Release > Enable disk erasure options

CLI

maas $PROFILE machine release $SYSTEM_ID erase=true secure_erase=true quick_erase=true

Delete a machine

UI
Machines > [machine] > Take action > Delete

CLI

maas $PROFILE machine delete $SYSTEM_ID

Force delete a stuck machine

maas $PROFILE machine delete $SYSTEM_ID force=true

Verify everything

Check all machines

UI
Machines (View list or search)

CLI

maas $PROFILE machines read | jq -r '.[].hostname'

Last updated a day ago.