diff --git a/.kitchen.yml b/.kitchen.yml index c010d20a..b8b5ee3c 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -23,6 +23,9 @@ suites: - name: default run_list: - recipe[consul::default] + attributes: + consul: + datacenter: FortMeade - name: ui run_list: - recipe[consul::default] diff --git a/README.md b/README.md index 2c10fa03..a4306d9c 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,45 @@ Ubuntu 12.04, 14.04 Consul servers to join [] + + ['consul']['bind_addr'] + String + address that should be bound to for internal cluster communications + 0.0.0.0 + + + ['consul']['datacenter'] + String + Name of Datacenter + dc1 + + + ['consul']['domain'] + String + Domain for service lookup dns queries + .consul + + + ['consul']['log_level'] + String + + The level of logging to show after the Consul agent has started. + Available: "trace", "debug", "info", "warn", "err" + + info + + + ['consul']['node_name'] + String + The name of this node in the cluster + hostname of the machine + + + ['consul']['advertise_addr'] + String + address that we advertise to other nodes in the cluster + Value of bind_addr + ### Consul UI Attributes diff --git a/recipes/service.rb b/recipes/service.rb index f3334a52..a3635774 100644 --- a/recipes/service.rb +++ b/recipes/service.rb @@ -22,6 +22,15 @@ service_config[:client_addr] = node[:consul][:client_addr] end +copy_params = [ + :bind_addr, :datacenter, :domain, :log_level, :node_name, :advertise_addr +] +copy_params.each do |key| + if node[:consul][key] + service_config[key] = node[:consul][key] + end +end + directory node[:consul][:config_dir] template '/etc/init.d/consul' do diff --git a/test/integration/default/serverspec/localhost/consul_spec.rb b/test/integration/default/serverspec/localhost/consul_spec.rb index ae3f1c27..195742db 100644 --- a/test/integration/default/serverspec/localhost/consul_spec.rb +++ b/test/integration/default/serverspec/localhost/consul_spec.rb @@ -23,3 +23,16 @@ it { should be_listening } end end + +describe command "consul members" do + it { should return_exit_status 0 } + it { should return_stdout /\balive\b/ } + it { should return_stdout /\brole=consul\b/ } + it { should return_stdout /\bbootstrap=1\b/ } +end + +describe "config file attributes" do + context command "consul members" do + it { should return_stdout /\bdc=FortMeade\b/ } + end +end