aboutsummaryrefslogtreecommitdiff
path: root/personal_infra/puppet/modules/proxmox/manifests/proxy_host.pp
diff options
context:
space:
mode:
authoralex <alex@pdp7.net>2023-06-03 18:38:07 +0200
committeralex <alex@pdp7.net>2023-06-03 18:38:07 +0200
commitfeb7806c176cb39be01d9a1473ea2957204dad99 (patch)
treeaeebaeba2f7ceffc5c867777c1bdd98aa468cd98 /personal_infra/puppet/modules/proxmox/manifests/proxy_host.pp
parentd7b2b8287ab8cdbc6c0d301543f4b0d6b56a02e7 (diff)
Improve proxmox proxy handling
* Just set proxmox certs instead of notifying and using a cron * Add hosts to copy certs to inside hosts
Diffstat (limited to 'personal_infra/puppet/modules/proxmox/manifests/proxy_host.pp')
-rw-r--r--personal_infra/puppet/modules/proxmox/manifests/proxy_host.pp21
1 files changed, 19 insertions, 2 deletions
diff --git a/personal_infra/puppet/modules/proxmox/manifests/proxy_host.pp b/personal_infra/puppet/modules/proxmox/manifests/proxy_host.pp
index d1c6faf6..9592572c 100644
--- a/personal_infra/puppet/modules/proxmox/manifests/proxy_host.pp
+++ b/personal_infra/puppet/modules/proxmox/manifests/proxy_host.pp
@@ -1,4 +1,4 @@
-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
@@ -11,11 +11,28 @@ define proxmox::proxy_host (String[1] $target) {
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',
+ }
+ }
+
+
}