]> xn--ix-yja.es Git - alex.git/commitdiff
Set up dyndns
authoralex <alex@pdp7.net>
Sun, 6 Oct 2024 19:01:14 +0000 (21:01 +0200)
committeralexpdp7 <alex@corcoles.net>
Sun, 6 Oct 2024 19:02:05 +0000 (21:02 +0200)
personal_infra/puppet/site/01-dyndns.pp [new file with mode: 0644]

diff --git a/personal_infra/puppet/site/01-dyndns.pp b/personal_infra/puppet/site/01-dyndns.pp
new file mode 100644 (file)
index 0000000..d5e994b
--- /dev/null
@@ -0,0 +1,15 @@
+if 'dyndns' in lookup("group_names") {
+  $ddns_secret = lookup({name => 'network.ddns_secret'})
+  $ddns_domain = lookup({name => 'dyndns.domain'})
+  $host_name = lookup({name => 'network.public_hostname'})
+
+  file {"/etc/cron.hourly/route53_dyndns":
+    content => @("EOT")
+    #!/bin/sh
+
+    /usr/bin/curl -s >/dev/null "https://${ddns_domain}.execute-api.eu-central-1.amazonaws.com/prod/updateDdns?host_name=${host_name}&secret=${ddns_secret}"
+    | EOT
+    ,
+    mode => '0755',
+  }
+}