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
0
votes
2 answers
Chef: How to set a user's password from an encrypted data bag
I am using Chef with kitchen (1.5.0) and vagrant (1.8.1) to manage a user consistently with a new server. My user recipe looks like this:
include_recipe "users"
group 'sudo'
password_secret =…

Jay Godse
- 15,163
- 16
- 84
- 131
0
votes
2 answers
"Flattening" a databag in Pig
Suppose I have a bunch of databags generated from a Pig UDF that holds several tuples of Strings. How can I pull all of them out of the databags and simple make each String its own "row" of data.
databags = FOREACH data GENERATE…

kk415kk
- 1,227
- 1
- 14
- 30
0
votes
1 answer
managing chef data bag easier and faster using knife command
Am I right in thinking that probably there is no option to change the value from the command line?
For example something like this:
knife data bag edit my_data_bag host1 ...action "upgrade"
So then second line will be changed from "remove" to…

laimison
- 1,409
- 3
- 17
- 39
0
votes
1 answer
How can I test for data_bag modifications in ChefSpec?
I have a recipe that modifies a DataBag value, and I'm trying to write a test for that. The relevant part of the recipe is:
def get_deployment_data(data_bag_name)
data_bag_item(data_bag_name, 'deployment')
end
# Update master data…

Andrew Cooper
- 32,176
- 5
- 81
- 116
0
votes
1 answer
AWS Opsworks where to put data_bag folder?
I am using AWS Opsworks with Chef 12 and custom cookbooks. I would like to use data_bags also, but I can't figure out where Opsworks looks for them.
If I add them the /var/chef/data_bags I can successfully run the recipes using chef-client…

Yonkee
- 1,781
- 3
- 31
- 56
0
votes
1 answer
Using chef-vault instead of data bag
Ohai chefs.
I wrote a definition that takes usename and password as parameters.
When used in a recipe with parameters fetched from a databag it works.
However it fails when fetching parameters from chef-vault
Here is the code using data…
0
votes
1 answer
Map a list into a type
I am trying to transform a list ["a","b","c","c"] into a set in haskell, say: [("a",1),("b",1),("c",2)]. I am not trying to use maps. My function looks like so:
-- bagMyItem
bagMyItem :: Eq g => [g] -> Bag g -> Bag g
bagMyItem (h:t) bag
| h==q…

Vlad Balanescu
- 664
- 5
- 27
0
votes
1 answer
Error while loading Chef data bag item, created via Chef code
I've two questions associated with the issue. (Resolved issue, solution provided below)
I'm having a data bag named, java. It contains the data bag item specific to each node's hostname, as shown below
id: node_hostname
java_config:
…

Saravanan G
- 581
- 1
- 9
- 26
0
votes
1 answer
How can I always keep encrypted data bags "encrypted"?
In one of my chef recipes, I am using encrypted data bags to do hide the download path for a remote file resource that I have defined.
However when converging on a node, if the download fails for whatever reason, then I can see all my secrets in…

Sergiu Vidrascu
- 1
- 2
0
votes
2 answers
Bulk remove databags from chef server?
I'm using a databag for package versions, e.g.
databags/
versions/
0.1.1
0.1.2
0.1.3
0.2.1
0.2.2
...
When the version becomes obsolete, I want to purge the old data bag items.
Is there a way to bulk delete the data bag…

Moshe Zvi
- 437
- 4
- 8
0
votes
3 answers
Chef Data_bag usage via Ruby Recipe error?
I have a Chef DataBag that I'm trying to read and use inside of a chef recipe, and its kicking my ass. Please note: I'm not a programmer, and the use of Chef is my first entry into Ruby.
Based off of the examples I've found online, here is the…

HeavyObjectLifter
- 87
- 5
0
votes
1 answer
Chef::DataBag and RSpec-mocks -- undefined method `recieve'
i am trying to create a list method stub for Chef::DataBag class as follows:
$ cat spec/spec_helper.rb
require "rspec"
RSpec.configure { |config|
config.mock_framework = :rspec
config.mock_with :rspec
}
$ cat spec/test_spec.rb
require…

Mr.
- 9,429
- 13
- 58
- 82
0
votes
0 answers
Not able to read data bag items in recipe
I am new to the chef framework. I want to keep some of my data values such as shared location path, username, password in databag (without encrypting) and refer them in a recipe rather than hard coding them, but when I refer to them in the recipe,…

Goutam
- 1
0
votes
1 answer
Access attributes for a databag using chef
I have a ruby script that references a databag's attributes. I would like to know if there is a way to reference databag attributes inside of a databag. Then, when i reference the databag attribute inside of my script, it would point me to another…

user3613443
- 13
- 3
0
votes
0 answers
Encrypted databags in chef-environments
We manage some critical information in encrypted databags, e.g. the ssl certificates: databags/ssl.
We'd prefer to only give a very limited set of people access to the secret that decrypts these encrypted databags to avoid having our private keys…

berkes
- 26,996
- 27
- 115
- 206