Disable bootstrap_expect unless specific deuxfleurs.bootstrap is set

This commit is contained in:
Alex 2022-08-24 14:23:17 +02:00
parent 468c6b702b
commit ec2020b71b
Signed by untrusted user: lx
GPG key ID: 0E496D15096376BE

View file

@ -117,6 +117,11 @@ in
description = "List of users having an admin account on cluster nodes, maps user names to a list of authorized SSH keys";
type = types.attrsOf (types.listOf types.str);
};
bootstrap = mkOption {
description = "Whether to enable bootstrapping for Nomad and Consul";
type = types.bool;
default = false;
};
};
config = {
@ -187,10 +192,8 @@ in
services.consul.enable = true;
services.consul.extraConfig =
(if cfg.is_raft_server
then {
server = true;
bootstrap_expect = 3;
}
then { server = true; }
// (if cfg.bootstrap then { bootstrap_expect = 3; } else {})
else {}) //
{
datacenter = cfg.cluster_name;
@ -235,11 +238,10 @@ in
];
services.nomad.settings =
(if cfg.is_raft_server
then { server = {
enabled = true;
bootstrap_expect = 3;
}; }
else {}) //
then {
server = { enabled = true; }
// (if cfg.bootstrap then { bootstrap_expect = 3; } else {});
} else {}) //
{
region = cfg.cluster_name;
datacenter = cfg.site_name;