A data bag is JSON's data format global variable that is used as an index for search queries and is accessible from the Chef server. Data bag is loaded through recipes and most of the time, it contains secured information, such as passwords.
Data bag is very good for securing secret information because data bag can be encrypted easily.
The knife data bag
subcommand is used to create, delete, edit, list, and show data bags.
The create
argument creates a data bag on the Chef server:
knife data bag create <<DATA_BAG_NAME>> [DATA_BAG_ITEM] (options)
The following is a screenshot of the verification of a data bag creation on the Hosted Chef server:
We can also create a data bag from the dashboard of the hosted Chef server. Go to Policy, click on Data Bags, and select Create Item.
We can also create an item associated with a data bag from the dashboard of the hosted Chef server.
The create
argument deletes a data bag from the Chef server:
knife data bag delete <...