Chapter 13. Data Bags
As Figure 13-1 shows, Chef Server provides a way to store shared, global data between nodes using data bags.
A data bag is a container for items that represent information about your infrastructure that is not tied to a single node. Data bags contain information that needs to be shared among more than one node. For example:
- Shared passwords
- License keys for software installs
- Shared lists of users and groups
Chef provides no mechanism to share data between nodes, as shown in Figure 13-2.
And even though chef-client
does send a copy of the node attribute data to Chef Server after a successful Chef run, Figure 13-3 shows there is no way for other nodes to access this information directly.
Data bags are the only built-in mechanism Chef provides to store and access shared data between nodes.
Figure 13-4 shows what a data bag looks like. Each data bag contains a list of items. Each item is a JSON-formatted name-value pair collection expected to have exactly the same schema for every item in the data bag. However, the schema between two different data bags can differ. String values are quoted; integer values are not. Values can also contain lists of strings or integers as well.
Get Learning Chef now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.