From e84ef1adb8ff0d3b121ea12b2d3e15fa52eb2f00 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Wed, 6 Jan 2021 15:20:40 +0100 Subject: Splitting Main into two runs, Vpn and AcmeApps. --- module/acme/classpath.txt | 2 +- .../main/java/io/trygvis/acme/AcmeAppsMain.java | 13 + .../src/main/java/io/trygvis/acme/VpnMain.java | 6 +- .../acme/src/main/resources/META-INF/kmodule.xml | 10 +- .../main/java/io/trygvis/rules/engine/DbIo.java | 13 +- .../main/java/io/trygvis/rules/engine/Engine.java | 6 +- out/acme/apps.yaml | 272 ++++++++++++ out/acme/wireguard.yaml | 256 +++++++++++ out/phase-1.yaml | 488 --------------------- out/vpn0.yaml | 256 ----------- 10 files changed, 558 insertions(+), 764 deletions(-) create mode 100644 module/acme/src/main/java/io/trygvis/acme/AcmeAppsMain.java create mode 100644 out/acme/apps.yaml create mode 100644 out/acme/wireguard.yaml delete mode 100644 out/phase-1.yaml delete mode 100644 out/vpn0.yaml diff --git a/module/acme/classpath.txt b/module/acme/classpath.txt index 5d086d8..ed8e5f6 100644 --- a/module/acme/classpath.txt +++ b/module/acme/classpath.txt @@ -17,7 +17,7 @@ com.hubspot.jinjava:jinjava:2.5.6:jar com.thoughtworks.xstream:xstream:1.4.14:jar com.zaxxer:SparseBitSet:1.2:jar commons-codec:commons-codec:1.11:jar -commons-io:commons-io:2.6:jar +commons-io:commons-io:2.8.0:jar commons-net:commons-net:2.2:jar io.trygvis.rules-sandbox:ri-engine:1.0-SNAPSHOT:jar io.trygvis.rules-sandbox:ri-wireguard:1.0-SNAPSHOT:jar diff --git a/module/acme/src/main/java/io/trygvis/acme/AcmeAppsMain.java b/module/acme/src/main/java/io/trygvis/acme/AcmeAppsMain.java new file mode 100644 index 0000000..f21ebc3 --- /dev/null +++ b/module/acme/src/main/java/io/trygvis/acme/AcmeAppsMain.java @@ -0,0 +1,13 @@ +package io.trygvis.acme; + +import io.trygvis.rules.engine.Engine; + +import java.io.IOException; + +public class AcmeAppsMain { + public static void main(String[] args) throws IOException { + try (var engine = new Engine("acme-apps", "acme.yaml")) { + engine.io.dump("acme/apps", engine.session.getFactHandles()); + } + } +} diff --git a/module/acme/src/main/java/io/trygvis/acme/VpnMain.java b/module/acme/src/main/java/io/trygvis/acme/VpnMain.java index d5f986d..d6c8061 100644 --- a/module/acme/src/main/java/io/trygvis/acme/VpnMain.java +++ b/module/acme/src/main/java/io/trygvis/acme/VpnMain.java @@ -10,10 +10,8 @@ import java.io.IOException; public class VpnMain { public static void main(String[] args) throws IOException { - try (var engine = new Engine("acme.yaml")) { - engine.io.dump("phase-1", engine.session.getFactHandles()); - - engine.io.dump("vpn0", engine.session.getFactHandles(), (Object o) -> + try (var engine = new Engine("acme-wireguard", "acme.yaml")) { + engine.io.dump("acme/wireguard", engine.session.getFactHandles(), (Object o) -> o.getClass().getName().contains("Wg") || o instanceof Machine || o instanceof DnsEntry diff --git a/module/acme/src/main/resources/META-INF/kmodule.xml b/module/acme/src/main/resources/META-INF/kmodule.xml index 351a25e..da34a59 100644 --- a/module/acme/src/main/resources/META-INF/kmodule.xml +++ b/module/acme/src/main/resources/META-INF/kmodule.xml @@ -3,9 +3,11 @@ xmlns="http://www.drools.org/xsd/kmodule" xsi:schemaLocation="http://www.drools.org/xsd/kmodule https://www.drools.org/xsd/kmodule_7_1.xsd"> - - - + + + + + + diff --git a/module/ri-engine/src/main/java/io/trygvis/rules/engine/DbIo.java b/module/ri-engine/src/main/java/io/trygvis/rules/engine/DbIo.java index b835da5..7f946d9 100644 --- a/module/ri-engine/src/main/java/io/trygvis/rules/engine/DbIo.java +++ b/module/ri-engine/src/main/java/io/trygvis/rules/engine/DbIo.java @@ -1,5 +1,6 @@ package io.trygvis.rules.engine; +import ch.qos.logback.core.util.FileUtil; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.type.TypeFactory; import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; @@ -41,7 +42,7 @@ public class DbIo { var x = mapper.treeToValue(object.data, type); items.add(x); } catch (ClassNotFoundException e) { - throw new IOException(e); + // ignore } } @@ -183,13 +184,9 @@ public class DbIo { } public void dump(String s, Collection factHandles, Function filter) throws IOException { - var out = new File("out"); + var yamlFile = new File("out", s + ".yaml"); - if (!out.isDirectory()) { - if (!out.mkdirs()) { - throw new IOException("Could not create directory: " + out); - } - } + FileUtil.createMissingParentDirectories(yamlFile); var facts = new TreeMap, FactCollection>(Comparator.comparing(Class::getName)); for (var handle : factHandles) { @@ -212,7 +209,7 @@ public class DbIo { } var factory = mapper.getFactory(); - try (var writer = new FileWriter(new File(out, s + ".yaml")); + try (var writer = new FileWriter(yamlFile); var g = factory.createGenerator(writer)) { for (var e : facts.entrySet()) { var name = e.getKey().getName(); diff --git a/module/ri-engine/src/main/java/io/trygvis/rules/engine/Engine.java b/module/ri-engine/src/main/java/io/trygvis/rules/engine/Engine.java index 2565112..f624603 100644 --- a/module/ri-engine/src/main/java/io/trygvis/rules/engine/Engine.java +++ b/module/ri-engine/src/main/java/io/trygvis/rules/engine/Engine.java @@ -13,15 +13,15 @@ public class Engine implements Closeable { public final DbIo io; public final KieSession session; - public Engine(String database) throws IOException { + public Engine(String k, String database) throws IOException { var services = KieServices.Factory.get(); var container = services.getKieClasspathContainer(); - var kieBase = container.getKieBase(); + var kieBase = container.getKieBase(k); io = new DbIo(kieBase); var objects = io.load(database); - session = container.newKieSession(); + session = container.newKieSession(k); session.setGlobal("te", new TemplateEngine()); diff --git a/out/acme/apps.yaml b/out/acme/apps.yaml new file mode 100644 index 0000000..82050eb --- /dev/null +++ b/out/acme/apps.yaml @@ -0,0 +1,272 @@ +--- +type: "io.trygvis.acme.AcmeMyApp" +data: + environment: "ci" + dockerTag: "development" +--- +type: "io.trygvis.acme.AcmeMyApp" +data: + environment: "production" + dockerTag: "master" +--- +type: "io.trygvis.acme.AcmeServer" +data: + name: "acme-1" + machine: + name: "acme-1" + fqdn: "acme-1.machine.acme.com" +--- +type: "io.trygvis.acme.AcmeServer" +data: + name: "acme-2" + machine: + name: "acme-2" + fqdn: "acme-2.machine.acme.com" +--- +type: "io.trygvis.acme.AcmeServer" +data: + name: "acme-3" + machine: + name: "acme-3" + fqdn: "acme-3.machine.acme.com" +--- +type: "io.trygvis.rules.dba.Cluster" +data: + name: "acme-ci" +--- +type: "io.trygvis.rules.dba.Cluster" +data: + name: "acme-production" +--- +type: "io.trygvis.rules.dba.Container" +data: + cluster: + name: "acme-ci" + name: "app" + machineRole: "4tune-api" + image: "4tune-api" + tag: "development" +--- +type: "io.trygvis.rules.dba.Container" +data: + cluster: + name: "acme-production" + name: "app" + machineRole: "4tune-api" + image: "4tune-api" + tag: "master" +--- +type: "io.trygvis.rules.dba.Container" +data: + cluster: + name: "acme-ci" + name: "app" + machineRole: "4tune-web" + image: "4tune-web" + tag: "development" +--- +type: "io.trygvis.rules.dba.Container" +data: + cluster: + name: "acme-production" + name: "app" + machineRole: "4tune-web" + image: "4tune-web" + tag: "master" +--- +type: "io.trygvis.rules.dba.Container" +data: + cluster: + name: "acme-ci" + name: "app" + machineRole: "statera" + image: "statera" + tag: "development" +--- +type: "io.trygvis.rules.dba.Container" +data: + cluster: + name: "acme-production" + name: "app" + machineRole: "statera" + image: "statera" + tag: "master" +--- +type: "io.trygvis.rules.dba.Container" +data: + cluster: + name: "acme-ci" + name: "app" + machineRole: "statera-console" + image: "statera-console" + tag: "development" +--- +type: "io.trygvis.rules.dba.Container" +data: + cluster: + name: "acme-production" + name: "app" + machineRole: "statera-console" + image: "statera-console" + tag: "master" +--- +type: "io.trygvis.rules.dba.Container" +data: + cluster: + name: "acme-production" + name: "db" + machineRole: "mdb" + image: "mongodb" + tag: "3.2" +--- +type: "io.trygvis.rules.dba.Container" +data: + cluster: + name: "acme-ci" + name: "db" + machineRole: "mdb" + image: "mongodb" + tag: "3.2" +--- +type: "io.trygvis.rules.dba.Container" +data: + cluster: + name: "acme-production" + name: "db" + machineRole: "pdb" + image: "postgresql" + tag: "13" +--- +type: "io.trygvis.rules.dba.Container" +data: + cluster: + name: "acme-ci" + name: "db" + machineRole: "pdb" + image: "postgresql" + tag: "13" +--- +type: "io.trygvis.rules.dns.DnsEntry" +data: + fqdn: "acme-1.machine.acme.com" + type: "A" +--- +type: "io.trygvis.rules.dns.DnsEntry" +data: + fqdn: "acme-2.machine.acme.com" + type: "A" +--- +type: "io.trygvis.rules.dns.DnsEntry" +data: + fqdn: "acme-3.machine.acme.com" + type: "A" +--- +type: "io.trygvis.rules.dns.DnsEntryTerraformExpression" +data: + entry: + fqdn: "acme-1.machine.acme.com" + type: "A" + key: "acme-1" + expression: "scaleway_instance_ip.acme-1.address" +--- +type: "io.trygvis.rules.dns.DnsEntryTerraformExpression" +data: + entry: + fqdn: "acme-2.machine.acme.com" + type: "A" + key: "acme-2" + expression: "scaleway_instance_ip.acme-2.address" +--- +type: "io.trygvis.rules.dns.DnsEntryTerraformExpression" +data: + entry: + fqdn: "acme-3.machine.acme.com" + type: "A" + key: "acme-3" + expression: "scaleway_instance_ip.acme-3.address" +--- +type: "io.trygvis.rules.engine.KeyValue" +data: + key: "rm-gen" + value: null +--- +type: "io.trygvis.rules.machine.Machine" +data: + name: "acme-1" + fqdn: "acme-1.machine.acme.com" +--- +type: "io.trygvis.rules.machine.Machine" +data: + name: "acme-2" + fqdn: "acme-2.machine.acme.com" +--- +type: "io.trygvis.rules.machine.Machine" +data: + name: "acme-3" + fqdn: "acme-3.machine.acme.com" +--- +type: "io.trygvis.rules.machine.Machine" +data: + name: "ws-1" + fqdn: null +--- +type: "io.trygvis.rules.machine.Machine" +data: + name: "ws-2" + fqdn: null +--- +type: "io.trygvis.rules.terraform.ScalewayMachine" +data: + machine: + name: "acme-1" + fqdn: "acme-1.machine.acme.com" + key: "acme-1" +--- +type: "io.trygvis.rules.terraform.ScalewayMachine" +data: + machine: + name: "acme-1" + fqdn: "acme-1.machine.acme.com" + key: "acme-1" +--- +type: "io.trygvis.rules.terraform.ScalewayMachine" +data: + machine: + name: "acme-2" + fqdn: "acme-2.machine.acme.com" + key: "acme-2" +--- +type: "io.trygvis.rules.terraform.ScalewayMachine" +data: + machine: + name: "acme-2" + fqdn: "acme-2.machine.acme.com" + key: "acme-2" +--- +type: "io.trygvis.rules.terraform.ScalewayMachine" +data: + machine: + name: "acme-3" + fqdn: "acme-3.machine.acme.com" + key: "acme-3" +--- +type: "io.trygvis.rules.terraform.ScalewayMachine" +data: + machine: + name: "acme-3" + fqdn: "acme-3.machine.acme.com" + key: "acme-3" +--- +type: "io.trygvis.rules.terraform.ScalewayMachine" +data: + machine: + name: "ws-1" + fqdn: null + key: "ws-1" +--- +type: "io.trygvis.rules.terraform.ScalewayMachine" +data: + machine: + name: "ws-2" + fqdn: null + key: "ws-2" diff --git a/out/acme/wireguard.yaml b/out/acme/wireguard.yaml new file mode 100644 index 0000000..4601931 --- /dev/null +++ b/out/acme/wireguard.yaml @@ -0,0 +1,256 @@ +--- +type: "io.trygvis.rules.dns.DnsEntry" +data: + fqdn: "acme-1.machine.acme.com" + type: "A" +--- +type: "io.trygvis.rules.dns.DnsEntry" +data: + fqdn: "acme-1.vpn.acme.com" + type: "A" +--- +type: "io.trygvis.rules.dns.DnsEntry" +data: + fqdn: "acme-2.machine.acme.com" + type: "A" +--- +type: "io.trygvis.rules.dns.DnsEntry" +data: + fqdn: "acme-2.vpn.acme.com" + type: "A" +--- +type: "io.trygvis.rules.dns.DnsEntry" +data: + fqdn: "acme-3.machine.acme.com" + type: "A" +--- +type: "io.trygvis.rules.dns.DnsEntry" +data: + fqdn: "acme-3.vpn.acme.com" + type: "A" +--- +type: "io.trygvis.rules.dns.DnsEntry" +data: + fqdn: "ws-1.vpn.acme.com" + type: "A" +--- +type: "io.trygvis.rules.dns.DnsEntry" +data: + fqdn: "ws-2.vpn.acme.com" + type: "A" +--- +type: "io.trygvis.rules.machine.Machine" +data: + name: "acme-1" + fqdn: "acme-1.machine.acme.com" +--- +type: "io.trygvis.rules.machine.Machine" +data: + name: "acme-2" + fqdn: "acme-2.machine.acme.com" +--- +type: "io.trygvis.rules.machine.Machine" +data: + name: "acme-3" + fqdn: "acme-3.machine.acme.com" +--- +type: "io.trygvis.rules.machine.Machine" +data: + name: "ws-1" + fqdn: null +--- +type: "io.trygvis.rules.machine.Machine" +data: + name: "ws-2" + fqdn: null +--- +type: "io.trygvis.rules.wireguard.WgConnection" +data: + host: "acme-1" + to: "acme-2" +--- +type: "io.trygvis.rules.wireguard.WgConnection" +data: + host: "acme-1" + to: "acme-3" +--- +type: "io.trygvis.rules.wireguard.WgConnection" +data: + host: "acme-2" + to: "acme-1" +--- +type: "io.trygvis.rules.wireguard.WgConnection" +data: + host: "acme-2" + to: "acme-3" +--- +type: "io.trygvis.rules.wireguard.WgConnection" +data: + host: "acme-3" + to: "acme-1" +--- +type: "io.trygvis.rules.wireguard.WgConnection" +data: + host: "acme-3" + to: "acme-2" +--- +type: "io.trygvis.rules.wireguard.WgConnection" +data: + host: "ws-1" + to: "acme-1" +--- +type: "io.trygvis.rules.wireguard.WgConnection" +data: + host: "ws-1" + to: "acme-2" +--- +type: "io.trygvis.rules.wireguard.WgConnection" +data: + host: "ws-1" + to: "acme-3" +--- +type: "io.trygvis.rules.wireguard.WgConnection" +data: + host: "ws-2" + to: "acme-1" +--- +type: "io.trygvis.rules.wireguard.WgConnection" +data: + host: "ws-2" + to: "acme-2" +--- +type: "io.trygvis.rules.wireguard.WgConnection" +data: + host: "ws-2" + to: "acme-3" +--- +type: "io.trygvis.rules.wireguard.WgHost" +data: + name: "acme-1" + net: "vpn0" + publicName: "acme-1.machine.acme.com" + netToNetIp: null + networkIp: null +--- +type: "io.trygvis.rules.wireguard.WgHost" +data: + name: "acme-2" + net: "vpn0" + publicName: "acme-2.machine.acme.com" + netToNetIp: null + networkIp: null +--- +type: "io.trygvis.rules.wireguard.WgHost" +data: + name: "acme-3" + net: "vpn0" + publicName: "acme-3.machine.acme.com" + netToNetIp: null + networkIp: null +--- +type: "io.trygvis.rules.wireguard.WgHost" +data: + name: "ws-1" + net: "vpn0" + publicName: null + netToNetIp: null + networkIp: null +--- +type: "io.trygvis.rules.wireguard.WgHost" +data: + name: "ws-2" + net: "vpn0" + publicName: null + netToNetIp: null + networkIp: null +--- +type: "io.trygvis.rules.wireguard.WgIpAllocation" +data: + host: "acme-1" + role: "link" + ip: + value: "192.168.10.4" +--- +type: "io.trygvis.rules.wireguard.WgIpAllocation" +data: + host: "acme-1" + role: "network" + ip: + value: "10.55.55.4" +--- +type: "io.trygvis.rules.wireguard.WgIpAllocation" +data: + host: "acme-2" + role: "link" + ip: + value: "192.168.10.3" +--- +type: "io.trygvis.rules.wireguard.WgIpAllocation" +data: + host: "acme-2" + role: "network" + ip: + value: "10.55.55.3" +--- +type: "io.trygvis.rules.wireguard.WgIpAllocation" +data: + host: "acme-3" + role: "link" + ip: + value: "192.168.10.2" +--- +type: "io.trygvis.rules.wireguard.WgIpAllocation" +data: + host: "acme-3" + role: "network" + ip: + value: "10.55.55.2" +--- +type: "io.trygvis.rules.wireguard.WgIpAllocation" +data: + host: "ws-1" + role: "link" + ip: + value: "192.168.10.1" +--- +type: "io.trygvis.rules.wireguard.WgIpAllocation" +data: + host: "ws-1" + role: "network" + ip: + value: "10.55.55.1" +--- +type: "io.trygvis.rules.wireguard.WgIpAllocation" +data: + host: "ws-2" + role: "link" + ip: + value: "192.168.10.0" +--- +type: "io.trygvis.rules.wireguard.WgIpAllocation" +data: + host: "ws-2" + role: "network" + ip: + value: "10.55.55.0" +--- +type: "io.trygvis.rules.wireguard.WgIpPool" +data: + net: "vpn0" + role: "link" + cidr: + value: "192.168.10.0/29" +--- +type: "io.trygvis.rules.wireguard.WgIpPool" +data: + net: "vpn0" + role: "network" + cidr: + value: "10.55.55.0/24" +--- +type: "io.trygvis.rules.wireguard.WgNet" +data: + name: "vpn0" + domain: "vpn.acme.com" + linkCidr: "192.168.10.0/29" + networkCidr: "10.55.55.0/24" diff --git a/out/phase-1.yaml b/out/phase-1.yaml deleted file mode 100644 index 91b0524..0000000 --- a/out/phase-1.yaml +++ /dev/null @@ -1,488 +0,0 @@ ---- -type: "io.trygvis.acme.AcmeMyApp" -data: - environment: "ci" - dockerTag: "development" ---- -type: "io.trygvis.acme.AcmeMyApp" -data: - environment: "production" - dockerTag: "master" ---- -type: "io.trygvis.acme.AcmeServer" -data: - name: "acme-1" - machine: - name: "acme-1" - fqdn: "acme-1.machine.acme.com" ---- -type: "io.trygvis.acme.AcmeServer" -data: - name: "acme-2" - machine: - name: "acme-2" - fqdn: "acme-2.machine.acme.com" ---- -type: "io.trygvis.acme.AcmeServer" -data: - name: "acme-3" - machine: - name: "acme-3" - fqdn: "acme-3.machine.acme.com" ---- -type: "io.trygvis.rules.dba.Cluster" -data: - name: "acme-ci" ---- -type: "io.trygvis.rules.dba.Cluster" -data: - name: "acme-production" ---- -type: "io.trygvis.rules.dba.Container" -data: - cluster: - name: "acme-ci" - name: "app" - machineRole: "4tune-api" - image: "4tune-api" - tag: "development" ---- -type: "io.trygvis.rules.dba.Container" -data: - cluster: - name: "acme-production" - name: "app" - machineRole: "4tune-api" - image: "4tune-api" - tag: "master" ---- -type: "io.trygvis.rules.dba.Container" -data: - cluster: - name: "acme-ci" - name: "app" - machineRole: "4tune-web" - image: "4tune-web" - tag: "development" ---- -type: "io.trygvis.rules.dba.Container" -data: - cluster: - name: "acme-production" - name: "app" - machineRole: "4tune-web" - image: "4tune-web" - tag: "master" ---- -type: "io.trygvis.rules.dba.Container" -data: - cluster: - name: "acme-ci" - name: "app" - machineRole: "statera" - image: "statera" - tag: "development" ---- -type: "io.trygvis.rules.dba.Container" -data: - cluster: - name: "acme-production" - name: "app" - machineRole: "statera" - image: "statera" - tag: "master" ---- -type: "io.trygvis.rules.dba.Container" -data: - cluster: - name: "acme-ci" - name: "app" - machineRole: "statera-console" - image: "statera-console" - tag: "development" ---- -type: "io.trygvis.rules.dba.Container" -data: - cluster: - name: "acme-production" - name: "app" - machineRole: "statera-console" - image: "statera-console" - tag: "master" ---- -type: "io.trygvis.rules.dba.Container" -data: - cluster: - name: "acme-production" - name: "db" - machineRole: "mdb" - image: "mongodb" - tag: "3.2" ---- -type: "io.trygvis.rules.dba.Container" -data: - cluster: - name: "acme-ci" - name: "db" - machineRole: "mdb" - image: "mongodb" - tag: "3.2" ---- -type: "io.trygvis.rules.dba.Container" -data: - cluster: - name: "acme-production" - name: "db" - machineRole: "pdb" - image: "postgresql" - tag: "13" ---- -type: "io.trygvis.rules.dba.Container" -data: - cluster: - name: "acme-ci" - name: "db" - machineRole: "pdb" - image: "postgresql" - tag: "13" ---- -type: "io.trygvis.rules.dns.DnsEntry" -data: - fqdn: "acme-1.machine.acme.com" - type: "A" ---- -type: "io.trygvis.rules.dns.DnsEntry" -data: - fqdn: "acme-1.vpn.acme.com" - type: "A" ---- -type: "io.trygvis.rules.dns.DnsEntry" -data: - fqdn: "acme-2.machine.acme.com" - type: "A" ---- -type: "io.trygvis.rules.dns.DnsEntry" -data: - fqdn: "acme-2.vpn.acme.com" - type: "A" ---- -type: "io.trygvis.rules.dns.DnsEntry" -data: - fqdn: "acme-3.machine.acme.com" - type: "A" ---- -type: "io.trygvis.rules.dns.DnsEntry" -data: - fqdn: "acme-3.vpn.acme.com" - type: "A" ---- -type: "io.trygvis.rules.dns.DnsEntry" -data: - fqdn: "ws-1.vpn.acme.com" - type: "A" ---- -type: "io.trygvis.rules.dns.DnsEntry" -data: - fqdn: "ws-2.vpn.acme.com" - type: "A" ---- -type: "io.trygvis.rules.dns.DnsEntryTerraformExpression" -data: - entry: - fqdn: "acme-1.machine.acme.com" - type: "A" - key: "acme-1" - expression: "scaleway_instance_ip.acme-1.address" ---- -type: "io.trygvis.rules.dns.DnsEntryTerraformExpression" -data: - entry: - fqdn: "acme-2.machine.acme.com" - type: "A" - key: "acme-2" - expression: "scaleway_instance_ip.acme-2.address" ---- -type: "io.trygvis.rules.dns.DnsEntryTerraformExpression" -data: - entry: - fqdn: "acme-3.machine.acme.com" - type: "A" - key: "acme-3" - expression: "scaleway_instance_ip.acme-3.address" ---- -type: "io.trygvis.rules.engine.KeyValue" -data: - key: "rm-gen" - value: null ---- -type: "io.trygvis.rules.machine.Machine" -data: - name: "acme-1" - fqdn: "acme-1.machine.acme.com" ---- -type: "io.trygvis.rules.machine.Machine" -data: - name: "acme-2" - fqdn: "acme-2.machine.acme.com" ---- -type: "io.trygvis.rules.machine.Machine" -data: - name: "acme-3" - fqdn: "acme-3.machine.acme.com" ---- -type: "io.trygvis.rules.machine.Machine" -data: - name: "ws-1" - fqdn: null ---- -type: "io.trygvis.rules.machine.Machine" -data: - name: "ws-2" - fqdn: null ---- -type: "io.trygvis.rules.terraform.ScalewayMachine" -data: - machine: - name: "acme-1" - fqdn: "acme-1.machine.acme.com" - key: "acme-1" ---- -type: "io.trygvis.rules.terraform.ScalewayMachine" -data: - machine: - name: "acme-1" - fqdn: "acme-1.machine.acme.com" - key: "acme-1" ---- -type: "io.trygvis.rules.terraform.ScalewayMachine" -data: - machine: - name: "acme-2" - fqdn: "acme-2.machine.acme.com" - key: "acme-2" ---- -type: "io.trygvis.rules.terraform.ScalewayMachine" -data: - machine: - name: "acme-2" - fqdn: "acme-2.machine.acme.com" - key: "acme-2" ---- -type: "io.trygvis.rules.terraform.ScalewayMachine" -data: - machine: - name: "acme-3" - fqdn: "acme-3.machine.acme.com" - key: "acme-3" ---- -type: "io.trygvis.rules.terraform.ScalewayMachine" -data: - machine: - name: "acme-3" - fqdn: "acme-3.machine.acme.com" - key: "acme-3" ---- -type: "io.trygvis.rules.terraform.ScalewayMachine" -data: - machine: - name: "ws-1" - fqdn: null - key: "ws-1" ---- -type: "io.trygvis.rules.terraform.ScalewayMachine" -data: - machine: - name: "ws-2" - fqdn: null - key: "ws-2" ---- -type: "io.trygvis.rules.wireguard.WgConnection" -data: - host: "acme-1" - to: "acme-2" ---- -type: "io.trygvis.rules.wireguard.WgConnection" -data: - host: "acme-1" - to: "acme-3" ---- -type: "io.trygvis.rules.wireguard.WgConnection" -data: - host: "acme-2" - to: "acme-1" ---- -type: "io.trygvis.rules.wireguard.WgConnection" -data: - host: "acme-2" - to: "acme-3" ---- -type: "io.trygvis.rules.wireguard.WgConnection" -data: - host: "acme-3" - to: "acme-1" ---- -type: "io.trygvis.rules.wireguard.WgConnection" -data: - host: "acme-3" - to: "acme-2" ---- -type: "io.trygvis.rules.wireguard.WgConnection" -data: - host: "ws-1" - to: "acme-1" ---- -type: "io.trygvis.rules.wireguard.WgConnection" -data: - host: "ws-1" - to: "acme-2" ---- -type: "io.trygvis.rules.wireguard.WgConnection" -data: - host: "ws-1" - to: "acme-3" ---- -type: "io.trygvis.rules.wireguard.WgConnection" -data: - host: "ws-2" - to: "acme-1" ---- -type: "io.trygvis.rules.wireguard.WgConnection" -data: - host: "ws-2" - to: "acme-2" ---- -type: "io.trygvis.rules.wireguard.WgConnection" -data: - host: "ws-2" - to: "acme-3" ---- -type: "io.trygvis.rules.wireguard.WgHost" -data: - name: "acme-1" - net: "vpn0" - publicName: "acme-1.machine.acme.com" - netToNetIp: null - networkIp: null ---- -type: "io.trygvis.rules.wireguard.WgHost" -data: - name: "acme-2" - net: "vpn0" - publicName: "acme-2.machine.acme.com" - netToNetIp: null - networkIp: null ---- -type: "io.trygvis.rules.wireguard.WgHost" -data: - name: "acme-3" - net: "vpn0" - publicName: "acme-3.machine.acme.com" - netToNetIp: null - networkIp: null ---- -type: "io.trygvis.rules.wireguard.WgHost" -data: - name: "ws-1" - net: "vpn0" - publicName: null - netToNetIp: null - networkIp: null ---- -type: "io.trygvis.rules.wireguard.WgHost" -data: - name: "ws-2" - net: "vpn0" - publicName: null - netToNetIp: null - networkIp: null ---- -type: "io.trygvis.rules.wireguard.WgIpAllocation" -data: - host: "acme-1" - role: "link" - ip: - value: "192.168.10.4" ---- -type: "io.trygvis.rules.wireguard.WgIpAllocation" -data: - host: "acme-1" - role: "network" - ip: - value: "10.55.55.4" ---- -type: "io.trygvis.rules.wireguard.WgIpAllocation" -data: - host: "acme-2" - role: "link" - ip: - value: "192.168.10.3" ---- -type: "io.trygvis.rules.wireguard.WgIpAllocation" -data: - host: "acme-2" - role: "network" - ip: - value: "10.55.55.3" ---- -type: "io.trygvis.rules.wireguard.WgIpAllocation" -data: - host: "acme-3" - role: "link" - ip: - value: "192.168.10.2" ---- -type: "io.trygvis.rules.wireguard.WgIpAllocation" -data: - host: "acme-3" - role: "network" - ip: - value: "10.55.55.2" ---- -type: "io.trygvis.rules.wireguard.WgIpAllocation" -data: - host: "ws-1" - role: "link" - ip: - value: "192.168.10.1" ---- -type: "io.trygvis.rules.wireguard.WgIpAllocation" -data: - host: "ws-1" - role: "network" - ip: - value: "10.55.55.1" ---- -type: "io.trygvis.rules.wireguard.WgIpAllocation" -data: - host: "ws-2" - role: "link" - ip: - value: "192.168.10.0" ---- -type: "io.trygvis.rules.wireguard.WgIpAllocation" -data: - host: "ws-2" - role: "network" - ip: - value: "10.55.55.0" ---- -type: "io.trygvis.rules.wireguard.WgIpPool" -data: - net: "vpn0" - role: "link" - cidr: - value: "192.168.10.0/29" ---- -type: "io.trygvis.rules.wireguard.WgIpPool" -data: - net: "vpn0" - role: "network" - cidr: - value: "10.55.55.0/24" ---- -type: "io.trygvis.rules.wireguard.WgNet" -data: - name: "vpn0" - domain: "vpn.acme.com" - linkCidr: "192.168.10.0/29" - networkCidr: "10.55.55.0/24" diff --git a/out/vpn0.yaml b/out/vpn0.yaml deleted file mode 100644 index 4601931..0000000 --- a/out/vpn0.yaml +++ /dev/null @@ -1,256 +0,0 @@ ---- -type: "io.trygvis.rules.dns.DnsEntry" -data: - fqdn: "acme-1.machine.acme.com" - type: "A" ---- -type: "io.trygvis.rules.dns.DnsEntry" -data: - fqdn: "acme-1.vpn.acme.com" - type: "A" ---- -type: "io.trygvis.rules.dns.DnsEntry" -data: - fqdn: "acme-2.machine.acme.com" - type: "A" ---- -type: "io.trygvis.rules.dns.DnsEntry" -data: - fqdn: "acme-2.vpn.acme.com" - type: "A" ---- -type: "io.trygvis.rules.dns.DnsEntry" -data: - fqdn: "acme-3.machine.acme.com" - type: "A" ---- -type: "io.trygvis.rules.dns.DnsEntry" -data: - fqdn: "acme-3.vpn.acme.com" - type: "A" ---- -type: "io.trygvis.rules.dns.DnsEntry" -data: - fqdn: "ws-1.vpn.acme.com" - type: "A" ---- -type: "io.trygvis.rules.dns.DnsEntry" -data: - fqdn: "ws-2.vpn.acme.com" - type: "A" ---- -type: "io.trygvis.rules.machine.Machine" -data: - name: "acme-1" - fqdn: "acme-1.machine.acme.com" ---- -type: "io.trygvis.rules.machine.Machine" -data: - name: "acme-2" - fqdn: "acme-2.machine.acme.com" ---- -type: "io.trygvis.rules.machine.Machine" -data: - name: "acme-3" - fqdn: "acme-3.machine.acme.com" ---- -type: "io.trygvis.rules.machine.Machine" -data: - name: "ws-1" - fqdn: null ---- -type: "io.trygvis.rules.machine.Machine" -data: - name: "ws-2" - fqdn: null ---- -type: "io.trygvis.rules.wireguard.WgConnection" -data: - host: "acme-1" - to: "acme-2" ---- -type: "io.trygvis.rules.wireguard.WgConnection" -data: - host: "acme-1" - to: "acme-3" ---- -type: "io.trygvis.rules.wireguard.WgConnection" -data: - host: "acme-2" - to: "acme-1" ---- -type: "io.trygvis.rules.wireguard.WgConnection" -data: - host: "acme-2" - to: "acme-3" ---- -type: "io.trygvis.rules.wireguard.WgConnection" -data: - host: "acme-3" - to: "acme-1" ---- -type: "io.trygvis.rules.wireguard.WgConnection" -data: - host: "acme-3" - to: "acme-2" ---- -type: "io.trygvis.rules.wireguard.WgConnection" -data: - host: "ws-1" - to: "acme-1" ---- -type: "io.trygvis.rules.wireguard.WgConnection" -data: - host: "ws-1" - to: "acme-2" ---- -type: "io.trygvis.rules.wireguard.WgConnection" -data: - host: "ws-1" - to: "acme-3" ---- -type: "io.trygvis.rules.wireguard.WgConnection" -data: - host: "ws-2" - to: "acme-1" ---- -type: "io.trygvis.rules.wireguard.WgConnection" -data: - host: "ws-2" - to: "acme-2" ---- -type: "io.trygvis.rules.wireguard.WgConnection" -data: - host: "ws-2" - to: "acme-3" ---- -type: "io.trygvis.rules.wireguard.WgHost" -data: - name: "acme-1" - net: "vpn0" - publicName: "acme-1.machine.acme.com" - netToNetIp: null - networkIp: null ---- -type: "io.trygvis.rules.wireguard.WgHost" -data: - name: "acme-2" - net: "vpn0" - publicName: "acme-2.machine.acme.com" - netToNetIp: null - networkIp: null ---- -type: "io.trygvis.rules.wireguard.WgHost" -data: - name: "acme-3" - net: "vpn0" - publicName: "acme-3.machine.acme.com" - netToNetIp: null - networkIp: null ---- -type: "io.trygvis.rules.wireguard.WgHost" -data: - name: "ws-1" - net: "vpn0" - publicName: null - netToNetIp: null - networkIp: null ---- -type: "io.trygvis.rules.wireguard.WgHost" -data: - name: "ws-2" - net: "vpn0" - publicName: null - netToNetIp: null - networkIp: null ---- -type: "io.trygvis.rules.wireguard.WgIpAllocation" -data: - host: "acme-1" - role: "link" - ip: - value: "192.168.10.4" ---- -type: "io.trygvis.rules.wireguard.WgIpAllocation" -data: - host: "acme-1" - role: "network" - ip: - value: "10.55.55.4" ---- -type: "io.trygvis.rules.wireguard.WgIpAllocation" -data: - host: "acme-2" - role: "link" - ip: - value: "192.168.10.3" ---- -type: "io.trygvis.rules.wireguard.WgIpAllocation" -data: - host: "acme-2" - role: "network" - ip: - value: "10.55.55.3" ---- -type: "io.trygvis.rules.wireguard.WgIpAllocation" -data: - host: "acme-3" - role: "link" - ip: - value: "192.168.10.2" ---- -type: "io.trygvis.rules.wireguard.WgIpAllocation" -data: - host: "acme-3" - role: "network" - ip: - value: "10.55.55.2" ---- -type: "io.trygvis.rules.wireguard.WgIpAllocation" -data: - host: "ws-1" - role: "link" - ip: - value: "192.168.10.1" ---- -type: "io.trygvis.rules.wireguard.WgIpAllocation" -data: - host: "ws-1" - role: "network" - ip: - value: "10.55.55.1" ---- -type: "io.trygvis.rules.wireguard.WgIpAllocation" -data: - host: "ws-2" - role: "link" - ip: - value: "192.168.10.0" ---- -type: "io.trygvis.rules.wireguard.WgIpAllocation" -data: - host: "ws-2" - role: "network" - ip: - value: "10.55.55.0" ---- -type: "io.trygvis.rules.wireguard.WgIpPool" -data: - net: "vpn0" - role: "link" - cidr: - value: "192.168.10.0/29" ---- -type: "io.trygvis.rules.wireguard.WgIpPool" -data: - net: "vpn0" - role: "network" - cidr: - value: "10.55.55.0/24" ---- -type: "io.trygvis.rules.wireguard.WgNet" -data: - name: "vpn0" - domain: "vpn.acme.com" - linkCidr: "192.168.10.0/29" - networkCidr: "10.55.55.0/24" -- cgit v1.2.3