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


etcd (91) Versions 5.5.0

Installs and configures etcd

cookbook 'etcd', '= 5.5.0', :supermarket
cookbook 'etcd', '= 5.5.0'
knife supermarket install etcd
knife supermarket download etcd
Quality 83%

Etcd Cookbook

Build Status Cookbook Version

The Etcd Cookbook is a library cookbook that provides custom resources for use in recipes.


This cookbook is concerned with the Etcd distributed key/value store as distributed by CoreOS, Inc.


  • Chef 12.11+
  • Network accessible web server hosting the etcd binary.

Platform Support

The following platforms have been tested with Test Kitchen. It will most likely work on other platforms as well

|               | 3.2.15 |
| amazonlinux   |   X    |
| centos-6      |   X    |
| centos-7      |   X    |
| debian-8      |   X    |
| debian-9      |   X    |
| fedora        |   X    |
| ubuntu-14.04  |   X    |
| ubuntu-16.04  |   X    |
| opensuse-leap |   X    |

Cookbook Dependencies


  • Add depends 'etcd' to your cookbook's metadata.rb
  • Use the resources shipped in cookbook in a recipe, the same way you'd use core Chef resources (file, template, directory, package, etc).
etcd_service 'etcd0' do
  advertise_client_urls ''
  listen_client_urls ''
  initial_advertise_peer_urls ''
  listen_peer_urls ''
  initial_cluster_token 'etcd-cluster-1'
  initial_cluster 'etcd0=,etcd1=,etcd2='
  initial_cluster_state 'new'
  action :start
  ignore_failure true # required for the first cluster build

etcd_service 'etcd1' do
  advertise_client_urls ''
  listen_client_urls ''
  initial_advertise_peer_urls ''
  listen_peer_urls ''
  initial_cluster_token 'etcd-cluster-1'
  initial_cluster 'etcd0=,etcd1=,etcd2='
  initial_cluster_state 'new'
  action :start
  ignore_failure true

etcd_service 'etcd2' do
  advertise_client_urls ''
  listen_client_urls ''
  initial_advertise_peer_urls ''
  listen_peer_urls ''
  initial_cluster_token 'etcd-cluster-1'
  initial_cluster 'etcd0=,etcd1=,etcd2='
  initial_cluster_state 'new'
  action :start
  ignore_failure true

Test Cookbooks as Examples

The cookbooks ran under test-kitchen make excellent usage examples.

The test recipes are found at:


Resources Overview

  • etcd_service: composite resource that uses etcd_installation and etcd_service_manager
  • etcd_installation: automatically selects an installation method
  • etcd_service_manager: automatically selects a service manager
  • etcd_key: manages keys in etcd
  • etcd_installation_binary: copies a pre-compiled etcd binary onto disk
  • etcd_installation_docker: pulls a docker image to the DOCKER_HOST
  • etcd_service_manager_sysvinit: manage etcd daemon with a sysvinit script
  • etcd_service_manager_upstart: manage etcd daemon with upstart script
  • etcd_service_manager_systemd: manage etcd daemon with systemd unit files
  • etcd_service_manager_docker: starts a docker process on the DOCKER_HOST

Resources Details


The etcd_installation resource auto-selects one of the below resources with the provider resolution system. Defaults to binary installation.


etcd_installation 'default' do
  action :create


The etcd_installation_binary resource copies the precompiled Go binary onto the disk.


etcd_installation_binary 'default' do
  version '3.2.6'
  source ''
  checksum '90aff7364caa43932fd46974825af20e0ecb70fe7e01981e2d3a496106f147e7'
  action :create


The etcd_installation_docker resource uses the docker_image resource to pull an image to the DOCKER_HOST.


  • repo - The image name to pull. Defaults to ''
  • tag - The image tag to pull.
  • version - String used to calculate tag string when tag is omitted. Defaults to '2.3.7'


The etcd_service_manager resource auto-selects one of the below resources with the provider resolution system. The etcd_service family all share a common set of properties, which are listed under the etcd_service composite resource.


etcd startup behavior is a bit quirky. etcd loops indefinitely on startup until quorum can be established. Due to this the first nodes service start will fail unless all nodes come up at the same time. Due to this there is an ignore_failure property for the upstart / systemd service managers which allows you to continue on in the chef run if the service fails to start. Upstart / systemd will automatically keep restarting the service until all nodes are up and the cluster is healthy. For sys-v init you're on your own.


etcd_service_manager 'default' do
  action :start



etcd_service_manager_sysvinit 'default' do
  action :stop



etcd_service_manager_upstart 'default' do
  action :start


  • ignore_failure - Ignore failures starting the etcd service. Before quorum is established nodes will loop indefinitely and never successfully start. This can help ensure all instances are up when init systems can handle restart on failure. Default: false



etcd_service_manager_systemd 'default' do
  action :start


  • service_timeout - The time in seconds before the service start fails. Default: 120
  • ignore_failure - Ignore failures starting the etcd service. Before quorum is established nodes will loop indefinitely and never successfully start. This can help ensure all instances are up when init systems can handle restart on failure. Default: false



etcd_service_manager_docker 'default' do
  action :start


  • repo - defaults to ''
  • tag - default calculated from version
  • version - defaults to '3.2.15',
  • container_name - defaults to resource name
  • port - defaults to ['2379/tcp4:2379', '2380/tcp4:2380']
  • host_data_path - Path to store data locally on the host, which will be mounted into the container


The etcd_service: resource is a composite resource that uses etcd_installation and etcd_service_manager resources to install and manage the etcd service.

  • The :create action uses an etcd_installation
  • The :delete action uses anetcd_installation
  • The :start action uses an etcd_service_manager
  • The :stop action uses an etcd_service_manager

The service management strategy for the host platform is dynamically chosen based on platform, but can be overridden.


The etcd_service resource property list corresponds to the options found in

Etcd Configuration Flags documentation

Member properties
  • source
  • node_name
  • data_dir
  • wal_dir
  • snapshot_count snapshot to disk.
  • heartbeat_interval
  • election_timeout
  • listen_peer_urls
  • listen_client_urls
  • max_snapshots
  • max_wals
  • cors
  • quota_backend_bytes
Clustering properties
  • initial
  • initial_advertise_peer_urls
  • initial_cluster
  • initial_cluster_state
  • initial_cluster_token
  • advertise_client_urls
  • discovery
  • discovery_srv
  • discovery_fallback
  • discovery_proxy
  • strict_reconfig_check
  • auto_compaction_retention
  • enable_v2
Proxy properties
  • proxy
  • proxy_failure_wait
  • proxy_refresh_interval
  • proxy_dial_timeout
  • proxy_write_timeout
  • proxy_read_timeout
Security properties
  • cert_file
  • key_file
  • client_cert_auth
  • trusted_ca_file
  • auto_tls
  • peer_cert_file
  • peer_key_file
  • peer_client_cert_auth
  • peer_trusted_ca_file
  • peer_auto_tls
  • etcdctl_client_cert_file
  • etcdctl_client_key_file
Logging properties
  • debug
  • log_package_levels
Profiling properties
  • enable_pprof
  • metrics
Auth Flpropertiesags
  • auth_token
Unsafe properties
  • force_new_cluster
Misc properties
  • http_proxy
  • https_proxy
  • no_proxy
  • auto_restart


The etcd_key resource sets, watches and deletes keys in etcd.


  • The :set action sets a key
  • The :delete action deletes a key
  • The :watch action waits for a key to update
  • key - The key name
  • value - The desired value
  • ttl - The ttl for the key (optional)
  • host - The hostname of the etcd server, defaults to
  • port - The port that etcd is listening on, defaults to 2379


etcd_key "/test" do
  value "a_test_value"
  action :set


This cookbook is maintained by Chef's Community Cookbook Engineering team. Our goal is to improve cookbook quality and to aid the community in contributing to cookbooks. To learn more about our team, process, and design goals see our team documentation. To learn more about contributing to cookbooks like this see our contributing documentation, or if you have general questions about this cookbook come chat with us in #cookbok-engineering on the Chef Community Slack

Additional Contributors


Copyright | 2013, Jesse Nelson

Copyright | 2015-2017, Chef Software, Inc.

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.

etcd Cookbook CHANGELOG

This file is used to list changes made in each version of the etcd cookbook.

5.5.0 (2018-03-09)

  • Convert from HWRPs to standard custom resources which resolves several incompatibilities that occured with the upcoming Chef 14 release

5.4.0 (2018-03-09)

  • Default to 3.2.15
  • Make sure the service resource has a default action of :create
  • Fixed handling of cert based auth
  • Support storing data locally when using docker
  • Wire-up service_timeout property to systemd timeoutstartsec
  • Fix failing integration test
  • Remove the ChefSpec matchers that are autogenerated now. If you see ChefSpec failures the fix is upgrading ChefDK.

5.3.1 (2018-01-28)

  • Give etcd 120 seconds to start under systemd instead of the 60s default

5.3.0 (2018-01-13)

  • Update the default etcd from 3.2.6 to 3.2.14
  • Cleanup the test suites

5.2.1 (2017-12-02)

  • Remove the start/wait logic from sys-v
  • Fix checksum property on etcd_installation resource

5.2.0 (2017-09-11)

  • Several changes have been made to the cookbook to better allow for building up new etcd clusters. Since etcd will loop waiting for quorum forever processes never hand control back to the init system when the first node is being built. To workaround this I have removed the healthcheck script that was previously bundled and added the ability to continue on after failures. To not fail when the service fails to start add ignore_failure true to the service_manager resource declaration (see the example in the readme) and Chef will continue allowing the cluster to complete its build out.
  • Changed how the server_manager resources are declared to better support additional platforms that also use sys-v, upstart, or systemd. This gets us opensuse support, which is now part of the test matrix.
  • Add docker testing to the test kitchen and remove the duplicate installation tests
  • Fix new_resource error in the in etcd_service_manager_docker
  • Resolve a deprecation warning in etcd_service_manager_docker
  • Fix the etcd command to include the binary name in etcd_service_manage_docker

5.1.0 (2017-09-11)

  • Be less specific in the service resources so we can support any platform that is systemd, upstart or sys-v
  • Add that we support opensuse leap to the metadata / readme

5.0.0 (2017-09-05)

Breaking Changes

  • This cookbook has been refactored to work with etcd 3.X and now defaults to installing 3.2.6. 2.x will not work as many new configuration properties have been added to etcd. If you need support for etcd 2.x you should pin the 4.X release of this cookbook.
  • This cookbook now longer requires compat_resource and also utilizes the systemd_unit resource in Chef. Due to this the cookbook now requires Chef 12.11 or later.
  • The execute provider for the etcd_service has been removed as Chef should not be used as an init system. There is now fully functional sys-v, upstart, and systemd support, which are preferred alternatives.

Other Changes

  • Listening ports in examples, tests, and resources have been updated for the new ports used by etcd
  • Integration testing has been updated to InSpec
  • The default path to the data dir is now an absolute path to resolve some previous issues
  • All Chef 14 deprecation warnings have been resolved
  • Remove the only_if on the service start that could potentially prevent the service from starting
  • Sync up the unit file with the upstream format recommended by the project
  • Fix faulty logfile logic in the upstart / sys-v scripts that prevented these resources from ever working

4.1.0 (2017-08-20)

  • Fixing some deprecation warnings

4.1.0 (2016-10-10)

  • suse is systemd not sysv
  • Require Chef 12.1+ and the latest compat_resource
  • Define custom matchers helpers for Chefspec


  • Install etcd 2.3.7 by default
  • Install tar to ensure we can decompress the etcd package
  • Replace testing of Ubuntu 15.10 with 16.04
  • Fix testing in Test Kitchen using vagrant
  • Add a Gemfile with testing dependencies
  • Update the compat_resource dependency from 12.5 to 12.10 to bring in the latest fixes
  • Add chef_version metadata to the metadata.rb file


  • Added Redhat, Oracle Linux, and Scientific Linux to the metadata
  • Fixed issues_url and source_url in the metadata to point to the correct URL
  • Added license to the metadata
  • Updated Rakefile so testing tasks match other Chef cookbooks
  • Add maintainers files and Rake task to generate the markdown


  • Added support for Scientific / Oracle Linux 6.X
  • Fixed readme badges
  • Added a chefignore file
  • Add contributing and testing docs
  • Removed Ruby 2.2 via RVM install from the Travis CI runs


  • Retrying key operations


  • Using converge_if_changed in :set action


  • Adding etcd_key resource
  • Removing unused property previous_state
  • Adding desired_state: false to various properties


  • Adding etcd_key resource


  • Fix redirecting stderr to stdout in upstart manaager


  • Fix timeout pattern in systemd-wait-ready


  • Fixing up docker service manager tests


  • Fixing incorrectly named classes in service managers


  • Fixing wait-ready script to use etcdctl_cmd


  • Adding docker to etcd_service


  • Supporting run_user on service manager resources


  • New major version, non-backwards compatible with 2.x.x
  • Rewritten as Custom Resources
  • Defaulting to etcd version 2.2.2


  • update to etcd 0.4.6
  • adds debian support


  • update to etcd 0.4.5
  • Add centos 7 support
  • Support centos cloud images without tar
  • Dry out compile time recipe
  • Move to berks3


  • update to etcd 0.4.2
  • Removed node[:etcd][:local] No longer needed in new etcd. Etcd will default bind :4001 and :7001.
  • The cookbook default is now to use node[:ipaddress] as the addr and peer_addr.
  • add auto-respawn instruction in upstart config file
  • Fix Gem deps in the ci build


  • add peer and peer_addr support / attributes
  • add name attribute and computation
  • fixup cmdline argument computation
  • ensure cluster members are always sorted
  • fix spec tests


  • fix bug in cluster recipe where Resolv was spelled wrong
  • fix kitchen test on cluster to pickup this issue.
  • add basic chefspec as well to ensure this sort of issue doesn't occur
  • fix bug with name attribute methods
  • fix searching for wrong recipe when using cluster recipe


  • update to etcd 0.3.0
  • Add support for new discovery mode
  • refactor common functions into library methods
  • Add specs
  • Use rubocop to replace tailor/cane
  • Fixup testing (add travis integration)


  • update to etcd 0.2.0
  • remove name_switch attribute. It was marked for deprication in 1.3
  • enable snapshotting by default
  • add optional local listener
  • support chef-solo
  • Add support of explicitely specifying a cluster's nodes


  • silence foodcritic by accessing attributes in a consistent manner,
  • trigger a restart when etcd conf is updated
  • include git if source install
  • metadata depends on git recipe
  • Update Documentation
  • Update contributors


  • fix compile_time to use the right tarball path


  • Bump to etcd 1.2
  • Added source install recipe


  • default binding to node[:ipaddress]


  • update to etcd 0.1.1 release
  • add compile_time recipe that does the whole bit in chef compile time


  • hotfix to add missing node[:etcd][:env_scope] attribute
  • bugfix: use node[:fqdn] instead of hostname when matching local machine name


  • add cluster recipe for setting up clusters of etcd nodes
  • re-add seed-node attribute


  • fix the startup args so it is easier to specify custom args
  • supports release version and current master on git
  • add in tests for both release and git versions of etcd


  • Make everything work with release 0.1.0 of etcd
  • fixup some syntax issues


  • move binary install to using coreos/etcd releases from github
  • for now the install locattion is fixed to /usr/local and links in /usr/local/bin
  • Use ark for managing tarballs
  • move bats tests to using etcdctl instead of curl

Collaborator Number Metric

5.5.0 passed this metric

Contributing File Metric

5.5.0 passed this metric

Foodcritic Metric

5.5.0 passed this metric

No Binaries Metric

5.5.0 failed this metric

Failure: Cookbook should not contain binaries. Found:

Testing File Metric

5.5.0 passed this metric

Version Tag Metric

5.5.0 passed this metric