Puppet Class: aptly::api

Defined in:
manifests/api.pp

Summary

Install and configure Aptly's API Service

Overview

Parameters:

  • ensure (Enum['stopped','running']) (defaults to: running)

    Ensure to pass on to service type

  • user (String[1]) (defaults to: 'root')

    User to run the service as.

  • group (String[1]) (defaults to: 'root')

    Group to run the service as.

  • listen (Pattern['^([0-9.]*:[0-9]+$|unix:)']) (defaults to: ':8080')

    What IP/port to listen on for API requests.

  • log (Enum['none','log']) (defaults to: 'none')

    Enable or disable Upstart logging.

  • enable_cli_and_http (Boolean) (defaults to: false)

    Enable concurrent use of command line (CLI) and HTTP APIs with the same Aptly root.



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,
  }
}