Puppet Class: hashicorp::consul

Defined in:
manifests/consul.pp

Overview

ex: syntax=puppet si sw=2 ts=2 et

Parameters:

  • version (Any)
  • config_dir (Any) (defaults to: undef)
  • advertise_addr (Any) (defaults to: undef)
  • advertise_addr_wan (Any) (defaults to: undef)
  • bind_addr (Any) (defaults to: undef)
  • bootstrap_expect (Any) (defaults to: undef)
  • client_addr (Any) (defaults to: undef)
  • datacenter (Any) (defaults to: undef)
  • data_dir (Any) (defaults to: undef)
  • domain (Any) (defaults to: undef)
  • encrypt (Any) (defaults to: undef)
  • log_level (Any) (defaults to: undef)
  • node_name (Any) (defaults to: undef)
  • raft_protocol (Any) (defaults to: undef)
  • retry_join (Any) (defaults to: undef)
  • retry_join_wan (Any) (defaults to: undef)
  • server (Any) (defaults to: undef)
  • service (Any) (defaults to: undef)
  • service_ensure (Any) (defaults to: undef)
  • service_enable (Any) (defaults to: undef)


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'manifests/consul.pp', line 2

class hashicorp::consul (
  $version,
  $config_dir         = undef,
  $advertise_addr     = undef,
  $advertise_addr_wan = undef,
  $bind_addr          = undef,
  $bootstrap_expect   = undef,
  $client_addr        = undef,
  $datacenter         = undef,
  $data_dir           = undef,
  $domain             = undef,
  $encrypt            = undef,
  $log_level          = undef,
  $node_name          = undef,
  $raft_protocol      = undef,
  $retry_join         = undef,
  $retry_join_wan     = undef,
  $server             = undef,
  $service            = undef,
  $service_ensure     = undef,
  $service_enable     = undef,
) {
  include ::hashicorp

  hashicorp::download { 'consul':
    version    => $version,
  }

  File {
    ensure => present,
    owner  => $::hashicorp::defaults::config_owner,
    group  => $::hashicorp::defaults::config_group,
    mode   => '0640',
  }

  file { $config_dir:
    ensure => directory,
    mode   => '0755',
  }

  file { "${config_dir}/config.json":
    content => template('hashicorp/consul.conf.erb'),
    before  => Anchor['hashicorp::config::consul'],
  }

  anchor { 'hashicorp::config::consul': }

  if $service {
    class { 'hashicorp::consul::service':
      ensure      => $service_ensure,
      enable      => $service_enable,
    }

    File["${config_dir}/config.json"] ~> Service['consul']
  }
}