I'm using chef-version [Chef: 10.14.4]. I would like to create several recipes, that read and write dynamic information to and from a databag about different services running on different servers.
Here's an example:
Or, is there any other way to do this?
You don't have to use databags to let one server to know about the other. Use search. You can search the nodes by attributes, recipes, tags and so on. In your case you can search for nodes that have your apache service in run list. If you get all 3 nodes as a result of search, then hopefully they have apache running.
If you still want/need to update databags from your recipe, see Creating and Editing Data Bags within a Recipe in Data Bags help.