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
|
# File 'manifests/config.pp', line 5
class letsencrypt::config (
Stdlib::Absolutepath $config_dir = $letsencrypt::config_dir,
Stdlib::Absolutepath $config_file = $letsencrypt::config_file,
Hash $config = $letsencrypt::config,
Optional[String[1]] $email = $letsencrypt::email,
Boolean $unsafe_registration = $letsencrypt::unsafe_registration,
Boolean $agree_tos = $letsencrypt::agree_tos,
) {
assert_private()
unless $agree_tos {
fail("You must agree to the Let's Encrypt Terms of Service! See: https://letsencrypt.org/repository for more information." )
}
file { $config_dir: ensure => directory }
file { $letsencrypt::cron_scripts_path:
ensure => directory,
purge => true,
}
if $email {
$_config = merge($config, { 'email' => $email })
} else {
$_config = $config
}
ini_setting { "${config_file} register-unsafely-without-email true":
ensure => bool2str($unsafe_registration, 'present', 'absent'),
path => $config_file,
section => '',
setting => 'register-unsafely-without-email',
value => true,
}
unless 'email' in $_config {
if $unsafe_registration {
warning('No email address specified for the letsencrypt class! Registering unsafely!')
} else {
fail("Please specify an email address to register with Let's Encrypt using the \$email parameter on the letsencrypt class")
}
}
$_config.each |$key,$value| {
ini_setting { "${config_file} ${key} ${value}":
ensure => present,
path => $config_file,
section => '',
setting => $key,
value => $value,
require => File[$config_dir],
}
}
}
|