MAAS 3.1 has been released. Find out what’s new in 3.1.

How to use controller tags

This article will show you:

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

How to create and assign controller tags

To create and assign a controller tag, you can use the following procedure:

  • Click on the “Controllers” tab to open the controllers page:

  • Click on the hyperlinked name of the controller to which you want to assign tags. You will see a screen with several cards, like this one:

  • Find the “Tags” card and click on “Edit.” You will be brought to that controller’s “Configuration” tab.

  • Click on the “Edit” button for “Controller configuration.”
    You’ll be presented with an editing screen similar to this one:

How to remove and delete controller tags

To remove (and possibly delete) a controller tag, you can use the following procedure:

  • Click on the “Controllers” tab to open the controllers page:

  • Click on the hyperlinked name of the controller to which you want to assign tags. You will see a screen with several cards, like this one:

  • Find the “Tags” card and click on “Edit.” You will be brought to that controller’s “Configuration” tab.

  • Click on the “Edit” button for “Controller configuration.”
    You’ll be presented with an editing screen similar to this one:

How to view controller tags

To view a list of tags assigned to a particular controller, you can use the following procedure:

  • Click on the “Controllers” tab to open the controllers page:

  • Click on the hyperlinked name of the controller of interest… You will see a screen with several cards, like this one:

  • Find the “Tags” card; this card will list all the tags assigned to this controller.

Last updated 18 days ago.