Public
Authored by Shawn Kwang

Rules for role classes

The rules for role classes Here are the rules for writing role classes:

  1. The only thing roles should do is declare profile classes with include. Don’t declare any component classes or normal resources in a role.
    • Optionally, roles can use conditional logic to decide which profiles to use. They can also include other role classes, as long as those roles obey these same rules.
  2. Roles should not have any class parameters of their own.
  3. Roles should not set class parameters for any profiles. (Those are all handled by data lookup.)
  4. The name of a role should be based on your business’s conversational name for the type of node it manages.

This means that if you regularly call a machine a “Jenkins master,” it makes sense to write a role named role::jenkins::master. But if you call it a “web server,” you shouldn’t use a name like role::nginx — go with something like role::web instead.

Edited
3 Bytes
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment