zuul-jobs/roles/add-build-sshkey/tasks/remote-windows.yaml
Albin Vass dd59a158e8 Enforce BatchMode when setting up ssh for windows
Change-Id: I62742dc43df5276f51805e259229405ba9b19362
2020-07-09 14:09:27 +02:00

21 lines
845 B
YAML

- name: Configure ssh on remote node
delegate_to: localhost
shell: |+
set -eu
echo "Add node to known_hosts"
ssh -o BatchMode=yes -o ConnectTimeout=10 -o StrictHostKeyChecking=no {{ ansible_user }}@{{ ansible_host }} echo success
echo
# We use scp here as this is much more performant than ansible copy
echo "Copy build ssh keys to node"
scp -B {{ zuul_temp_ssh_key }} {{ ansible_user }}@{{ ansible_host }}:.ssh/id_rsa
scp -B {{ zuul_temp_ssh_key }}.pub {{ ansible_user }}@{{ ansible_host }}:.ssh/id_rsa.pub
echo "Add build ssh keys to authorized_keys"
ssh -o BatchMode=yes {{ ansible_user }}@{{ ansible_host }} "type .ssh\\id_rsa.pub >> .ssh\\authorized_keys"
register: windows_remote_ssh
# Ignore errors here because this should not break non-ssh enabled windows hosts
ignore_errors: true