Browse Source

Run hindsight on ubuntu 16.04

Change-Id: I4fa43e890dd99eab970a990410e4d9df27687357
Mykyta Karpin 2 years ago
parent
commit
4ffa31b4ad

+ 33
- 5
deployment_scripts/puppet/manifests/hindsight.pp View File

@@ -151,14 +151,42 @@ $scripts = {
151 151
 
152 152
 create_resources(file, $scripts, $files_defaults)
153 153
 
154
-file { '/etc/init/telemetry-collector-hindsight.conf':
155
-  content => template( "${templates}/init.conf.erb"),
156
-  before  => Service['telemetry-collector-hindsight'],
154
+if $::operatingsystem == 'Ubuntu' {
155
+  if versioncmp($::operatingsystemmajrelease, '16') >= 0 {
156
+
157
+    $hindsight_provider = 'systemd'
158
+
159
+    file { 'hindsight-service-unit':
160
+      ensure  => present,
161
+      path    => '/lib/systemd/system/telemetry-collector-hindsight.service',
162
+      mode    => '0644',
163
+      content => template("${templates}/hindsight.unit.erb"),
164
+    }
165
+
166
+    exec { 'systemctl-daemon-reload':
167
+      command     => 'systemctl daemon-reload',
168
+      refreshonly => true,
169
+      path        => $::path,
170
+    }
171
+
172
+    File['hindsight-service-unit'] ~> Exec['systemctl-daemon-reload'] -> Service['telemetry-collector-hindsight']
173
+  } else {
174
+
175
+    $hindsight_provider = 'upstart'
176
+
177
+    file { '/etc/init/telemetry-collector-hindsight.conf':
178
+      content => template( "${templates}/init.conf.erb"),
179
+    }
180
+
181
+    File['/etc/init/telemetry-collector-hindsight.conf'] ~> Service['telemetry-collector-hindsight']
182
+  }
183
+} else {
184
+  $hindsight_provider = undef
157 185
 }
158 186
 
159 187
 service { 'telemetry-collector-hindsight':
160 188
   ensure   => 'running',
161 189
   enable   => true,
162
-  provider => 'upstart',
163
-  require  => File['/etc/init/telemetry-collector-hindsight.conf'],
190
+  provider => $hindsight_provider,
164 191
 }
192
+

+ 14
- 0
deployment_scripts/puppet/modules/telemetry/templates/hindsight/hindsight.unit.erb View File

@@ -0,0 +1,14 @@
1
+# Autogenerated by Puppet
2
+# Do not edit
3
+
4
+[Unit]
5
+Description=Telemetry collector hindsight service
6
+
7
+[Service]
8
+Type=simple
9
+User=hindsight
10
+ExecStart=/usr/bin/hindsight <%= @conf_dir %>/hindsight.cfg
11
+Restart=always
12
+
13
+[Install]
14
+WantedBy=multi-user.target

Loading…
Cancel
Save