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
90
91
|
# File 'manifests/init.pp', line 30
class oauth2_proxy (
String $group = 'oauth2',
Stdlib::Unixpath $install_root = '/opt/oauth2_proxy',
Optional[Hash] $instances = undef,
Boolean $manage_group = true,
Boolean $manage_service = true,
Boolean $manage_user = true,
String $provider = 'systemd',
String $version = '7.3.0',
Stdlib::HTTPUrl $source_base_url = "https://github.com/oauth2-proxy/oauth2-proxy/releases/download/v${version}",
String $tarball_name = "oauth2-proxy-v${version}.linux-amd64.tar.gz",
String $user = 'oauth2',
) {
# in theory, this module should work on any linux distro that uses systemd
# but it has only been tested on el7
case $facts[os][family] {
'RedHat': {
$shell = '/sbin/nologin'
$systemd_path = '/usr/lib/systemd/system'
}
'Debian': {
$shell = '/usr/sbin/nologin'
$systemd_path = '/etc/systemd/system'
}
default: {
fail("Module ${module_name} is not supported on operatingsystem ${facts[os][family]}")
}
}
# bit.ly does not provide x86 builds
case $facts[os][architecture] {
'x86_64': {}
'amd64': {}
default: {
fail("Module ${module_name} is not supported on architecture ${facts[os][architecture]}")
}
}
if $manage_user {
user { $user:
gid => $group,
system => true,
home => '/',
shell => $shell,
}
}
if $manage_group {
group { $group:
ensure => present,
system => true,
}
}
class { 'oauth2_proxy::install': }
if $instances {
create_resources('oauth2_proxy::instance', $instances)
}
}
|