This repository has been archived by the owner on Jan 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 69
/
init.pp
89 lines (82 loc) · 2.24 KB
/
init.pp
1
2
3
4
5
6
7
8
9
10
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
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# == Class: aptly
#
# aptly is a swiss army knife for Debian repository management
#
# === Parameters
#
# [*package_ensure*]
# Ensure parameter to pass to the package resource.
# Default: 'present'
#
# [*config_file*]
# Absolute path to the configuration file. Defaults to
# `/etc/aptly.conf`.
# [*config_contents*]
# Contents of the config file.
# Default: undef
#
# [*config*]
# Hash of configuration options for `/etc/aptly.conf`.
# See http://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.
# Default: keyserver.ubuntu.com
#
# [*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: {}
#
class aptly (
String $package_ensure = 'present',
Stdlib::Absolutepath $config_file = '/etc/aptly.conf',
Hash $config = {},
Optional[String] $config_contents = undef,
Boolean $repo = true,
String $key_server = 'keyserver.ubuntu.com',
String $user = 'root',
Hash $aptly_repos = {},
Hash $aptly_mirrors = {},
) {
if $repo {
apt::source { 'aptly':
location => 'http://repo.aptly.info',
release => 'squeeze',
repos => 'main',
key => {
server => $key_server,
id => 'EE727D4449467F0E',
}
}
Apt::Source['aptly'] -> Class['apt::update'] -> 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)
}