Skip to main content

Chef Infra Language: Node Tags

A tag is a custom description that is applied to a node. A tag, once applied, can be helpful when managing nodes using knife or when building recipes by providing alternate methods of grouping similar types of information.

Tags can be added and removed. Machines can be checked to see if they already have a specific tag. To use tags in your recipe simply add the following:


To test if a machine is tagged, add the following:


to return true or false. tagged? can also use an array as an argument.

To remove a tag:


For example:


if tagged?('machine')"Hey I'm #{node['tags']}")


unless tagged?('machine')'I am not tagged')

Will return something like this:

[Thu, 22 Jul 2010 18:01:45 +0000] INFO: Hey I'm machine
[Thu, 22 Jul 2010 18:01:45 +0000] INFO: I has no tagz
Edit this page on GitHub.

Thank you for your feedback!


Search Results