I have a server managed by Chef. I need to access some values that live in a cookbook data bag from scripts not run by Chef.
/* Chef REST API allows to access data bag values as seen by Chef server. This is not what I want. Each chef-client run may introduce a number of coordinated changes, including changes in the data bag. If data on the server had already changed but chef-client did not run locally yet, local setup and server-side data bag may be out of sync. */
I see two solutions:
- Parse/import the data bag file under
/var/cache/chef/cookbooks/<book-name>since it's more or less normal Ruby. - Inside a recipe, dump relevant data from the data bag into a plain file accessible from my scripts.
Are there better options?