Add netbox psql DB
This commit is contained in:
parent
332f8beab5
commit
e66bc8fd7b
5 changed files with 67 additions and 22 deletions
|
@ -31,8 +31,8 @@ in {
|
|||
file = ./secrets/grafanaDBPass.age;
|
||||
owner = "postgres";
|
||||
};
|
||||
onlyofficeDBPass = {
|
||||
file = ./secrets/onlyofficeDBPass.age;
|
||||
netboxDBPass = {
|
||||
file = ./secrets/netboxDBPass.age;
|
||||
owner = "postgres";
|
||||
};
|
||||
};
|
||||
|
@ -64,7 +64,7 @@ in {
|
|||
host gitea gitea 192.168.1.14/32 md5
|
||||
host authentik authentik 192.168.1.125/32 md5
|
||||
host grafana grafana 192.168.1.27/32 md5
|
||||
host onlyoffice onlyoffice 192.168.1.46/32 md5
|
||||
host netbox netbox 192.168.1.90/32 md5
|
||||
";
|
||||
initialScript = pkgs.writeText "init-sql-script" ''
|
||||
CREATE ROLE nextcloud WITH LOGIN CREATEDB;
|
||||
|
@ -83,9 +83,9 @@ in {
|
|||
CREATE DATABASE grafana;
|
||||
GRANT ALL PRIVILEGES ON DATABASE grafana TO grafana;
|
||||
|
||||
CREATE ROLE onlyoffice WITH LOGIN CREATEDB;
|
||||
CREATE DATABASE onlyoffice;
|
||||
GRANT ALL PRIVILEGES ON DATABASE onlyoffice TO onlyoffice;
|
||||
CREATE ROLE netbox WITH LOGIN CREATEDB;
|
||||
CREATE DATABASE netbox;
|
||||
GRANT ALL PRIVILEGES ON DATABASE netbox TO netbox;
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
@ -96,7 +96,7 @@ in {
|
|||
giteaDBPass = config.age.secrets.giteaDBPass.path;
|
||||
authentikDBPass = config.age.secrets.authentikDBPass.path;
|
||||
grafanaDBPass = config.age.secrets.grafanaDBPass.path;
|
||||
onlyofficeDBPass = config.age.secrets.onlyofficeDBPass.path;
|
||||
netboxDBPass = config.age.secrets.netboxDBPass.path;
|
||||
in ''
|
||||
$PSQL -tA <<'EOF'
|
||||
DO $$
|
||||
|
@ -114,8 +114,8 @@ in {
|
|||
password := trim(both from replace(pg_read_file('${grafanaDBPass}'), E'\n', '''));
|
||||
EXECUTE format('ALTER ROLE grafana WITH PASSWORD '''%s''';', password);
|
||||
|
||||
password := trim(both from replace(pg_read_file('${onlyofficeDBPass}'), E'\n', '''));
|
||||
EXECUTE format('ALTER ROLE onlyoffice WITH PASSWORD '''%s''';', password);
|
||||
password := trim(both from replace(pg_read_file('${netboxDBPass}'), E'\n', '''));
|
||||
EXECUTE format('ALTER ROLE netbox WITH PASSWORD '''%s''';', password);
|
||||
END $$;
|
||||
EOF
|
||||
'';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue