From d1de70b020a3e9d23f55acf59600b02c1b3923d0 Mon Sep 17 00:00:00 2001 From: shenlan Date: Wed, 25 Jun 2025 23:29:49 +0800 Subject: [PATCH 1/2] gpu-k8s: precheck SSH connectivity --- playbooks/roles/vhosts/gpu-k8s/tasks/install_cluster.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/playbooks/roles/vhosts/gpu-k8s/tasks/install_cluster.yml b/playbooks/roles/vhosts/gpu-k8s/tasks/install_cluster.yml index bcceaa3..d1008a9 100644 --- a/playbooks/roles/vhosts/gpu-k8s/tasks/install_cluster.yml +++ b/playbooks/roles/vhosts/gpu-k8s/tasks/install_cluster.yml @@ -72,6 +72,15 @@ fail_msg: "Provide masters/nodes hostnames or master_ips/node_ips with at least one entry" when: inventory_hostname == (ops_host | default(masters | default(master_ips) | first)) +- name: Verify passwordless SSH access to all cluster nodes + shell: ssh -o BatchMode=yes -o StrictHostKeyChecking=no root@{{ item }} hostname + loop: "{{ master_ips + node_ips }}" + delegate_to: "{{ ops_host | default(masters | default(master_ips) | first) }}" + become: false + register: ssh_access + changed_when: false + run_once: true + - name: Run sealos to create Kubernetes cluster shell: | sealos run \ From 4131181bc68a2db8d3e161c0ed2e5c84779c1cb9 Mon Sep 17 00:00:00 2001 From: shenlan Date: Wed, 25 Jun 2025 23:39:12 +0800 Subject: [PATCH 2/2] Authorize ops host key on all cluster nodes --- playbooks/roles/vhosts/ssh-trust/tasks/main.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/playbooks/roles/vhosts/ssh-trust/tasks/main.yml b/playbooks/roles/vhosts/ssh-trust/tasks/main.yml index 9609d2a..f93adaf 100644 --- a/playbooks/roles/vhosts/ssh-trust/tasks/main.yml +++ b/playbooks/roles/vhosts/ssh-trust/tasks/main.yml @@ -13,8 +13,7 @@ delegate_to: "{{ ops_host }}" run_once: true -- name: Authorize ops host key on other nodes +- name: Authorize ops host key on cluster hosts ansible.builtin.authorized_key: user: "{{ ansible_user | default('root') }}" key: "{{ ops_pub_key.content | b64decode }}" - when: inventory_hostname != ops_host