diff --git a/env/prod/nut.cue b/env/prod/nut.cue index 96f6076..7338b4e 100644 --- a/env/prod/nut.cue +++ b/env/prod/nut.cue @@ -73,7 +73,6 @@ nut: schema.#Nut & { #nut_monitor: { #server: string | *ups_server #username: string - #role: "primary" | *"secondary" monitor: [ for k, v in nut.ups { @@ -82,10 +81,19 @@ nut: schema.#Nut & { powervalue: 1 username: #username password: nut.users[#username].password - role: #role + if #server == "localhost" { + role: "primary" + } + if #server != "localhost" { + role: "secondary" + } } }, ] + shutdowncmd: "systemctl poweroff" + if #server == "localhost" { + notifycmd: "/usr/local/libexec/nut-notify" + } minsupplies: 1 } diff --git a/host/nut0.pyrocufflink.blue.cue b/host/nut0.pyrocufflink.blue.cue index abeeb04..9460779 100644 --- a/host/nut0.pyrocufflink.blue.cue +++ b/host/nut0.pyrocufflink.blue.cue @@ -9,7 +9,6 @@ nut: prod.nut nut: monitor: prod.#nut_monitor & { #server: "localhost" #username: "upsmon" - #role: "primary" } collectd: prod.collectd