Puppet Class: instana_agent::service

Defined in:
manifests/service.pp

Overview



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/service.pp', line 24

class instana_agent::service {

  require instana_agent::install

  $dir = '/etc/systemd/system/instana-agent.service.d'

  if ($facts['is_systemd']) {
    file { $dir:
      ensure => 'directory',
      group  => 'root',
      mode   => '0750',
      owner  => 'root',
    }

    if ($instana_agent::instana_agent_cpu_limited or $instana_agent::instana_agent_memory_limited) {

      $resource_template = @("EOT")
        [Service]
        <% if ${$instana_agent::instana_agent_cpu_limited} { -%>CPUAccounting=true
        CPUQuota=<%= ( ${$instana_agent::instana_agent_cpu_quota} * 100 ) %>%
        <% } -%>
        <% if ${$instana_agent::instana_agent_memory_limited} { -%>MemoryAccounting=true
        MemoryMax=<%= ${$instana_agent::instana_agent_memory_quota} %>
        <% } -%>
      | EOT

      file { "${$dir}/10-resources.conf":
        ensure  => 'file',
        content => "[Service]\n${$resource_template}",
        group   => 'root',
        mode    => '0640',
        owner   => 'root',
      }
    }
  }
}