Skip to content

Instantly share code, notes, and snippets.

@kwilczynski
kwilczynski / check.md
Last active July 6, 2023 08:35
Recipe / Role check in Chef

If you want to check whether a node run_list includes a specific role (upon expansion), then you could use role? method on the Node object:

node.role?('name')

Alternatively, you can see whether either would work for you:

node.roles.include?('name')

node.run_list?('role[name]')