Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status


cluster-search (9) Versions 1.0.0

Library to help searching cluster nodes in Chef cookbooks

cookbook 'cluster-search', '= 1.0.0', :supermarket
cookbook 'cluster-search', '= 1.0.0'
knife supermarket install cluster-search
knife supermarket download cluster-search
Quality 100%

Cluster Search


Cluster Search (cluster-search) is a simple cookbook library which simplify
the search of members of a cluster. It relies on Chef search with a size guard
(to avoid inconsistencies during initial convergence) and allows a fall-back
to hostname listing if user does not want to rely on searches (because of
chef-solo for example).


First, call ::Chef::Recipe.send(:include, ClusterSearch) to be able to use
cluster_search in your recipe.

Then method cluster_search take one argument, a hash which could contain:

  • role and size to use search. Ex: { role: my_search, size: 2 }
  • or hosts to use a static list. Ex: { hosts: [ some_node ] }

If both are defined, hosts is used.

It returns the list of the members of a cluster hosts and current node ID
my_id for this cluster (or -1 it is not a member).

For search, we suppose that all members of a cluster have a common role in
their run-list. For instance, all zookeeper nodes of a dedicated cluster for
kafka could use role zookeeper-kafka. By defining role to
zookeeper-kafka and configuring size to the expected size of the cluster,
we can find all the cluster members.

We can find input/output examples (used for test cases) in file



  • Initial version, tested with full kitchen suites


None. Should work on any platform.



Implements cluster_search method.



Recipe used for testing.


You are more than welcome to submit issues and merge requests to this project.


Your commits must pass git log --check and messages should be formated
like this (based on this excellent

Summarize change in 50 characters or less

Provide more detail after the first line. Leave one blank line below the
summary and wrap all lines at 72 characters or less.

If the change fixes an issue, leave another blank line after the final
paragraph and indicate which issue is fixed in the specific format

Fix #42

Also do your best to factor commits appropriately, ie not too large with
unrelated things in the same commit, and not too small with the same small
change applied N times in N different commits. If there was some accidental
reformatting or whitespace changes during the course of your commits, please
rebase them away before submitting the PR.


All files must be 80 columns width formatted (actually 79), exception when it
is not possible.

License and Author

Copyright:: 2015, Sam4Mobile

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.

Dependent cookbooks

This cookbook has no specified dependencies.

Contingent cookbooks

aerospike-platform Applicable Versions
cassandra-platform Applicable Versions
cockroachdb-platform Applicable Versions
confluent-platform Applicable Versions
consul-platform Applicable Versions
docker-platform Applicable Versions
galera-platform Applicable Versions
glusterfs Applicable Versions
imply-platform Applicable Versions
iptables-services Applicable Versions
ping-exporter Applicable Versions
prometheus-platform Applicable Versions
rundeck-wrapper Applicable Versions
spark-platform Applicable Versions
storm-platform Applicable Versions
zookeeper-platform Applicable Versions

Foodcritic Metric

1.0.0 passed this metric