Offline docs (switch to live docs)                         UI-only  CLI-only 

Using controller tags

Controller tags help in larger MAAS instances

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

If you have a large MAAS network, with multiple region and rack controllers, controller tags can help you classify, search, and organise them. This article is divided into two major sections:

Controller tags don't vary at all by MAAS version.

Controller tags with the CLI

How to discover the ID of your region controller(s)

You can discover the ID of your region controller(s) with the following command:

maas $PROFILE region-controllers read \
| jq -r '(["name","id"]
|(.,map(length*"-"))),(.[]|[.hostname,.system_id])
| @tsv' | column -t

For example:

maas admin region-controllers read \
| jq -r '(["name","id"]
|(.,map(length*"-"))),(.[]|[.hostname,.system_id])
| @tsv' | column -t

Typical output would look something like this:

name                         id
----                         --
bill-Lenovo-Yoga-C740-15IML  86xya8

How to assign tags to a region controller

To add tags to a region controller, you can use a command of this form:

maas $PROFILE tag update-nodes $TAG_NAME add=$SYSTEM_ID

If you need to find the ID of your region controller(s), you can look it up.

For example:

maas admin tag update-nodes virtual add=86xya8

This command produces output similar to the following:

Success.
Machine-readable output follows:
{
    "added": 1,
    "removed": 0
}

You can check your work by listing all tags for your region controllers.

How to remove tags from a region controller

To remove tags from a region controller, you can use a command like this:

maas $PROFILE tag update-nodes $TAG_NAME remove=$SYSTEM_ID

If you need to find the ID of your region controller(s), you can look it up.

For example:

maas admin tag update-nodes virtual remove=86xya8

This command produces output similar to the following:

Success.
Machine-readable output follows:
{
    "added": 0,
    "removed": 1
}

You can check your work by listing all tags for your region controllers.

How to list tags for all region controllers

To list tags for all region controllers, you can use a command similar to this:

maas $PROFILE region-controllers read | jq -r '(["hostname","sysid","tags"]|(.,map(length*"-"))),(.[]|[.hostname,.system_id,.tag_names[]]) | @tsv' | column -t

For example:

maas admin region-controllers read | jq -r '(["hostname","sysid","tags"]|(.,map(length*"-"))),(.[]|[.hostname,.system_id,.tag_names[]]) | @tsv' | column -t

This will produce output something like this:

hostname                     sysid   tags
--------                     -----   ----
bill-Lenovo-Yoga-C740-15IML  86xya8  virtual  lxd-vm-host

How to view tags for one region controller

To view tags for a specific region controller, you can try a command like this:

maas $PROFILE region-controller read $SYSTEM_ID | jq -r '(["hostname","sysid","tags"]|(.,map(length*"-"))),([.hostname,.system_id,.tag_names[]]) | @tsv' | column -t

If you need to find the ID of your region controller(s), you can look it up.

For example:

maas admin region-controller read 86xya8 \
| jq -r '(["hostname","sysid","tags"]
|(.,map(length*"-"))),([.hostname,.system_id,.tag_names[]])
| @tsv' | column -t

This should produce output similar to the following:

hostname                     sysid   tags
--------                     -----   ----
bill-Lenovo-Yoga-C740-15IML  86xya8  virtual  lxd-vm-host

How to discover the ID of your rack controller(s)

You can discover the ID of your rack controller(s) with the following command:

maas $PROFILE rack-controllers read \
| jq -r '(["name","id"]
|(.,map(length*"-"))),(.[]|[.hostname,.system_id])
| @tsv' | column -t

For example:

maas admin rack-controllers read \
| jq -r '(["name","id"]
|(.,map(length*"-"))),(.[]|[.hostname,.system_id])
| @tsv' | column -t

Typical output would look something like this:

name                         id
----                         --
bill-Lenovo-Yoga-C740-15IML  86xya8

How to assign tags to a rack controller

To add tags to a rack controller, you can use a command of this form:

maas $PROFILE tag update-nodes $TAG_NAME add=$SYSTEM_ID

If you need to find the ID of your rack controller(s), you can look it up.

For example:

maas admin tag update-nodes virtual add=86xya8

This command produces output similar to the following:

Success.
Machine-readable output follows:
{
    "added": 1,
    "removed": 0
}

You can check your work by listing all tags for your rack controllers.

How to remove tags from a rack controller

To remove tags from a rack controller, you can use a command like this:

maas $PROFILE tag update-nodes $TAG_NAME remove=$SYSTEM_ID

If you need to find the ID of your rack controller(s), you can look it up.

For example:

maas admin tag update-nodes virtual remove=86xya8

This command produces output similar to the following:

Success.
Machine-readable output follows:
{
    "added": 0,
    "removed": 1
}

You can check your work by listing all tags for your rack controllers.

How to list tags for all rack controllers

To list tags for all rack controllers, you can use a command similar to this:

maas $PROFILE rack-controllers read | jq -r '(["hostname","sysid","tags"]|(.,map(length*"-"))),(.[]|[.hostname,.system_id,.tag_names[]]) | @tsv' | column -t

For example:

maas admin rack-controllers read | jq -r '(["hostname","sysid","tags"]|(.,map(length*"-"))),(.[]|[.hostname,.system_id,.tag_names[]]) | @tsv' | column -t

This will produce output something like this:

hostname                     sysid   tags
--------                     -----   ----
bill-Lenovo-Yoga-C740-15IML  86xya8  virtual  lxd-vm-host

How to view tags for one rack controller

To view tags for a specific rack controller, you can try a command like this:

maas $PROFILE rack-controller read $SYSTEM_ID | jq -r '(["hostname","sysid","tags"]|(.,map(length*"-"))),([.hostname,.system_id,.tag_names[]]) | @tsv' | column -t
'''

If you need to find the ID of your rack controller(s), you can [look it up](#heading--discover-the-id-of-your-rack-controllers).

For example:

```nohighlight
maas admin rack-controller read 86xya8 \
| jq -r '(["hostname","sysid","tags"]
|(.,map(length*"-"))),([.hostname,.system_id,.tag_names[]])
| @tsv' | column -t

This should produce output similar to the following:

hostname                     sysid   tags
--------                     -----   ----
bill-Lenovo-Yoga-C740-15IML  86xya8  virtual  lxd-vm-host

Controller tags with the UI

How to create and assign controller tags

To create and assign a controller tag:

  1. Select Controllers.

  2. Select the controller you wish to update.

  3. Select Configuration.

  4. Select Controller configuration >> Edit.

  5. Select the Tags field.

  6. Enter a new tag(s) to assign it to the controller.

  7. Select Save changes to register your new tag(s).

How to remove and delete controller tags

To remove (and possibly delete) a controller tag:

  1. Select Controllers.

  2. Select the controller you wish to update.

  3. Select Configuration.

  4. Select Controller configuration >> Edit.

  5. Select the Tags field.

  6. Select the X on the tag name to delete it.

  7. Select Save changes to register your changes.

How to view controller tags

  1. Select Controllers.

  2. Select the controller you wish to update.

  3. Select Configuration.

  4. View the tags for this controller under the Tags row.

  5. Select Cancel to dismiss this screen.