Forge Home

consul_template

Install and manage Consul Template and its jobs

424,786 downloads

91,115 latest version

5.0 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Support the Puppet Community by contributing to this module

You are welcome to contribute to this module by suggesting new features, currency updates, or fixes. Every contribution is valuable to help ensure that the module remains compatible with the latest Puppet versions and continues to meet community needs. Complete the following steps:

  1. Review the module’s contribution guidelines and any licenses. Ensure that your planned contribution aligns with the author’s standards and any legal requirements.
  2. Fork the repository on GitHub, make changes on a branch of your fork, and submit a pull request. The pull request must clearly document your proposed change.

For questions about updating the module, contact the module’s author.

Version information

  • 2.1.1 (latest)
  • 2.1.0
  • 2.0.0
  • 1.0.1
  • 1.0.0
released Aug 30th 2018
This version is compatible with:
  • Puppet Enterprise 2018.1.x, 2017.3.x, 2017.2.x, 2017.1.x, 2016.5.x, 2016.4.x
  • Puppet >= 4.7.1 < 6.0.0
  • , , ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'claranet-consul_template', '2.1.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add claranet-consul_template
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install claranet-consul_template --version 2.1.1

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

claranet/consul_template — version 2.1.1 Aug 30th 2018

puppet-consul_template

Build Status Puppet Forge Forge Downloads

Table of Contents

  1. Overview - What is the puppet-consul_template module?
  2. Usage - Configuration options and additional functionality
  3. Limitations - OS compatibility, etc.
  4. Development - Guide for contributing to the module

Overview

This module:

  • Installs the consul-template binary (via url or package)
  • Optionally installs a user to run it under
  • Installs a configuration file to /etc/consul-template/config.json
  • Manages the consul-template service via upstart, sysv, or systemd

Puppet 3 Support

Please note that the master branch of this module does not support Puppet 3!

On 31st December 2016, support for Puppet 3.x was withdrawn. As such, this module no longer supports Puppet 3 - if you require Puppet 3 compatibility, please use the latest version 1.x version from the Puppet Forge, or the puppet3 branch in Git.

Usage

The simplest way to use this module is:

include ::consul_template

Consul-template Options

consul-template options can be passed via hiera:

consul_template::config_defaults:
  deduplicate:
    enabled: true
  log_level: info
  max_stale: 10m
  retry:
    attemtps: 12
    backoff: 250ms
  kill_signal: SIGINT
  reload_signal: SIGHUP
  retry: 10s
  syslog: true
  token: <consul token>

Or via class parameters:

 class { 'consul_template':
   service_enable   => false
   config_hash      => {
     log_level => 'debug',
     wait      => '5s:30s',
     max_stale => '1s'
   }
 }

Watch files

To declare a file that you wish to populate from Consul key-values, use the watch define. This requires a source .ctmpl file and the file on-disk that you want to update.

consul_template::watch { 'common':
    template      => 'data/common.json.ctmpl.erb',
    template_vars => {
        'var1' => 'foo',
        'var2' => 'bar',
    },
    config_hash   => {
      perms       => '0644',
      destination => '/tmp/common.json',
      command     => 'true',
    },
}

Full Parameter List

Parameter Default Description
purge_config_dir true If enabled, removes config files no longer managed by Puppet.
config_mode 0660 Mode set on config files and directories.
bin_dir /usr/local/bin Path to the consul-template binaries
arch Read from facter System architecture to use (amd64, x86_64, i386)
version 0.19.4 Version of consul-template to install via download
install_method url When set to 'url', consul-template is downloaded and installed from source. If set to 'package', its installed using the system package manager.
os Read from facter
download_url undef URL to download consul-template from (when install_method is set to 'url')
download_url_base https://releases.hashicorp.com/consul-template Base URL to download consul-template from (when install_method is set to 'url')
download_extension zip File extension of consul-template binary to be downloaded (when install_method is set to 'url')
package_name consul-template Name of package to install
package_ensure latest Version of package to install
config_dir /etc/consul-template Path to store the consul-template configuration
extra_options '' Extra options to be passed to the consul-template agent. See https://github.com/hashicorp/consul-template#options
service_enable `true
service_ensure `running
user root This used to be a default of consul-template and this caused much out-of-box pain for people.
group root
manage_user false Module handles creating the user.
manage_group false Module handles creating the group.
init_style See params.pp Init style to use for consul-template service.
log_level info Logging level to use for consul-template service. Can be 'debug', 'warn', 'err', 'info'
config_hash {} Consul-template configuration options. See https://github.com/hashicorp/consul-template#options
config_defaults {} Consul-template configuration option defaults.
pretty_config false Generates a human readable JSON config file. Defaults to false.
pretty_config_indent 4 Toggle indentation for human readable JSON file.

Limitations

Depends on the JSON gem, or a modern ruby.

Development

  • Copyright (C) 2017 Claranet
  • Distributed under the terms of the Apache License v2.0 - see LICENSE file for details.
  • To contribute, see the contributing guide, then open an issue or fork and open a Pull Request