A data bag is a global variable that is stored as JSON data and is accessible from a Chef Server. A data bag is indexed for searching and can be loaded by a recipe or accessed during a search. The contents of a data bag can vary, but they often include sensitive information (such as database passwords).
Questions tagged [databags]
83 questions
2
votes
2 answers
Chef Cookbook Compilation Error While Bootstrapping The Node
I am using chef to bootstrap a node. I have created encrypted data bags and copied the secret key on the node as /etc/chef/encrypted_data_bag_secret.
When I try to bootstrap the node, I am getting the following…

Noman Amir
- 933
- 3
- 15
- 30
1
vote
1 answer
[chef]: View all available data bags on a node
In our organization, the devs are being given ownership to own the cookbooks. The cookbooks were initially written by the ops guys. I am a java guy and not a chef/ruby/ops expert. I have been given a task to debug an issue where the cookbook is not…

user674669
- 10,681
- 15
- 72
- 105
1
vote
1 answer
Chef delay attribute assignment via data bag
So i have a bit of a pickle.
I have an encrypted data bag to store LDAP passwords. In my node run list, one of my recipes installs the secret key onto my client machine.
In my problematic cookbook, i have a helper (in /libraries) that pulls data…

Dexirian
- 515
- 3
- 15
1
vote
2 answers
How to have a cron script that should call chef-databag to get username and password every time it runs?
I have a cronjob which executes a python script. python script takes two parameter username and pass.
for example : execute.py vijay hTbY87
Requirement is to take this username and pass from dataBag i have in chef.
My instance where i need to run…

Rahul Kumar
- 13
- 1
- 4
1
vote
1 answer
array of hash in Chef databags?
I am trying to include array-of-hash data in a chef databag item. Is this supported? I keep getting error messages about an undefined method. Here's an example:
Databag item:
{
"id": "BurgerKing",
"sandwich": "Whopper",
…

Andrew Campbell
- 13
- 4
1
vote
1 answer
How do I download a chef data bag
I am trying to download an entire data bag item with all the json files contained within it from my chef server but the knife download command does not seem to work. I have tried:
knife download my_databag_name
but this returns nothing in the…

Riaz Abed
- 27
- 1
- 5
1
vote
1 answer
Chef node cannot load data bag item because public key encryption issues
I have a new VM I just built. It has been bootstrapped with the same cookbooks as all the other nodes. They can load this data bag just fine. The new VM cannot.
Stacktrace error ::
/usr/bin/chef-client:57:in `load'
/usr/bin/chef-client:57:in…

Carl_Friedrich_Gauss
- 173
- 3
- 15
1
vote
2 answers
Using multiple recipes in same cookbook
I have a chef cookbook with four recipes. Each recipe configures a web application:
myCookbook
|
|_ _ recipes
|_ _ default.rb
|_ _ app1.rb
|_ _ app2.rb
|_ _ app3.rb
|_ _ app4.rb
I've configured this cookbook…

mywoes123
- 23
- 4
1
vote
0 answers
Ridley create databag using json file
I'm having hard time to create data bags using ridley gem. My json file looks like below
{
"name": "users",
"json_class": "Chef::DataBagItem",
"chef_type": "data_bag_item",
"data_bag": "databag_name",
"raw_data": {
"id": "users",
…

Ram
- 324
- 1
- 4
- 21
1
vote
0 answers
How to specify a data bag path in knife.rb configuration file?
I have data bags specific to different clients like the following:
/data_bags/client1/users/....
/data_bags/client1/projects/....
/data_bags/client2/users/...
/data_bags/client2/projects/...
So, client1 and client2 have a different set of projects…

Starx
- 77,474
- 47
- 185
- 261
1
vote
2 answers
How to read an encrypted data bag in a chef recipe?
I'm trying to read an encrypted data bag from a chef recipe but I'm experiencing some problems.
I created the secret in this way
openssl rand -base64 512 > test/integration/default/encrypted_data_bag_secret
knife data bag from file test…

Mikyjpeg
- 1,179
- 1
- 13
- 39
1
vote
1 answer
Is it possible to set data bag values from inside a Chef recipe?
Is it possible to set data bag values from inside a chef recipe? I need gather some information from one particular node, and then share it with another node. I want to do it inside a cookbook instead of manually by using knife.

perigee
- 9,438
- 11
- 31
- 35
1
vote
2 answers
How do I refresh a chef vault's client list and remove nodes not matched by the search query?
I have a chef_vault with a search_query of role:myrole.
I want the chef server to periodically refresh the search query for the vault adding new nodes and removing any nodes that no longer have the role applied to them.
To test this a applied the…

red888
- 27,709
- 55
- 204
- 392
1
vote
1 answer
Storing master token in Chef data bag
I am generating a master token in Chef using the execute resource as below:
execute "extract_consul_key" do
command "consul keygen "
end
I want to store output of this command in a databag.
Please let me know what steps do I need to setup an…

meallhour
- 13,921
- 21
- 60
- 117
1
vote
2 answers
data_bag_item to retrieve single keyvalue
I just started playing with chef today, and one thing I can't wrap my head around is how I can use data bags to store multiple key-values in one item (1 bag > 1 item > many key-values) and be able to invoke them one by one within a recipe.
Here is a…

BubbleWrap
- 11
- 3