forked from smallstep/certificates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstep.pp
56 lines (51 loc) · 1.45 KB
/
step.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
# smallstep package configuration
class step(
$version = false,
) {
if !$version {
fail("class ${name}: version cannot be empty")
}
$pkg = "step_${version}_linux_amd64.tar.gz"
$download_url = "https://github.com/smallstep/cli/releases/download/v${version}/step_${version}_linux_amd64.tar.gz"
$step_exec = '/opt/smallstep/bin/step'
exec {
'download/update smallstep':
command => "/usr/bin/curl --fail -o /tmp/${pkg} ${download_url} && /bin/tar -xzvf /tmp/${pkg} -C /opt",
unless => "/usr/bin/which ${step_exec} && ${step_exec} version | grep ${version}",
user => 'step',
require => File['/opt/smallstep'];
}
file {
'/opt/smallstep':
ensure => directory,
mode => '0755',
owner => 'step';
'/usr/local/lib/step':
ensure => directory,
mode => '0755',
owner => 'step';
'/usr/local/lib/step/.step':
ensure => directory,
mode => '0755',
owner => 'step';
'/usr/local/lib/step/.step/secrets':
ensure => directory,
mode => '0644',
owner => 'step';
'/usr/local/lib/step/.step/config':
ensure => directory,
mode => '0755',
owner => 'step';
}
group { 'step':
ensure => present,
gid => $::step_id,
}
user { 'step':
ensure => present,
gid => 'puppet',
home => '/usr/local/lib/step',
managehome => false,
uid => $::step_id,
}
}