Puppet Class: sumo

Defined in:
manifests/init.pp

Summary

Configures the Sumo Collector on Windows and Linux

Overview

Examples:

Basic usage

class { 'sumo': }

Set the following in the relevant hiera scope:


sumo::accessid: lkskj98983hjhj
sumo::accesskey: jlkdlkaldkalkda984nb197jdnkjsomjsdkjiocjJAOSALDJWBDahsikldjkja78
sumo::sumo_package_ver: 19.253-26
sumo::sources_path: "/tmp/sumo-%{osfamily}.json"

Parameters:

  • install (Boolean)

    Whether to install and configure the Sumo Logic collector. It defaults to true, but is implemented so that the collector can be configured globally, but not installed on nodes in certain Hiera scopes.

  • accessid (String)

    The Sumo Logic collector access ID

  • accesskey (String)

    The Sumo Logic collector access Key

  • category (Optional[String])

    Source category to use when a source does not specify a category.

  • clobber (Boolean)

    When true, if there is any existing collector with the same name, that collector will be deleted (clobbered).

  • collector_name (String)

    Sets the name of collector used on Sumo Logic. The name can be a maximum of 128 characters.

  • collector_secure_files (Boolean)

    By default, new Collector installations will use Enhanced File System Security. To disable this feature during installation, set this to false.

  • collector_url (String)

    Sets the URL used to register collector for data collection API.

  • description (Optional[String])

    Description for the collector to appear in Sumo Logic.

  • enable_action_source (Boolean)

    Script Action Sources are disabled by default. You can enable them by setting this parameter to true.

  • enable_script_source (Boolean)

    Script Sources are disabled by default. You can enable them by setting this parameter to true.

  • disable_upgrade (Boolean)

    If true, the collector rejects upgrade requests from Sumo.

  • ephemeral (Boolean)

    When true, the collector will be deleted after 12 hours of inactivity.

  • hostname (String)

    The host name of the machine on which the collector is running.

  • local_config_mgmt (Boolean)

    Needs yo be false when using ”sources_path” and true when using ”sync_sources_path”.

  • proxy_host (Optional[String])

    Sets proxy host when a proxy server is used.

  • proxy_ntlmdomain (Optional[String])

    Sets proxy NTLM domain when a proxy server is used with NTLM authentication.

  • proxy_password (Optional[String])

    Sets proxy password when a proxy server is used with authentication.

  • proxy_port (Optional[String])

    Sets proxy port when a proxy server is used.

  • proxy_user (Optional[String])

    Sets proxy user when a proxy server is used with authentication.

  • skip_access_key_removal (Boolean)

    If true, it will skip the access key removal from the user.properties file.

  • skip_registration (Boolean)

    Collectors normally register with Sumo Logic during the installation process, but setting this flag to true will skip registration. This way, the collector is installed as a service that will start and register automatically when next booted or started.

  • sources_path (Optional[String])

    Specifies a single UTF-8 encoded JSON file, or a folder containing UTF-8 encoded JSON files, that defines the Sources to configure upon Collector registration. The contents of the file or files is read upon Collector registration only, it is not synchronized with the Collector’s configuration on an on-going basis.

  • sync_sources_path (Optional[String])

    Specifies either a single UTF-8 encoded JSON file, or a folder containing UTF-8 encoded JSON files, that define the Sources to configure upon Collector registration. The Source definitions will be continuously monitored and synchronized with the Collector’s configuration.

  • target_cpu (Optional[Integer])

    You can choose to set a CPU target to limit the amount of CPU processing a collector uses. The value must be expressed as a whole number percentage string, e.g. 20.

  • time_zone (Optional[String])

    The time zone to use when it is not extracted from the log timestamp.

  • token (Optional[String])

    Sets the Setup Wizard Token, a one-time use token, available for one hour after it is generated, then it expires. This token authenticates the user. It is designed to be used for only one Collector. The token cannot be used with the API, and it cannot be disabled.

  • runas_username (Optional[String])

    When set, the Collector will run as the specified user (Windows and Linux). For Windows, the user account needs Log on as a Service permission.

  • win_run_as_password (Optional[String])

    (Windows only) When set in conjunction with runas_username, the Collector will run as the specified user with the specified password.

  • user_properties_path (String)

    Set the absolute path of the user.properties file. It default to the location in the default install location.

  • install_properties_path (Optional[String])

    Set this to the location specified in the Chocolatey configuration. Default is ‘C:windowstempsumoVarFile.txt’.

  • package (Struct[{name => String, version => String}])

    Set the name and version of the package to install

  • service (Struct[{name => String, running => Boolean, enabled => Boolean}])

    Set the name and state of the collector service



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'manifests/init.pp', line 92

class sumo (
  Boolean $install,
  String $accessid,
  String $accesskey,
  Optional[String] $category,
  Boolean $clobber,
  String $collector_name,
  Boolean $collector_secure_files,
  String $collector_url,
  Optional[String] $description,
  Boolean $enable_action_source,
  Boolean $enable_script_source,
  Boolean $disable_upgrade,
  Boolean $ephemeral,
  String $hostname,
  Optional[String] $proxy_host,
  Optional[String] $proxy_ntlmdomain,
  Optional[String] $proxy_password,
  Optional[String] $proxy_port,
  Optional[String] $proxy_user,
  Boolean $skip_access_key_removal,
  Boolean $skip_registration,
  Boolean $local_config_mgmt,
  Optional[String] $sources_path,
  Optional[String] $sync_sources_path,
  Optional[Integer] $target_cpu,
  Optional[String] $time_zone,
  Optional[String] $token,
  Optional[String] $runas_username,
  Optional[String] $win_run_as_password,
  String $user_properties_path,
  Optional[String] $install_properties_path,
  Struct[{name => String, version => String}] $package,
  Struct[{name => String, running => Boolean, enabled => Boolean}] $service,
){
  $template_data = {
    'accessid'                => $accessid,
    'accesskey'               => $accesskey,
    'category'                => $category,
    'clobber'                 => $clobber,
    'collector_name'          => $collector_name,
    'collector_secure_files'  => $collector_secure_files,
    'collector_url'           => $collector_url,
    'description'             => $description,
    'enable_action_source'    => $enable_action_source,
    'enable_script_source'    => $enable_script_source,
    'disable_upgrade'         => $disable_upgrade,
    'ephemeral'               => $ephemeral,
    'hostName'                => $hostname,
    'skip_access_key_removal' => $skip_access_key_removal,
    'proxy_host'              => $proxy_host,
    'proxy_ntlmdomain'        => $proxy_ntlmdomain,
    'proxy_password'          => $proxy_password,
    'proxy_port'              => $proxy_port,
    'proxy_user'              => $proxy_user,
    'runas_username'          => $runas_username,
    'skip_registration'       => $skip_registration,
    'sources_path'            => $sources_path,
    'local_config_mgmt'       => $local_config_mgmt,
    'sync_sources_path'       => $sync_sources_path,
    'target_cpu'              => $target_cpu,
    'time_zone'               => $time_zone,
    'token'                   => $token,
    'win_run_as_password'     => $win_run_as_password
  }

  if $install {
    ########## Write the config file ############
    if $::osfamily == 'windows' {
      File {
        ensure  => 'file',
        group => 'Administrators',
        mode    => '0664',
      }
      Package {
        provider => 'chocolatey'
      }
      file { $install_properties_path:
        content => epp('sumo/user.properties.epp', $template_data + { installer => true } ),
        before  => Package[$package['name']],
      }
    } else {
      File {
        ensure  => 'file',
        owner => 'root',
        group => 'root',
        mode    => '0644',
      }
    }
    file { $user_properties_path:
      content => epp('sumo/user.properties.epp', $template_data),
      require => Package[$package['name']],
      notify  => Service[$service['name']];
    }

    ########## Install Package ############
    package { $package['name']:
      ensure => $package['version'],
    }

    ########## start the service ############
    service { $service['name']:
      ensure  => $service['running'],
      enable  => $service['enabled'],
      require => Package[$package['name']],
    }
  } else {
    if $::osfamily == 'windows' {
      file { $install_properties_path:
        ensure => absent,
      }
    }
    file { $user_properties_path:
      ensure => absent,
    }
    service { $service['name']:
      ensure => false,
      enable => false,
      before => Package[$package['name']],
    }
    package { $package['name']:
      ensure => absent,
    }
  }
}