diff --git a/.kitchen.yml b/.kitchen.yml
index 5b72bbcd..e55d087d 100644
--- a/.kitchen.yml
+++ b/.kitchen.yml
@@ -43,3 +43,10 @@ suites:
consul:
serve_ui: true
client_interface: eth0
+ - name: cluster
+ run_list:
+ - recipe[consul::default]
+ attributes:
+ consul:
+ service_mode: cluster
+ bootstrap_expect: 1
diff --git a/README.md b/README.md
index 837ebcc7..f872db40 100644
--- a/README.md
+++ b/README.md
@@ -48,8 +48,14 @@ Installs and configures [Consul][1].
['consul']['service_mode'] |
String |
- Mode to run consul as: bootstrap, server, or client |
+ Mode to run consul as: bootstrap, cluster, server, or client |
bootstrap |
+
+
+ ['consul'][bootstrap_expect] |
+ String |
+ When bootstrapping a cluster, the number of server nodes to expect. |
+ nil |
['consul']['data_dir'] |
diff --git a/metadata.rb b/metadata.rb
index 7f33ff63..ce1cf1bb 100644
--- a/metadata.rb
+++ b/metadata.rb
@@ -4,7 +4,7 @@
license 'Apache v2.0'
description 'Installs/Configures consul'
long_description 'Installs/Configures consul'
-version '0.4.1'
+version '0.4.2'
recipe 'consul', 'Installs and starts consul service.'
recipe 'consul::install_binary', 'Installs consul service from binary.'
diff --git a/recipes/_service.rb b/recipes/_service.rb
index 3ddb20b5..3e5dce74 100644
--- a/recipes/_service.rb
+++ b/recipes/_service.rb
@@ -19,6 +19,7 @@
# Configure directories
consul_directories = []
+consul_directories << node['consul']['data_dir']
consul_directories << node['consul']['config_dir']
consul_directories << '/var/lib/consul'
@@ -64,11 +65,19 @@
# Determine service params
service_config = {}
service_config['data_dir'] = node['consul']['data_dir']
+num_cluster = node['consul']['bootstrap_expect'].to_i
case node['consul']['service_mode']
when 'bootstrap'
service_config['server'] = true
service_config['bootstrap'] = true
+when 'cluster'
+ service_config['server'] = true
+ if num_cluster > 1
+ service_config['bootstrap_expect'] = num_cluster
+ else
+ service_config['bootstrap'] = true
+ end
when 'server'
service_config['server'] = true
service_config['start_join'] = node['consul']['servers']