content => @("EOT"/$)
#!/bin/sh
- mail $mail -s "Restart apache2 on $base_hostname for certificate \$1" </dev/null
+ 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 => '0755',
}
-
- package {'cronic':}
-
- cron {'pve-certs':
- command => "/usr/bin/cronic /usr/bin/pvenode cert set /etc/apache2/md/domains/$base_hostname/pubcert.pem /etc/apache2/md/domains/$base_hostname/privkey.pem --force 1 --restart 1",
- user => 'root',
- special => 'daily',
- }
}
-define proxmox::proxy_host (String[1] $target) {
+define proxmox::proxy_host (String[1] $target, Optional[String[1]] $overwrite_rh_certs) {
file {"/etc/apache2/sites-enabled/$title.conf":
content => @("EOT")
MDomain $title
ProxyPassReverse "/" "$target"
ProxyPreservehost On
SSLProxyEngine on
-
</VirtualHost>
| EOT
,
}
~>
Service['apache2']
+
+ if $overwrite_rh_certs {
+ $pveid = lookup("hostvars.'$overwrite_rh_certs'.proxmox.id");
+
+ file {"/usr/local/bin/notify_md_renewal_hook_$overwrite_rh_certs":
+ content => @("EOT"/$)
+ #!/bin/sh
+
+ cp /etc/apache2/md/domains/$title/pubcert.pem /rpool/data/subvol-$pveid-disk-0/etc/pki/tls/certs/localhost.crt
+ cp /etc/apache2/md/domains/$title/privkey.pem /rpool/data/subvol-$pveid-disk-0/etc/pki/tls/private/localhost.key
+ pct exec $pveid systemctl restart httpd
+ | EOT
+ ,
+ mode => '0755',
+ }
+ }
+
+
}