From 95c6b8be93ba1f5417218759708ded247fbdb7ef Mon Sep 17 00:00:00 2001 From: Karim Naufal Date: Mon, 7 Feb 2022 22:07:05 +0100 Subject: [PATCH] removed the ssh connection timeout messages while waiting, and also reduced the connection refused messages --- agents.tf | 2 +- master.tf | 2 +- servers.tf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/agents.tf b/agents.tf index 1767078..b0610d7 100644 --- a/agents.tf +++ b/agents.tf @@ -50,7 +50,7 @@ resource "hcloud_server" "agents" { # Wait for MicroOS to reboot and be ready provisioner "local-exec" { - command = "until ssh ${local.ssh_args} -o ConnectTimeout=2 root@${self.ipv4_address} true; do sleep 1; done" + command = "ping ${self.ipv4_address} | grep --line-buffered 'bytes from' | head -1 && sleep 10 && until ssh ${local.ssh_args} -o ConnectTimeout=2 root@${self.ipv4_address} true; do sleep 1; done" } # Generating and uploading the angent.conf file diff --git a/master.tf b/master.tf index 3c69cc3..0e2bdfd 100644 --- a/master.tf +++ b/master.tf @@ -48,7 +48,7 @@ resource "hcloud_server" "first_control_plane" { # Wait for MicroOS to reboot and be ready provisioner "local-exec" { - command = "until ssh ${local.ssh_args} -o ConnectTimeout=2 root@${self.ipv4_address} true; do sleep 1; done" + command = "ping ${self.ipv4_address} | grep --line-buffered 'bytes from' | head -1 && sleep 10 && until ssh ${local.ssh_args} -o ConnectTimeout=2 root@${self.ipv4_address} true; do sleep 1; done" } # Generating k3s master config file diff --git a/servers.tf b/servers.tf index 5c54663..9531bac 100644 --- a/servers.tf +++ b/servers.tf @@ -49,7 +49,7 @@ resource "hcloud_server" "control_planes" { # Wait for MicroOS to reboot and be ready provisioner "local-exec" { - command = "until ssh ${local.ssh_args} -o ConnectTimeout=2 root@${self.ipv4_address} true; do sleep 1; done" + command = "ping ${self.ipv4_address} | grep --line-buffered 'bytes from' | head -1 && sleep 10 && until ssh ${local.ssh_args} -o ConnectTimeout=2 root@${self.ipv4_address} true; do sleep 1; done" } # Generating k3s server config file