0.01
No commit activity in last 3 years
No release in over 3 years
This rubygem does not have a description or summary.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 0.14
 Project Readme

Chef Consul

Gem Version Build Status

Chef Consul is a Gem & Chef Recipe that includes extensions to chefs node object that allows easy interaction with consul leveraging Diplomat.

Installation

If you want to develop/hack on chef-consul, please see the CONTRIBUTING.md.

If you are using Berkshelf, add chef-consul to your Berksfile:

cookbook 'chef-consul'

Otherwise, you can use knife or download the tarball directly from the community site:

knife cookbook site install chef-consul

Usage

In order to use Chef Consul in your Chef Recipes, you'll first need to include it:

include_recipe 'chef-consul::default'

Alternatively you can put it in a base role or recipe and it will be included subsequently.

Requiring the Chef Consul Gem will automatically extend the node object with consul methods.

API

Note: For the most extensive API documentation, please see the YARD documentation.

Node

Additional methods for the node object

  • first_service(name) - fetch the first node in a service.
  • all_services(name) - fetch all nodes in a service.
  • get_consul_key(key, recursive = false) - return the value of a key in consul.
  • put_consul_key(key, value) - write a value to a key in consul

Examples

services = node.all_services('consul')
# => [#<OpenStruct Node="consul0", Address="1.2.3.4", ServiceID="consul", ServiceName="consul", ServiceTags=["consul"], ServicePort=8300>,#<OpenStruct Node="consul1", Address="1.2.3.5", ServiceID="consul", ServiceName="consul", ServiceTags=["consul"], ServicePort=8300>]
node.put_consul_key('test', 'value')
# => "value"

License & Authors

Copyright 2015 Sam Dunne

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

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.