Forge Home


Install and manage Consul Template and its jobs


144,322 latest version

4.2 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.

Version information

  • 0.2.8 (latest)
  • 0.2.7 (deleted)
  • 0.2.6
  • 0.2.5
  • 0.2.4
  • 0.2.3
  • 0.2.2
  • 0.2.1
  • 0.2.0
  • 0.1.3
  • 0.1.2
  • 0.1.1
  • 0.1.0
released May 11th 2016
This version is compatible with:
  • , , ,

Start using this module

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

Add this module to your Puppetfile:

mod 'gdhbashton-consul_template', '0.2.8'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

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

Manually install this module globally with Puppet module tool:

puppet module install gdhbashton-consul_template --version 0.2.8

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.



gdhbashton/consul_template — version 0.2.8 May 11th 2016

#consul_template for Puppet


###What This Module Affects

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


  • purge_config_dir Default: true. If enabled, removes config files no longer managed by Puppet.
  • config_mode Default: 0660. Mode set on config files and directories.
  • bin_dir Default: /usr/local/bin. Path to the consul-template binaries
  • arch Default: Read from facter. System architecture to use (amd64, x86_64, i386)
  • version Default: 0.11.0. Version of consul-template to install
  • install_method Default: 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 Default: Read from facter.
  • download_url Default: undef. URL to download consul-template from (when install_method is set to 'url')
  • download_url_base Default: Base URL to download consul-template from (when install_method is set to 'url')
  • download_extension Default: zip. File extension of consul-template binary to be downloaded (when install_method is set to 'url')
  • package_name Default: consul-template. Name of package to install
  • package_ensure Default: latest.
  • config_dir Default: /etc/consul-template. Path to store the consul-template configuration
  • extra_options Default: ''. Extra options to be bassed to the consul-template agent. See
  • service_enable Default: true.
  • service_ensure Default: running.
  • user Default: root. This used to be a default of consul-template and this caused much out-of-box pain for people.
  • group Default: root.
  • manage_user Default: false. Module handles creating the user.
  • manage_group Default: false. Module handles creating the group.
  • consul_host Default: localhost. Hostanme of consul agent to query
  • consul_port Default: 8500. Port number the API is running on
  • consul_token Default: ''. ACL token to use when querying consul
  • consul_retry Default: 10s. Time in seconds to wait before retrying consul requests
  • consul_wait Default: undef. Min:Max time to wait before consul-template renders a new template to disk and triggers refresh. Specified in the format min:max according to Go time duration format
  • consul_max_stale Default: undef. The maximum staleness of a query. If specified, Consul will distribute work among all servers instead of just the leader.
  • init_style Init style to use for consul-template service.
  • log_level Default: info. Logging level to use for consul-template service. Can be 'debug', 'warn', 'err', 'info'


The simplest way to use this module is:

include consul_template

Or to specify parameters:

class { 'consul_template':
    service_enable   => false
    log_level        => 'debug',
    init_style       => 'upstart',
    consul_wait      => '5s:30s',
    consul_max_stale => '1s'

Watch files

To declare a file that you wish to populate from Consul key-values, you 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',
    destination   => '/tmp/common.json',
    command       => 'true',


Depends on the JSON gem, or a modern ruby.

##Development See the contributing guide

Open an issue or fork and open a Pull Request