File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -177,7 +177,7 @@ run: ## Run a CMD command on all servers via SSH
177177 fi ; \
178178 hosts=$$(ansible-inventory -i metal/inventory.sh --list | jq -r '._meta.hostvars | keys[]' ) ; \
179179 for host in $$ {hosts}; do \
180- ssh " $$ {host}" " $$ {cmd}" || continue ; \
180+ ssh -o ConnectTimeout=10 " $$ {host}" " $$ {cmd}" || continue ; \
181181 printf " done %s on %s\n" " $$ {cmd}" " $$ {host}" ; \
182182 done
183183
Original file line number Diff line number Diff line change @@ -206,14 +206,14 @@ _requirements:
206206
207207kubeconfig.yaml :
208208 @for hst in $$(make --quiet inventory | xargs ) ; do
209- if ping -q -c 3 -w 3 $$ {hst} > /dev/null; then
210- if ssh $$ {hst} " test -f /etc/rancher/k3s/k3s.yaml" ; then
211- scp $$ {hst}:/etc/rancher/k3s/k3s.yaml kubeconfig.yaml > /dev/null
212- sed -i ' s/127.0.0.1/10.10.10.100/' kubeconfig.yaml
213- exit 0
214- fi
209+ if ssh -o ConnectTimeout=4 $$ {hst} " test -f /etc/rancher/k3s/k3s.yaml" ; then
210+ scp $$ {hst}:/etc/rancher/k3s/k3s.yaml kubeconfig.yaml > /dev/null
211+ sed -i ' s/127.0.0.1/10.10.10.100/' kubeconfig.yaml
212+ exit 0
215213 fi
216214 done
215+ echo " $( __RED) error: k3s.yaml not found or all hosts offline$( __RESET) "
216+ exit 1
217217
218218# ## Main
219219
You can’t perform that action at this time.
0 commit comments