Puppet Class: glogging::agent::debian

Defined in:
manifests/agent/debian.pp

Overview

Installs the Google Cloud Logging Agent to a Debian`based machine.

Derived from Logging Agent’s installation script:

https://dl.google.com/cloudagents/install-logging-agent.sh

For more details please visit:

https://cloud.google.com/logging/docs/agent/installation

Parameters:

  • credential_file (Any) (defaults to: undef)


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
58
59
# File 'manifests/agent/debian.pp', line 8

class glogging::agent::debian(
  $credential_file = undef,
) {

  $os_codename = $::facts['os']['distro']['codename']

  $repo_host = 'packages.cloud.google.com'
  $repo_name = 'google-cloud-logging-wheezy'

  $optional_credential_file = $credential_file ? {
    undef   => undef,
    default => File[$credential_file],
  }

  apt::source { 'google-cloud-logging':
    comment  => 'Google Cloud Logging repository',
    location => "http://${repo_host}/apt",
    release  => $repo_name,
    repos    => 'main',
    key      => {
      'id'     => 'D0BC747FD8CAF7117500D6FA3746C208A7317B0F',
      'server' => 'pgp.mit.edu',
    },
    include  => {
      'deb' => true,
    },
  }

  package { 'google-fluentd':
    ensure  => installed,
    require => Apt::Source['google-cloud-logging'],
    notify  => Service['google-fluentd'],
  }

  package { 'google-fluentd-catch-all-config':
    ensure  => installed,
    require => Apt::Source['google-cloud-logging'],
    notify  => Service['google-fluentd'],
  }

  service { 'google-fluentd':
    ensure     => running,
    hasstatus  => true,
    hasrestart => true,
    require    => [
      Package['google-fluentd'],
      Package['google-fluentd-catch-all-config'],
      $optional_credential_file,
    ],
  }

}