Puppet Class: postgres_exporter::install

Defined in:
manifests/install.pp

Summary

install postgres_exporter

Overview

This class handles postgres_exporter package.



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
# File 'manifests/install.pp', line 6

class postgres_exporter::install {

  include ::archive

  if $postgres_exporter::manage_user {
    ensure_resource('user', [$::postgres_exporter::postgres_exporter_user], {
      ensure => 'present',
      system => true,
    })
  }
  if $postgres_exporter::manage_group {
    ensure_resource('group', [$::postgres_exporter::postgres_exporter_group], {
      ensure => 'present',
      system => true,
    })
    Group[$::postgres_exporter::postgres_exporter_group]->User[$::postgres_exporter::postgres_exporter_user]
  }

  $real_archive_url = pick(
    $postgres_exporter::archive_url,
    "${postgres_exporter::archive_url_base}/v${postgres_exporter::version}/${postgres_exporter::archive_name}-${postgres_exporter::version}.${postgres_exporter::os}-${postgres_exporter::arch}.tar.gz"
  )
  $local_archive_name = "${postgres_exporter::archive_name}-${postgres_exporter::version}.${postgres_exporter::os}-${postgres_exporter::arch}.tar.gz"
  $install_dir = "/opt/${postgres_exporter::archive_name}-${postgres_exporter::version}.${postgres_exporter::os}-${postgres_exporter::arch}"

  archive { "/tmp/${local_archive_name}":
    ensure          => present,
    extract         => true,
    extract_path    => '/opt',
    source          => $real_archive_url,
    checksum_verify => false,
    creates         => "${install_dir}/postgres_exporter",
    cleanup         => true,
  }

}