Forge Home

consul_template

Install and manage Consul Template and its jobs

25,555 downloads

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

Version information

  • 2.3.8 (latest)
  • 2.3.6
  • 2.3.5
  • 2.3.4
  • 2.3.3
  • 2.3.2
  • 2.3.1
  • 2.3.0
  • 2.2.0
released Dec 7th 2023
This version is compatible with:
  • Puppet Enterprise 2023.5.x, 2023.4.x, 2023.3.x, 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x, 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x
  • Puppet >= 6.0.0
  • , , ,

Start using this module

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

Add this module to your Puppetfile:

mod 'cmdntrf-consul_template', '2.3.8'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

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

Manually install this module globally with Puppet module tool:

puppet module install cmdntrf-consul_template --version 2.3.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.

Download

Documentation

cmdntrf/consul_template — version 2.3.8 Dec 7th 2023

puppet-consul_template

Fork of claranet/puppet-consul_template that is compatible with Puppet 6.

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

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:
  consul:
    retry:
      attemtps: 12
      backoff: 250ms
    token: <consul token>
  reload_signal: SIGHUP
  kill_signal: SIGINT
  deduplicate:
    enabled: true
  log_level: info
  max_stale: 10m
  syslog:
    enabled: true

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