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
|
class proxmox::proxy ($mail, $base_hostname) {
package {'apache2':}
->
service {'apache2':
enable => true,
ensure => running,
require => File['/usr/local/bin/notify_md_renewal'],
}
$apache_dep = {
require => Package['apache2'],
notify => Service['apache2'],
}
['md', 'ssl', 'proxy_http', 'proxy'].each |$mod| {
exec {"/usr/sbin/a2enmod $mod":
creates => "/etc/apache2/mods-enabled/$mod.load",
* => $apache_dep,
}
}
file {'/etc/apache2/sites-enabled/test.conf':
content => @("EOT")
MDomain $base_hostname auto
MDCertificateAgreement accepted
MDContactEmail $mail
MDNotifyCmd /usr/local/bin/notify_md_renewal
<VirtualHost *:443>
ServerName $base_hostname
SSLEngine on
</VirtualHost>
| EOT
,
* => $apache_dep
}
file {'/usr/local/bin/notify_md_renewal':
content => @("EOT"/$)
#!/bin/sh
systemctl restart apache2
pvenode cert set /etc/apache2/md/domains/$base_hostname/pubcert.pem /etc/apache2/md/domains/$base_hostname/privkey.pem --force 1 --restart 1
for hook in /usr/local/bin/notify_md_renewal_hook_* ; do
\$hook
done
| EOT
,
mode => '4755',
}
}
|