aboutsummaryrefslogtreecommitdiff
path: root/personal_infra/puppet/modules/proxmox/manifests
diff options
context:
space:
mode:
authoralex <alex@pdp7.net>2023-03-05 20:42:33 +0100
committeralex <alex@pdp7.net>2023-03-05 20:42:33 +0100
commitc653ce124758fb2d5f1d6ae1abfb0430ef6a9867 (patch)
tree1b796fefd09fb06e825e488c91428abf334ecb22 /personal_infra/puppet/modules/proxmox/manifests
parente66b3c00b5e96e436d8f62b3b29e5f1e45a9de8e (diff)
Add initial Proxmox proxy
Diffstat (limited to 'personal_infra/puppet/modules/proxmox/manifests')
-rw-r--r--personal_infra/puppet/modules/proxmox/manifests/proxy.pp47
1 files changed, 47 insertions, 0 deletions
diff --git a/personal_infra/puppet/modules/proxmox/manifests/proxy.pp b/personal_infra/puppet/modules/proxmox/manifests/proxy.pp
new file mode 100644
index 00000000..423d5cfa
--- /dev/null
+++ b/personal_infra/puppet/modules/proxmox/manifests/proxy.pp
@@ -0,0 +1,47 @@
+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'].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
+ 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
+
+ mail $mail -s "Restart apache2 on $base_hostname for certificate \$1" </dev/null
+ | EOT
+ ,
+ mode => '0755',
+ }
+}