Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Configuration Management with Chef-Solo

You're reading from  Configuration Management with Chef-Solo

Product type Book
Published in Jun 2014
Publisher
ISBN-13 9781783982462
Pages 116 pages
Edition 1st Edition
Languages
Author (1):
Naveed ur Rahman Naveed ur Rahman
Profile icon Naveed ur Rahman
Toc

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 = 'wpblog'
# Replace the name of database with attribute, now final resource will look like this:
   mysql_database node['wpblog']['database'] do
   connection (
:host => 'localhost',
:username => 'root',
:password =>	node['mysql']['server_root_password...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime