Using controller tags
Seize control of your MAAS region and rack controllers by getting under the hood with tags. Whether you want to classify, search, or just organise, tags provide a versatile means to do it all.
Controller tags with the CLI
- How to discover the ID of your region controller(s)
- How to assign tags to a region controller
- How to remove tags from a region controller
- How to list tags for all region controllers
- How to view tags for one region controller
- How to discover the ID of your rack controller(s)
- How to assign tags to a rack controller
- How to remove tags from a rack controller
- How to list tags for all rack controllers
- How to view tags for one rack controller
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
- How to remove and delete controller tags
- How to view controller tags
How to create and assign controller tags
To create and assign a controller tag:
-
Select Controllers.
-
Select the controller you wish to update.
-
Select Configuration.
-
Select Controller configuration >> Edit.
-
Select the Tags field.
-
Enter a new tag(s) to assign it to the controller.
-
Select Save changes to register your new tag(s).
How to remove and delete controller tags
To remove (and possibly delete) a controller tag:
-
Select Controllers.
-
Select the controller you wish to update.
-
Select Configuration.
-
Select Controller configuration >> Edit.
-
Select the Tags field.
-
Select the X on the tag name to delete it.
-
Select Save changes to register your changes.
How to view controller tags
-
Select Controllers.
-
Select the controller you wish to update.
-
Select Configuration.
-
View the tags for this controller under the Tags row.
-
Select Cancel to dismiss this screen.
Last updated a month ago.