From ec2020b71bb877d113c8fd8e75dc2a529ebb16b5 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Wed, 24 Aug 2022 14:23:17 +0200 Subject: Disable bootstrap_expect unless specific deuxfleurs.bootstrap is set --- nix/deuxfleurs.nix | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'nix') diff --git a/nix/deuxfleurs.nix b/nix/deuxfleurs.nix index 7c2919c..0b5169f 100644 --- a/nix/deuxfleurs.nix +++ b/nix/deuxfleurs.nix @@ -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; -- cgit v1.2.3