Puppet Class: aptly::api
- Defined in:
- manifests/api.pp
Overview
Class: aptly::api
Install and configure Aptly’s API Service
Parameters
- ensure
-
Ensure to pass on to service type Default: running
- user
-
User to run the service as. Default: root
- group
-
Group to run the service as. Default: root
- listen
-
What IP/port to listen on for API requests. Default: ‘:8080’
- log
-
Enable or disable Upstart logging. Default: none
- enable_cli_and_http
-
Enable concurrent use of command line (CLI) and HTTP APIs with the same Aptly root.
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 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'manifests/api.pp', line 31
class aptly::api (
$ensure = running,
$user = 'root',
$group = 'root',
$listen = ':8080',
$log = 'none',
$enable_cli_and_http = false,
) {
validate_re($ensure, ['^stopped|running$'], 'Valid values for $ensure: stopped, running')
validate_string($user, $group)
validate_re($listen, ['^[0-9.]*:[0-9]+$'], 'Valid values for $listen: :port, <ip>:<port>')
validate_re($log, ['^none|log$'], 'Valid values for $log: none, log')
if $::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '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,
}
}
|