O'Reilly logo

Configuration Management with Chef-Solo by Naveed ur Rahman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Attributes

Attributes are defined in a cookbook and then used to override the default settings on a machine. When chef-client executes, it loads all the recipes and checks for all the attributes in a node. Attributes defined in a cookbook take precedence over the default attributes. The chef-client applies new settings and values accordingly on a new node.

The order of the attributes' precedence is mentioned as follows:

  • A default attribute declared in cookbook attributes
  • A default attribute declared in a recipe
  • A default attribute declared in an environment
  • A default attribute declared in a role

Now, we will create a database name in our attributes/default.rb file and use it in the mysql_server resource:

# wpblog/recipes/default.rb Default.wpblog.database ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required