]> xn--ix-yja.es Git - alex.git/commitdiff
Do not keep everything in 00-common.pp
authoralex <alex@pdp7.net>
Sun, 15 Jan 2023 19:17:35 +0000 (20:17 +0100)
committeralex <alex@pdp7.net>
Sun, 15 Jan 2023 19:17:35 +0000 (20:17 +0100)
personal_infra/puppet/site/00-common.pp
personal_infra/puppet/site/01-tinc.pp [new file with mode: 0644]

index b542eb9e1569e7252845d907cf4f5e5e3f35ee8d..080c75474a9a1fb8edf5b6d85b1198e5cf320409 100644 (file)
@@ -1,28 +1 @@
 include automatic_updates
-
-$tinc_hosts = lookup("groups.tinc")
-$tinc_other_hosts = $tinc_hosts.filter |$host_name| { $host_name != $facts["networking"]["fqdn"] }
-
-$tinc_locations = Hash($tinc_hosts.map |$host_name| { [
-  lookup("hostvars.'$host_name'.network.tinc.location"),
-  {
-    subnet => lookup("hostvars.'$host_name'.network.self_internal_network"),
-    address => lookup("hostvars.'$host_name'.network.public_hostname"),
-  }
-] })
-
-$tinc_connect_to = $tinc_other_hosts.map |$host_name| { lookup("hostvars.'$host_name'.network.tinc.location") }
-
-$tinc_other_networks = $tinc_other_hosts.map |$host_name| { lookup("hostvars.'$host_name'.network.self_internal_network") }
-
-if 'tinc' in lookup("group_names") {
-  class {'tinc':
-    tinc_name           => lookup("tinc_global.name"),
-    tinc_location       => lookup("network.tinc.location"),
-    tinc_connect_to     => $tinc_connect_to,
-    tinc_locations      => $tinc_locations,
-    tinc_ip             => lookup("network.self_internal_ip"),
-    tinc_netmask        => lookup("network.self_internal_netmask"),
-    tinc_other_networks => $tinc_other_networks,
-  }
-}
diff --git a/personal_infra/puppet/site/01-tinc.pp b/personal_infra/puppet/site/01-tinc.pp
new file mode 100644 (file)
index 0000000..148e598
--- /dev/null
@@ -0,0 +1,26 @@
+$tinc_hosts = lookup("groups.tinc")
+$tinc_other_hosts = $tinc_hosts.filter |$host_name| { $host_name != $facts["networking"]["fqdn"] }
+
+$tinc_locations = Hash($tinc_hosts.map |$host_name| { [
+  lookup("hostvars.'$host_name'.network.tinc.location"),
+  {
+    subnet => lookup("hostvars.'$host_name'.network.self_internal_network"),
+    address => lookup("hostvars.'$host_name'.network.public_hostname"),
+  }
+] })
+
+$tinc_connect_to = $tinc_other_hosts.map |$host_name| { lookup("hostvars.'$host_name'.network.tinc.location") }
+
+$tinc_other_networks = $tinc_other_hosts.map |$host_name| { lookup("hostvars.'$host_name'.network.self_internal_network") }
+
+if 'tinc' in lookup("group_names") {
+  class {'tinc':
+    tinc_name           => lookup("tinc_global.name"),
+    tinc_location       => lookup("network.tinc.location"),
+    tinc_connect_to     => $tinc_connect_to,
+    tinc_locations      => $tinc_locations,
+    tinc_ip             => lookup("network.self_internal_ip"),
+    tinc_netmask        => lookup("network.self_internal_netmask"),
+    tinc_other_networks => $tinc_other_networks,
+  }
+}