Puppet Class: glogging::agent::redhat

Defined in:
manifests/agent/redhat.pp

Overview

Installs the Google Cloud Logging Agent to a RedHat 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
# File 'manifests/agent/redhat.pp', line 8

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

  $os_major = $::facts['os']['release']['major']
  $repo_name = "google-cloud-logging-el${os_major}-\$basearch"
  $cloud_yum_repo = 'https://packages.cloud.google.com/yum/repos'

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

  yumrepo { 'google_cloud_logging':
    ensure        => 'present',
    name          => 'google-cloud-logging',
    descr         => 'Google Cloud Logging Agent Repository',
    baseurl       => "${cloud_yum_repo}/${repo_name}",
    enabled       => 1,
    gpgcheck      => 1,
    repo_gpgcheck => 1,
    gpgkey        => [
      'https://packages.cloud.google.com/yum/doc/yum-key.gpg',
      'https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg',
    ],
  }

  package { 'google-fluentd':
    ensure  => installed,
    require => Yumrepo['google_cloud_logging'],
  }

  package { 'google-fluentd-catch-all-config':
    ensure  => installed,
    require => Yumrepo['google_cloud_logging'],
  }

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

}