diff --git a/deployment/check/common/data-model-options.nix b/deployment/check/common/data-model-options.nix index fb43cc54..94c924e8 100644 --- a/deployment/check/common/data-model-options.nix +++ b/deployment/check/common/data-model-options.nix @@ -25,6 +25,10 @@ in description = "environment variables to configure the TF HTTP back-end, see "; type = types.attrsOf (types.either types.str types.int); }; + key-file = mkOption { + type = types.str; + default = ""; + }; proxmox-user = mkOption { description = "The ProxmoX user to use."; type = types.str; diff --git a/deployment/check/common/data-model.nix b/deployment/check/common/data-model.nix index e6d7e807..ece0d87e 100644 --- a/deployment/check/common/data-model.nix +++ b/deployment/check/common/data-model.nix @@ -24,6 +24,7 @@ let pathToRoot targetSystem sshOpts + key-file httpBackend proxmox-user proxmox-password @@ -262,8 +263,7 @@ let ssh = { username = "root"; host = nodeName; - key-file = null; - inherit sshOpts; + inherit key-file sshOpts; }; module = self; inherit args deployment-name; @@ -312,8 +312,7 @@ let ssh = { username = "root"; host = nodeName; - key-file = null; - inherit sshOpts; + inherit key-file sshOpts; }; module = self; inherit args deployment-name httpBackend; @@ -338,8 +337,7 @@ let ssh = { username = "root"; host = nodeName; - key-file = null; - inherit sshOpts; + inherit key-file sshOpts; }; module = self; inherit diff --git a/deployment/check/data-model-tf-proxmox/nixosTest.nix b/deployment/check/data-model-tf-proxmox/nixosTest.nix index 21da9375..23d95657 100644 --- a/deployment/check/data-model-tf-proxmox/nixosTest.nix +++ b/deployment/check/data-model-tf-proxmox/nixosTest.nix @@ -20,6 +20,7 @@ let nodeName = "pve"; targetSystem = system; sshOpts = [ ]; + key-file = "/root/.ssh/id_ed25519"; proxmox-user = "root@pam"; proxmox-password = "mytestpw"; node-name = "pve"; diff --git a/deployment/run/tf-proxmox/main.tf b/deployment/run/tf-proxmox/main.tf index 777a29fe..e17fe058 100644 --- a/deployment/run/tf-proxmox/main.tf +++ b/deployment/run/tf-proxmox/main.tf @@ -178,8 +178,14 @@ resource "null_resource" "wait_for_ssh" { ] provisioner "local-exec" { command = <<-EOT - for i in $(seq 1 30); do - if ssh -o StrictHostKeyChecking=no -o ConnectTimeout=5 root@${proxmox_virtual_environment_vm.nix_vm.ipv4_addresses[1][0]} "true" 2>/dev/null; then + for i in $(seq 1 10); do + if ssh \ + -i "${var.key_file}" \ + -o BatchMode=yes \ + -o StrictHostKeyChecking=no \ + -o ConnectTimeout=1 \ + -o ServerAliveInterval=1 \ + root@${proxmox_virtual_environment_vm.nix_vm.ipv4_addresses[1][0]} "true"; then exit 0 fi echo "Waiting for SSH (attempt #$i)..." diff --git a/flake.nix b/flake.nix index 54d993fb..d1935840 100644 --- a/flake.nix +++ b/flake.nix @@ -92,6 +92,7 @@ name = "root"; }; sshOpts = [ ]; + key-file = ""; proxmox-user = "kiara@ProcoliX"; proxmox-password = ""; node-name = "node051";