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.3.0

Library to help searching cluster nodes in Chef cookbooks

cookbook 'cluster-search', '= 1.3.0', :supermarket
cookbook 'cluster-search', '= 1.3.0'
knife supermarket install cluster-search
knife supermarket download cluster-search
Quality 20%

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 any listing if user does not want to rely on searches (because of
chef-solo for example).


None. Should work on any platform.


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

Then method cluster_search take one argument and an optional block.
The argument is 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.
  • Size check can be deactivated by not setting it or setting it to zero. It is not recommended to disable it when searching for sibling as it can cause configuration fluctuations during cluster convergence (first node of the cluster to run Chef will find only itself, then two nodes, etc.).

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). By default (no block
passed), the hosts result is a list of FQDN, extracted with node['fqdn'].
By passing the block { |n| n['ipaddress'] }, you will get the list of IP
addresses. And so on.

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



Implements cluster_search method.



Recipe used for testing.




Please read carefully []( before making a merge

License and Author

Copyright (c) 2015-2016 Sam4Mobile, 2017

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




  • #4: deactivate size check if size is undefined or set to zero
  • #3: allow passing a block to apply on results to output ipaddresses or else


  • use .gitlab-ci.yml template [20170529]
  • add build_pull to download latest image


  • add chef_version 12.14 & centos in metadata
  • foodcritic: fix license format in metadata
  • use karma for git format in contributing



  • issue #1: search nodes within the same environment


  • Use kitchen-docker_cli instead of kitchen-docker
  • Use continuous integration with gitlab-ci
  • Up-to-date kitchen.yml (image, no preparation, always use latest deps, etc.)
  • Use gitlab-ci config template (20170202)


  • Use cookbook_name alias instead of cluster_search
  • Handover maintenance to chef-platform group, change urls and maintainer


  • Fix markdown in changelog



  • Switch kitchen driver to docker_cli
  • Fix all rubocop offenses
  • Add Apache 2 License file
  • Move changelog and contributing section from README to external files
  • Clean headers


  • Initial version, tested with full kitchen suites

Collaborator Number Metric

1.3.0 failed this metric

Failure: Cookbook has 1 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric

1.3.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of, and your repo must contain a file

License Metric

1.3.0 passed this metric

Testing File Metric

1.3.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of, and your repo must contain a file

Version Tag Metric

1.3.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of, and your repo must include a tag that matches this cookbook version number