This article will show you:
How to discover the ID of your network interface
You can use a command of the following form to identify the interfaces associated with a particular device on your MAAS:
maas $PROFILE interfaces read $SYSTEM_ID \
| jq -r '(["mac_address","type","id","tags"]
|(.,map(length*"-"))),(.[]|[.mac_address,.type,.id,.tags[]])
|@tsv'| column -t
For example:
maas admin interfaces read xn8taa \
| jq -r '(["mac_address","type","id","tags"]
|(.,map(length*"-"))),(.[]|[.mac_address,.type,.id,.tags[]])
|@tsv'| column -t
This would produce output similar to the following:
mac_address type id tags
----------- ---- -- ----
00:16:3e:18:7f:ee physical 9 andrpko plinko cochise
How to assign tags to a network interface
To assign a tag to a network interface, using both the device system ID and the interface ID, use a command of the following form:
maas $PROFILE interface add-tag $SYSTEM_ID $INTERFACE_ID tag=$TAG_NAME
For example:
maas admin interface add-tag xn8taa 9 tag=farquar
This command, if successful, will produce a long sequence of JSON describing the interface, including the changes introduced by the command above. You can also check your work by listing the tags associated with the device.
How to remove tags from a network interface
To remove a tag from a network interface, use both the device system ID and the interface ID in a command similar to this one:
maas $PROFILE interface remove-tag $SYSTEM_ID $INTERFACE_ID tag=$TAG_NAME
For example:
maas admin interface remove-tag xn8taa 9 tag=farquar
This command, if successful, will produce a long sequence of JSON describing the interface, including the changes introduced by the command above. You can also check your work by listing the tags associated with the device.
How to list tags for all network interfaces
To list all the tags for a given network interface on a given device, use a command like this one:
maas $PROFILE interfaces read $SYSTEM_ID \
| jq -r '(["mac_address","type","id","tags"]
|(.,map(length*"-"))),(.[]|[.mac_address,.type,.id,.tags[]])
|@tsv'| column -t
For example:
maas admin interfaces read xn8taa \
| jq -r '(["mac_address","type","id","tags"]
|(.,map(length*"-"))),(.[]|[.mac_address,.type,.id,.tags[]])
|@tsv'| column -t
This would produce output similar to the following:
mac_address type id tags
----------- ---- -- ----
00:16:3e:18:7f:ee physical 9 andrpko plinko cochise farquar
How to view tags for one network interface
To view tags for one particular network interface on a specific device, try a command formulated like this:
maas $PROFILE interface read $SYSTEM_ID $INTERFACE_ID \
| jq -r '(["mac_address","type","id","tags"]
|(.,map(length*"-"))),([.mac_address,.type,.id,.tags[]])
|@tsv'| column -t
For example:
maas admin interface read xn8taa 9 \
| jq -r '(["mac_address","type","id","tags"]
|(.,map(length*"-"))),([.mac_address,.type,.id,.tags[]])
|@tsv'| column -t
Typical output might look like this:
mac_address type id tags
----------- ---- -- ----
00:16:3e:18:7f:ee physical 9 andrpko plinko cochise