Puppet Class: cloudwatch::config

Defined in:
manifests/config.pp

Overview

Class cloudwatch::config

This class is called from cloudwatch for service config.

This class creates the main config file. Each individual log file being watched will create an additional config file in /var/awslogs/etc/config/



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

class cloudwatch::config {
  $config_content = @(EOF)
    [general]
    # This system is managed by Puppet.
    # Changes will be overwritten on next Puppet Agent run.
    state_file = /var/awslogs/state/agent-state
    |- EOF

  file { ['/var/awslogs/etc', '/var/awslogs']:
    ensure => directory,
    owner   => 'root',
    group   => 'root',
  }

  file { $cloudwatch::conf_path:
    ensure  => directory,
    purge   => true,
    recurse => true
  }

  file { $cloudwatch::config_file:
    ensure  => file,
    owner   => 'root',
    group   => 'root',
    content => inline_epp($config_content),
    require => File['/var/awslogs/etc'],
    notify  => Service['awslogs'],
  }

  # the cloudwatch agent installer expects to copy the given config file
  # to a new location, so we have to create a second copy to let it
  file { '/var/tmp/awslogs.conf':
    ensure  => file,
    owner   => 'root',
    group   => 'root',
    content => inline_epp($config_content),
  }
}