diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2021-01-05 19:48:04 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2021-01-05 19:48:04 +0100 |
commit | 9e353ef7af8164d33544a890e60d2049de7d61cb (patch) | |
tree | 15c6d869fc6644742f27673d5c96046379c76546 /src/main/resources | |
parent | 21d9c07211973b7dddc9f445b6d6566bf1d33aa0 (diff) | |
download | rules-sandbox-9e353ef7af8164d33544a890e60d2049de7d61cb.tar.gz rules-sandbox-9e353ef7af8164d33544a890e60d2049de7d61cb.tar.bz2 rules-sandbox-9e353ef7af8164d33544a890e60d2049de7d61cb.tar.xz rules-sandbox-9e353ef7af8164d33544a890e60d2049de7d61cb.zip |
Better sorting.
Diffstat (limited to 'src/main/resources')
-rw-r--r-- | src/main/resources/io/trygvis/rules/acme/acme.drl | 3 | ||||
-rw-r--r-- | src/main/resources/io/trygvis/rules/acme/vpn.drl | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/src/main/resources/io/trygvis/rules/acme/acme.drl b/src/main/resources/io/trygvis/rules/acme/acme.drl index 72d296c..6369c24 100644 --- a/src/main/resources/io/trygvis/rules/acme/acme.drl +++ b/src/main/resources/io/trygvis/rules/acme/acme.drl @@ -5,6 +5,7 @@ import io.trygvis.rules.dba.Cluster; import io.trygvis.rules.dba.Container; declare AcmeServer + name : String machine : Machine end @@ -42,8 +43,10 @@ end rule "Create Acme servers" when $m : Machine(name.startsWith("acme-")) + not(AcmeServer(name == $m.name)) then var s = new AcmeServer(); + s.name = $m.name; s.machine = $m; insert(s) end diff --git a/src/main/resources/io/trygvis/rules/acme/vpn.drl b/src/main/resources/io/trygvis/rules/acme/vpn.drl index 082ecc0..90cdce2 100644 --- a/src/main/resources/io/trygvis/rules/acme/vpn.drl +++ b/src/main/resources/io/trygvis/rules/acme/vpn.drl @@ -48,6 +48,7 @@ rule "Make DNS entries for all VPN hosts" when $h : WgHost() $net : WgNet(name == $h.net) + not(DnsEntry(fqdn == "%s.%s".formatted($h.name, $net.domain), type == "A")) then var fqdn = "%s.%s".formatted($h.name, $net.domain); insert(DnsEntry.a(fqdn)) |