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
|
# File 'manifests/api.pp', line 11
class aptly::api (
Enum['stopped','running'] $ensure = running,
String[1] $user = 'root',
String[1] $group = 'root',
Pattern['^([0-9.]*:[0-9]+$|unix:)'] $listen = ':8080',
Enum['none','log'] $log = 'none',
Boolean $enable_cli_and_http = false,
) {
if $facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['full'], '15.04') < 0 {
file { 'aptly-upstart':
path => '/etc/init/aptly-api.conf',
content => template('aptly/etc/aptly-api.init.erb'),
notify => Service['aptly-api'],
}
} else {
file { 'aptly-systemd':
path => '/etc/systemd/system/aptly-api.service',
content => template('aptly/etc/aptly-api.systemd.erb'),
}
~> exec { 'aptly-api-systemd-reload':
command => 'systemctl daemon-reload',
path => ['/usr/bin', '/bin', '/usr/sbin'],
refreshonly => true,
notify => Service['aptly-api'],
}
}
service { 'aptly-api':
ensure => $ensure,
enable => true,
}
}
|