Merge pull request #21 from svc-design/codex/配置本机-ssh-key
Add SSH precheck for gpu-k8s role
This commit is contained in:
commit
2bf9df3274
@ -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 \
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user