I was trying to create a Chef data bag from within the chef-repo directory using the command:
knife data bag create users deployer
And i get the response:
Created data_bag[users]
Created data_bag_item[deployer]
But I am not able to locate the data bag users nor its data bag item. It is not in the data_bags folder or anywhere else that I could see. If I do a
knife data bag show users
It will show me the data bag item name. So it must be saved somewhere. The documentations tell me that the data bag should be in the folder chef-repo -> data_bags -> users. But my data_bags folder appears to be empty. So where is the data bag I have just created?
With Chef, there's a disparity between your local computer (called the "workstation") and the remote Chef Server. In your case, the knife
command created the data bag on the remote Chef Server.
I understand how that can be misleading. A data bag is nothing more than a folder containing one or more .json
files. Usually you generate this structure manually on your workstation (either using the GUI or terminal).
So in your example, just make the folder you've described (chef-repo -> data_bags -> users
) and then create a chef-repo/data_bags/users/deployer.json
file using the schema described by the cookbook.