This repository has been archived by the owner on Aug 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.pp
54 lines (48 loc) · 1.49 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
# == Class: caddy
#
# === Parameters
#
# Document parameters here.
#
# version
# Release of the Caddy web server to install
# Defaults to 1.0.4
#
class caddy (
$version = $::caddy::params::version,
$manage_user = true,
$manage_group = true,
$user = $::caddy::params::user,
$group = $::caddy::params::group,
$certificates_path = $::caddy::params::certificates_path,
$install_method = $::caddy::params::install_method,
$archive_download_url = undef,
) inherits caddy::params {
if versioncmp('0.9.99', $version) > 0 {
$archive_real_bin_file_name = 'caddy_linux_amd64'
$release_file_name = 'caddy_linux_amd64.tar.gz'
} else {
$archive_real_bin_file_name = 'caddy'
$release_file_name = "caddy_v${version}_linux_amd64.tar.gz"
}
$archive_file = "/tmp/${release_file_name}"
if $install_method == 'source' and !defined(Class['golang']) {
class { 'golang':
repo_version => 'go1.7'
}
}
$install_path = $install_method ? {
'source' => "${::golang::workdir}bin",
'archive' => $::caddy::params::install_path,
}
$real_bin_file_name = $install_method ? {
'source' => 'caddy',
'archive' => $archive_real_bin_file_name
}
include caddy::install
include caddy::config
include caddy::service
Class['caddy::install'] -> Class['caddy::config']
Class['caddy::install'] ~> Class['caddy::service']
Class['caddy::config'] ~> Class['caddy::service']
}