From d7e87aa9b1f720eced80531389741098cc94afaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Saint-Roch?= Date: Wed, 5 Apr 2023 10:58:01 +0200 Subject: [PATCH] refactor: Use dynamic addresses via templates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Loïc Saint-Roch --- .../_defaults/client/consul/config/defaults.hcl | 4 ++++ .../_defaults/client/nomad/config/defaults.hcl | 17 +++++++++++------ .../_defaults/server/consul/config/defaults.hcl | 4 ++++ .../_defaults/server/nomad/config/defaults.hcl | 13 +++++++++---- .../_defaults/server/vault/config/defaults.hcl | 13 +++++++++++++ .../192.168.60.30/consul/config/overrides.hcl | 2 -- .../192.168.60.30/nomad/config/overrides.hcl | 7 ------- .../192.168.60.30/vault/config/overrides.hcl | 13 ------------- .../192.168.61.30/consul/config/overrides.hcl | 2 -- .../192.168.61.30/nomad/config/overrides.hcl | 7 ------- .../192.168.60.10/consul/config/overrides.hcl | 2 -- .../192.168.60.10/nomad/config/overrides.hcl | 7 ------- .../192.168.60.10/vault/config/overrides.hcl | 13 ------------- .../192.168.61.10/consul/config/overrides.hcl | 2 -- .../192.168.61.10/nomad/config/overrides.hcl | 7 ------- .../192.168.60.20/consul/config/overrides.hcl | 2 -- .../192.168.60.20/nomad/config/overrides.hcl | 7 ------- .../192.168.60.20/vault/config/overrides.hcl | 13 ------------- .../192.168.61.20/consul/config/overrides.hcl | 2 -- .../192.168.61.20/nomad/config/overrides.hcl | 7 ------- 20 files changed, 41 insertions(+), 103 deletions(-) diff --git a/uploads/us/_defaults/client/consul/config/defaults.hcl b/uploads/us/_defaults/client/consul/config/defaults.hcl index 92edbdb..baa65e8 100755 --- a/uploads/us/_defaults/client/consul/config/defaults.hcl +++ b/uploads/us/_defaults/client/consul/config/defaults.hcl @@ -10,6 +10,10 @@ enable_local_script_checks = true server = false +client_addr = "{{ GetInterfaceIP \"eth1\" }}" +advertise_addr = "{{ GetInterfaceIP \"eth1\" }}" +advertise_addr_wan = "{{ GetInterfaceIP \"eth1\" }}" + ports { http = 8500 grpc = 8502 diff --git a/uploads/us/_defaults/client/nomad/config/defaults.hcl b/uploads/us/_defaults/client/nomad/config/defaults.hcl index c3b1369..da944a7 100755 --- a/uploads/us/_defaults/client/nomad/config/defaults.hcl +++ b/uploads/us/_defaults/client/nomad/config/defaults.hcl @@ -1,9 +1,19 @@ data_dir = "/opt/nomad" +region = "us" + +bind_addr = "{{ GetInterfaceIP \"eth1\" }}" + server { enabled = false } +ports { + http = 4646 + rpc = 4647 + serf = 4648 +} + client { enabled = true @@ -30,12 +40,6 @@ client { } } -ports { - http = 4646 - rpc = 4647 - serf = 4648 -} - telemetry { collection_interval = "1s" disable_hostname = true @@ -68,6 +72,7 @@ plugin "docker" { } consul { + address = "{{ GetInterfaceIP \"eth1\" }}:8500" server_service_name = "nomad" client_service_name = "nomad-client" auto_advertise = true diff --git a/uploads/us/_defaults/server/consul/config/defaults.hcl b/uploads/us/_defaults/server/consul/config/defaults.hcl index 9881cfd..d390754 100755 --- a/uploads/us/_defaults/server/consul/config/defaults.hcl +++ b/uploads/us/_defaults/server/consul/config/defaults.hcl @@ -11,6 +11,10 @@ enable_local_script_checks = true server = true +client_addr = "{{ GetInterfaceIP \"eth1\" }}" +advertise_addr = "{{ GetInterfaceIP \"eth1\" }}" +advertise_addr_wan = "{{ GetInterfaceIP \"eth1\" }}" + ports { http = 8500 grpc = 8502 diff --git a/uploads/us/_defaults/server/nomad/config/defaults.hcl b/uploads/us/_defaults/server/nomad/config/defaults.hcl index 63c0e89..da657a0 100755 --- a/uploads/us/_defaults/server/nomad/config/defaults.hcl +++ b/uploads/us/_defaults/server/nomad/config/defaults.hcl @@ -1,5 +1,9 @@ data_dir = "/opt/nomad" +region = "us" + +bind_addr = "{{ GetInterfaceIP \"eth1\" }}" + server { enabled = true bootstrap_expect = 3 @@ -13,16 +17,16 @@ server { } } -client { - enabled = false -} - ports { http = 4646 rpc = 4647 serf = 4648 } +client { + enabled = false +} + telemetry { collection_interval = "1s" disable_hostname = true @@ -32,6 +36,7 @@ telemetry { } consul { + address = "{{ GetInterfaceIP \"eth1\" }}:8500" server_service_name = "nomad" client_service_name = "nomad-client" auto_advertise = true diff --git a/uploads/us/_defaults/server/vault/config/defaults.hcl b/uploads/us/_defaults/server/vault/config/defaults.hcl index dcc78ae..a98f0e2 100755 --- a/uploads/us/_defaults/server/vault/config/defaults.hcl +++ b/uploads/us/_defaults/server/vault/config/defaults.hcl @@ -1,7 +1,20 @@ +api_addr = "http://{{ GetInterfaceIP \"eth1\" }}:8200" +cluster_addr = "http://{{ GetInterfaceIP \"eth1\" }}:8201" + ui = true disable_mlock = true +listener "tcp" { + tls_disable = true + address = "{{ GetInterfaceIP \"eth1\" }}:8200" + cluster_address = "{{ GetInterfaceIP \"eth1\" }}:8201" + + telemetry { + unauthenticated_metrics_access = true + } +} + telemetry { prometheus_retention_time = "24h" disable_hostname = true diff --git a/uploads/us/us-east-1/192.168.60.30/consul/config/overrides.hcl b/uploads/us/us-east-1/192.168.60.30/consul/config/overrides.hcl index 4b2c306..e69de29 100755 --- a/uploads/us/us-east-1/192.168.60.30/consul/config/overrides.hcl +++ b/uploads/us/us-east-1/192.168.60.30/consul/config/overrides.hcl @@ -1,2 +0,0 @@ -bind_addr = "192.168.60.30" -client_addr = "192.168.60.30" diff --git a/uploads/us/us-east-1/192.168.60.30/nomad/config/overrides.hcl b/uploads/us/us-east-1/192.168.60.30/nomad/config/overrides.hcl index 97a76c3..03f82a5 100755 --- a/uploads/us/us-east-1/192.168.60.30/nomad/config/overrides.hcl +++ b/uploads/us/us-east-1/192.168.60.30/nomad/config/overrides.hcl @@ -1,12 +1,5 @@ -region = "us" datacenter = "us-east-1" -bind_addr = "192.168.60.30" - -consul { - address = "192.168.60.30:8500" -} - vault { enabled = true address = "http://192.168.60.30:8200" diff --git a/uploads/us/us-east-1/192.168.60.30/vault/config/overrides.hcl b/uploads/us/us-east-1/192.168.60.30/vault/config/overrides.hcl index 3328835..65294d5 100755 --- a/uploads/us/us-east-1/192.168.60.30/vault/config/overrides.hcl +++ b/uploads/us/us-east-1/192.168.60.30/vault/config/overrides.hcl @@ -1,6 +1,3 @@ -api_addr = "http://192.168.60.30:8200" -cluster_addr = "http://192.168.60.30:8201" - storage "raft" { path = "/opt/vault" node_id = "us-east-1" @@ -9,13 +6,3 @@ storage "raft" { service_registration "consul" { address = "192.168.61.30:8500" } - -listener "tcp" { - tls_disable = true - address = "192.168.60.30:8200" - cluster_address = "192.168.60.30:8201" - - telemetry { - unauthenticated_metrics_access = true - } -} diff --git a/uploads/us/us-east-1/192.168.61.30/consul/config/overrides.hcl b/uploads/us/us-east-1/192.168.61.30/consul/config/overrides.hcl index e170306..e69de29 100755 --- a/uploads/us/us-east-1/192.168.61.30/consul/config/overrides.hcl +++ b/uploads/us/us-east-1/192.168.61.30/consul/config/overrides.hcl @@ -1,2 +0,0 @@ -bind_addr = "192.168.61.30" -client_addr = "192.168.61.30" diff --git a/uploads/us/us-east-1/192.168.61.30/nomad/config/overrides.hcl b/uploads/us/us-east-1/192.168.61.30/nomad/config/overrides.hcl index a8e4ac6..03f82a5 100755 --- a/uploads/us/us-east-1/192.168.61.30/nomad/config/overrides.hcl +++ b/uploads/us/us-east-1/192.168.61.30/nomad/config/overrides.hcl @@ -1,12 +1,5 @@ -region = "us" datacenter = "us-east-1" -bind_addr = "192.168.61.30" - -consul { - address = "192.168.61.30:8500" -} - vault { enabled = true address = "http://192.168.60.30:8200" diff --git a/uploads/us/us-west-1/192.168.60.10/consul/config/overrides.hcl b/uploads/us/us-west-1/192.168.60.10/consul/config/overrides.hcl index da06d73..e69de29 100755 --- a/uploads/us/us-west-1/192.168.60.10/consul/config/overrides.hcl +++ b/uploads/us/us-west-1/192.168.60.10/consul/config/overrides.hcl @@ -1,2 +0,0 @@ -bind_addr = "192.168.60.10" -client_addr = "192.168.60.10" diff --git a/uploads/us/us-west-1/192.168.60.10/nomad/config/overrides.hcl b/uploads/us/us-west-1/192.168.60.10/nomad/config/overrides.hcl index 1133047..f6b97f4 100755 --- a/uploads/us/us-west-1/192.168.60.10/nomad/config/overrides.hcl +++ b/uploads/us/us-west-1/192.168.60.10/nomad/config/overrides.hcl @@ -1,12 +1,5 @@ -region = "us" datacenter = "us-west-1" -bind_addr = "192.168.60.10" - -consul { - address = "192.168.60.10:8500" -} - vault { enabled = true address = "http://192.168.60.10:8200" diff --git a/uploads/us/us-west-1/192.168.60.10/vault/config/overrides.hcl b/uploads/us/us-west-1/192.168.60.10/vault/config/overrides.hcl index d1612cd..5282367 100755 --- a/uploads/us/us-west-1/192.168.60.10/vault/config/overrides.hcl +++ b/uploads/us/us-west-1/192.168.60.10/vault/config/overrides.hcl @@ -1,6 +1,3 @@ -api_addr = "http://192.168.60.10:8200" -cluster_addr = "http://192.168.60.10:8201" - storage "raft" { path = "/opt/vault" node_id = "us-west-1" @@ -9,13 +6,3 @@ storage "raft" { service_registration "consul" { address = "192.168.61.10:8500" } - -listener "tcp" { - tls_disable = true - address = "192.168.60.10:8200" - cluster_address = "192.168.60.10:8201" - - telemetry { - unauthenticated_metrics_access = true - } -} diff --git a/uploads/us/us-west-1/192.168.61.10/consul/config/overrides.hcl b/uploads/us/us-west-1/192.168.61.10/consul/config/overrides.hcl index 4e3f53c..e69de29 100755 --- a/uploads/us/us-west-1/192.168.61.10/consul/config/overrides.hcl +++ b/uploads/us/us-west-1/192.168.61.10/consul/config/overrides.hcl @@ -1,2 +0,0 @@ -bind_addr = "192.168.61.10" -client_addr = "192.168.61.10" diff --git a/uploads/us/us-west-1/192.168.61.10/nomad/config/overrides.hcl b/uploads/us/us-west-1/192.168.61.10/nomad/config/overrides.hcl index 2e54287..f6b97f4 100755 --- a/uploads/us/us-west-1/192.168.61.10/nomad/config/overrides.hcl +++ b/uploads/us/us-west-1/192.168.61.10/nomad/config/overrides.hcl @@ -1,12 +1,5 @@ -region = "us" datacenter = "us-west-1" -bind_addr = "192.168.61.10" - -consul { - address = "192.168.61.10:8500" -} - vault { enabled = true address = "http://192.168.60.10:8200" diff --git a/uploads/us/us-west-2/192.168.60.20/consul/config/overrides.hcl b/uploads/us/us-west-2/192.168.60.20/consul/config/overrides.hcl index 204344e..e69de29 100755 --- a/uploads/us/us-west-2/192.168.60.20/consul/config/overrides.hcl +++ b/uploads/us/us-west-2/192.168.60.20/consul/config/overrides.hcl @@ -1,2 +0,0 @@ -bind_addr = "192.168.60.20" -client_addr = "192.168.60.20" diff --git a/uploads/us/us-west-2/192.168.60.20/nomad/config/overrides.hcl b/uploads/us/us-west-2/192.168.60.20/nomad/config/overrides.hcl index 02b0077..a4e632e 100755 --- a/uploads/us/us-west-2/192.168.60.20/nomad/config/overrides.hcl +++ b/uploads/us/us-west-2/192.168.60.20/nomad/config/overrides.hcl @@ -1,12 +1,5 @@ -region = "us" datacenter = "us-west-2" -bind_addr = "192.168.60.20" - -consul { - address = "192.168.60.20:8500" -} - vault { enabled = true address = "http://192.168.60.20:8200" diff --git a/uploads/us/us-west-2/192.168.60.20/vault/config/overrides.hcl b/uploads/us/us-west-2/192.168.60.20/vault/config/overrides.hcl index 0f95145..539d5c0 100755 --- a/uploads/us/us-west-2/192.168.60.20/vault/config/overrides.hcl +++ b/uploads/us/us-west-2/192.168.60.20/vault/config/overrides.hcl @@ -1,6 +1,3 @@ -api_addr = "http://192.168.60.20:8200" -cluster_addr = "http://192.168.60.20:8201" - storage "raft" { path = "/opt/vault" node_id = "us-west-2" @@ -9,13 +6,3 @@ storage "raft" { service_registration "consul" { address = "192.168.61.20:8500" } - -listener "tcp" { - tls_disable = true - address = "192.168.60.20:8200" - cluster_address = "192.168.60.20:8201" - - telemetry { - unauthenticated_metrics_access = true - } -} diff --git a/uploads/us/us-west-2/192.168.61.20/consul/config/overrides.hcl b/uploads/us/us-west-2/192.168.61.20/consul/config/overrides.hcl index 6092e96..e69de29 100755 --- a/uploads/us/us-west-2/192.168.61.20/consul/config/overrides.hcl +++ b/uploads/us/us-west-2/192.168.61.20/consul/config/overrides.hcl @@ -1,2 +0,0 @@ -bind_addr = "192.168.61.20" -client_addr = "192.168.61.20" diff --git a/uploads/us/us-west-2/192.168.61.20/nomad/config/overrides.hcl b/uploads/us/us-west-2/192.168.61.20/nomad/config/overrides.hcl index a7f39b0..a4e632e 100755 --- a/uploads/us/us-west-2/192.168.61.20/nomad/config/overrides.hcl +++ b/uploads/us/us-west-2/192.168.61.20/nomad/config/overrides.hcl @@ -1,12 +1,5 @@ -region = "us" datacenter = "us-west-2" -bind_addr = "192.168.61.20" - -consul { - address = "192.168.61.20:8500" -} - vault { enabled = true address = "http://192.168.60.20:8200"