Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms


chef-secrets (3) Versions 0.2.1

Installs/Configures chef-vault with helpers

cookbook 'chef-secrets', '= 0.2.1'
cookbook 'chef-secrets', '= 0.2.1', :supermarket
knife cookbook site install chef-secrets
knife cookbook site download chef-secrets

chef-secrets cookbook

This cookbook aims to ease chef-vault interaction by providing additional helpers, and testing the functionality on a Linux and Windows box.

More info about chef-vault:

Usage pattern (with wrapper cookbooks)

Let us say you are using a cookbook that requires you to set a password in an attribute. This attribute is usually set in a wrapper cookbook which includes the original cookbook. By including this cookbook as well, you can set the attribute in the wrapper cookbook's attribute file like this: ruby secret['cookbook']['password'] = chef_vault_item_or_default('vault', 'item') This will set the attribute default['cookbook']['password'] to the item from the vault. It will also set the attribute to SECRET at the end of the Chef run, therefore ensuring that the Chef Server will not contain the password in plaintaxt. If the item in the vault does not exist it will fail.

If you would like to default to a value in a testing environment, you can do: ```ruby fallback = 'fallback' if node.chef_environment == 'test'

secret['cookbook']['password'] = chef_vault_item_or_default('vault', 'item', fallback) ```

Secret attributes


Secret attributes are node attributes that are available only during the Chef run, but set to SECRET when saved and uploaded to the Chef Server. These attributes are actually default node attributes set through a helper method, so you may access them as you would access any default node attribute.


Set a secret in cookbook attributes: ruby secret['cookbook']['password'] = 'SuperSecretPassword' Read it anywhere like a default node attribute: ruby"This is my password: #{node['cookbook']['password']}") Note: Please don't accidentally save your secrets in the Chef log file :)

Call stack

When called with this syntax ruby secret['cookbook']['password'] = 'SuperSecretPassword' actually calls ruby chef_secret_attribute_set(['cookbook', 'password'], 'SuperSecretPassword') which in turn sets ruby default['cookbook']['password'] = 'SuperSecretPassword' and will be cleared at the end by ruby chef_secret_attribute_clear(['cookbook', 'password']) which sets ruby default['cookbook']['password'] = 'SECRET'

Additional chef-vault helpers


Get an item from the vault, or default to value if if the vault or item does not exist. If the default value is not specified, it will fail the Chef run. ruby chef_vault_item_or_default('vault', 'item', 'default')


Return true if item is a vault item. Note that unlike ChefVault::Item.vault?, this method returns false if the data bag does not exist. ruby chef_vault_item_is_vault?('vault', 'item')

Bundling Chef Vault

This cookbook bundles the chef-vault gem so that it may be used immediately at compile time in attributes. The bundled chef-vault gem is the one tracked in a submodule in /ext/chef-vault. To upgrade please checkout the appropriate commit in the submodule and run ext/ to copy the newest files into the libraries directory. This is required so that one may set vault items in attributes.

Dependent cookbooks

chef-vault >= 0.0.0

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

Foodcritic Metric

0.2.1 passed this metric