Puppet Class: consul_template

Inherits:
consul_template::params
Defined in:
manifests/init.pp

Overview

Class: consul_template

Installs, configures, and manages consul-template

Parameters

version

Specify version of consul-template binary to download.

install_method

Defaults to ‘url` but can be `package` if you want to install via a system package.

package_name

Only valid when the install_method == package. Defaults to ‘consul-template`.

package_ensure

Only valid when the install_method == package. Defaults to ‘latest`.

extra_options

Extra arguments to be passed to the consul-template agent

init_style

What style of init system your system uses.

config_hash

Consul-template configuration options. See github.com/hashicorp/consul-template#options

config_mode

Set config file mode

purge_config_dir

Purge config files no longer generated by Puppet

data_dir

Path to a directory to create to hold some data. Defaults to ”

user

Name of a user to use for dir and file perms. Defaults to root.

group

Name of a group to use for dir and file perms. Defaults to root.

manage_user

User is managed by this module. Defaults to ‘false`.

manage_group

Group is managed by this module. Defaults to ‘false`.

watches

A hash of watches - allows greater Hiera integration. Defaults to ‘{}`.

Parameters:

  • arch (String) (defaults to: $consul_template::params::arch)
  • init_style (String) (defaults to: $consul_template::params::init_style)
  • os (String) (defaults to: $consul_template::params::os)
  • bin_dir (String) (defaults to: '/usr/local/bin')
  • config_hash (Hash) (defaults to: {})
  • config_defaults (Hash) (defaults to: {})
  • config_dir (String) (defaults to: '/etc/consul-template')
  • config_mode (String) (defaults to: '0660')
  • data_dir (String) (defaults to: '')
  • download_url (Optional[Stdlib::HTTPSUrl]) (defaults to: undef)
  • download_url_base (Stdlib::HTTPSUrl) (defaults to: 'https://releases.hashicorp.com/consul-template')
  • download_extension (String) (defaults to: 'zip')
  • extra_options (String) (defaults to: '')
  • group (String) (defaults to: 'root')
  • install_method (Enum['url', 'package']) (defaults to: 'url')
  • logrotate_compress (String) (defaults to: 'nocompress')
  • logrotate_files (Integer) (defaults to: 4)
  • logrotate_on (Boolean) (defaults to: false)
  • logrotate_period (String) (defaults to: 'daily')
  • manage_user (Boolean) (defaults to: false)
  • manage_group (Boolean) (defaults to: false)
  • package_name (String) (defaults to: 'consul-template')
  • package_ensure (String) (defaults to: 'latest')
  • pretty_config (Boolean) (defaults to: false)
  • pretty_config_indent (Integer) (defaults to: 4)
  • purge_config_dir (Boolean) (defaults to: true)
  • service_enable (Boolean) (defaults to: true)
  • service_ensure (Enum['stopped', 'running']) (defaults to: 'running')
  • user (String) (defaults to: 'root')
  • version (String) (defaults to: '0.22.0')
  • watches (Hash) (defaults to: {})


51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'manifests/init.pp', line 51

class consul_template (
  String $arch                               = $consul_template::params::arch,
  String $init_style                         = $consul_template::params::init_style,
  String $os                                 = $consul_template::params::os,
  String $bin_dir                            = '/usr/local/bin',
  Hash $config_hash                          = {},
  Hash $config_defaults                      = {},
  String $config_dir                         = '/etc/consul-template',
  String $config_mode                        = '0660',
  String $data_dir                           = '',
  Optional[Stdlib::HTTPSUrl] $download_url   = undef,
  Stdlib::HTTPSUrl $download_url_base        = 'https://releases.hashicorp.com/consul-template',
  String $download_extension                 = 'zip',
  String $extra_options                      = '',
  String $group                              = 'root',
  Enum['url', 'package'] $install_method     = 'url',
  String $logrotate_compress                 = 'nocompress',
  Integer $logrotate_files                   = 4,
  Boolean $logrotate_on                      = false,
  String $logrotate_period                   = 'daily',
  Boolean $manage_user                       = false,
  Boolean $manage_group                      = false,
  String $package_name                       = 'consul-template',
  String $package_ensure                     = 'latest',
  Boolean $pretty_config                     = false,
  Integer $pretty_config_indent              = 4,
  Boolean $purge_config_dir                  = true,
  Boolean $service_enable                    = true,
  Enum['stopped', 'running'] $service_ensure = 'running',
  String $user                               = 'root',
  String $version                            = '0.22.0',
  Hash $watches                              = {},
) inherits consul_template::params {

  $_download_url = pick($download_url, "${download_url_base}/${version}/${package_name}_${version}_${os}_${arch}.${download_extension}")

  if $watches {
    create_resources('consul_template::watch', $watches)
  }

  contain consul_template::install
  contain consul_template::config
  contain consul_template::service
  contain consul_template::logrotate

  Class['consul_template::install']
  -> Class['consul_template::config']
  ~> Class['consul_template::service']
  -> Class['consul_template::logrotate']

}