Home

Awesome

consul-template

Latest Version Build Status Coverage Status

Installs and configures consul-template.

Supported Platforms

Attributes

Additionally, the contents of the node['consul_template']['config'] hash will be reflected into the default configuration file -- /etc/consul-template.d/default.json.

Recipes

default

Installs and configures consul-template using the install method specified in node['consul_template']['install_method'].

install_binary

Installs consul-template using one of the binaries provided by Hashicorp. It will also verify the checksum. The default attributes includes the latest version's binaries for all supported OS/architectures, including their checksum.

install_source

Installs consul-template from source.

service

Installs and configures the consul-template service.

LWRP

consul_template_config

Creates configuration files in node['consul_template']['config_dir'], and reloads the configuration.

For example, if you want to generate HAProxy's config using consul-template, you may include something like this in your recipe:

consul_template_config 'haproxy' do
  templates [{
    source: '/etc/haproxy/haproxy.cfg.ctmpl',
    destination: '/etc/haproxy/haproxy.cfg',
    command: 'service haproxy restart'
  }]
  notifies :reload, 'service[consul-template]', :delayed
end

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Adding checksums for new versions

The attributes/checksums.rb file contains checksums for the current and past consul-template versions. A quick and easy contribution you can make is to update it when a new version of consul-template is released, as I'm not always paying attention to when new versions come out.

In order to make this as easy and straightforward as possible, there is a helper script (scripts/generate-checksums) that takes a version number, and returns a pre-formatted list of the checkums (e.g. using version 0.10.0):

$ scripts/generate-checksums 0.10.0
Generating checksums for v0.10.0
'consul-template_0.10.0_darwin_386' => 'fb39f978f0e24175b7daee1f884e5299b11eb3a0689c37c7e96a26f9cadcbd77',
'consul-template_0.10.0_darwin_amd64' => '178e8e59d2e380440ac5582fb7f49c946ff931c1589ac85258d7dba82aefaabe',
'consul-template_0.10.0_freebsd_386' => '981b73d6547658d96bc5f2125dcc4161879c5c60c6eca3fa98b4a914f9f96581',
'consul-template_0.10.0_freebsd_amd64' => '0738c0887bb7ac2a879735ab61ea213ee042b5f53b27c6d26d4aa11f2bc6874a',
'consul-template_0.10.0_freebsd_arm' => '0488f76d3d0ca4b81ae807dfe7724b22380087adb5a4a49e73676095959e9f3c',
'consul-template_0.10.0_linux_386' => 'f9926eac99eb60ee1379e6f15a1d8240e96aa9076372914387005c8475d1e561',
'consul-template_0.10.0_linux_amd64' => 'ef298a2ae54cf51dbfc4108194299a9055b252ff9b917e7dd40c72fa30820096',
'consul-template_0.10.0_linux_arm' => '753b10added292b8873694d0f7905c4ddd62dd6bd3115f866ea5eee902d98f7c',
'consul-template_0.10.0_netbsd_386' => 'e1a6d759a91a2fa316af276c28643825727cd40ac214d12395ccfbbfad075f72',
'consul-template_0.10.0_netbsd_amd64' => '99a7cf3b3bb62968d99d627dc4419f584330484826b3e87f0bfcbe5b5d208c4b',
'consul-template_0.10.0_netbsd_arm' => 'da81d8bfbcb230e8492129dc0d2c5d50e1db651efdce355ec9697f20d8442b2a',
'consul-template_0.10.0_openbsd_386' => '7672b647c9af37e04513ddd4103856644361d20a8ab2a57ea0178f421db01a31',
'consul-template_0.10.0_openbsd_amd64' => 'af978a312dbae326e5aab2566d8a2549aae2910986580e4895fa276fffa98513',
'consul-template_0.10.0_windows_386' => '6611d9aa5bd9ae39d93690cbedb2bc8b57427dfe5a79774346292903282b698f',
'consul-template_0.10.0_windows_amd64' => 'cf88397f3abf6b1e6064672d0535db5d94ced04332e56a1f31f9a2456f30a041',

Just copy and paste it to the bottom of the hash in attributes/checksums.rb and that's it.