Puppet Class: aptly

Defined in:
manifests/init.pp

Overview

config_contents

Contents of the config file. Default: undef

config

Hash of configuration options for ‘/etc/aptly.conf`. See www.aptly.info/#configuration Default: {}

repo

Whether to configure an apt::source for ‘repo.aptly.info`. You might want to disable this if/when you’ve mirrored that yourself. Default: true

key_server

Key server to use when ‘$repo` is true. Uses the default of `apt::source` if not specified. Default: undef

user

The user to use when performing an aptly command Default: ‘root’

aptly_repos

Hash of aptly repos which is passed to aptly::repo Default: {}

aptly_mirrors

Hash of aptly mirrors which is passed to aptly::mirror Default: {}

Parameters:

  • package_ensure (Any) (defaults to: present)
  • config_file (Any) (defaults to: '/etc/aptly.conf')
  • config (Any) (defaults to: {})
  • config_contents (Any) (defaults to: undef)
  • repo (Any) (defaults to: true)
  • key_server (Any) (defaults to: undef)
  • user (Any) (defaults to: 'root')
  • aptly_repos (Any) (defaults to: {})
  • aptly_mirrors (Any) (defaults to: {})


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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'manifests/init.pp', line 46

class aptly (
  $package_ensure  = present,
  $config_file     = '/etc/aptly.conf',
  $config          = {},
  $config_contents = undef,
  $repo            = true,
  $key_server      = undef,
  $user            = 'root',
  $aptly_repos     = {},
  $aptly_mirrors   = {},
) {

  validate_absolute_path($config_file)
  validate_hash($config)
  validate_hash($aptly_repos)
  validate_hash($aptly_mirrors)
  validate_bool($repo)
  validate_string($key_server)
  validate_string($user)

  if $config_contents {
    validate_string($config_contents)
  }

  if $repo {
    apt::source { 'aptly':
      location   => 'http://repo.aptly.info',
      release    => 'squeeze',
      repos      => 'main',
      key_server => $key_server,
      key        => 'B6140515643C2AE155596690E083A3782A194991',
    }

    Apt::Source['aptly'] -> Package['aptly']
  }

  package { 'aptly':
    ensure  => $package_ensure,
  }

  $config_file_contents = $config_contents ? {
    undef   => inline_template("<%= Hash[@config.sort].to_pson %>\n"),
    default => $config_contents,
  }

  file { $config_file:
    ensure  => file,
    content => $config_file_contents,
  }

  $aptly_cmd = "/usr/bin/aptly -config ${config_file}"

  # Hiera support
  create_resources('::aptly::repo', $aptly_repos)
  create_resources('::aptly::mirror', $aptly_mirrors)
}