From 2e7b28ee86072dc605037aab553e84bd0951ea2b Mon Sep 17 00:00:00 2001 From: Albin Vass Date: Tue, 11 Aug 2020 11:40:29 +0200 Subject: [PATCH] add-build-sshkey: call cmd with command Currently a new cmd shell is opened instead of running the command supplied when adding the build key for ssh enabled windows nodes. Fix this by adding a '/c' flag. Change-Id: I582febfe91d5dc229cc6a1959477a461a237336b --- roles/add-build-sshkey/tasks/remote-windows.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/add-build-sshkey/tasks/remote-windows.yaml b/roles/add-build-sshkey/tasks/remote-windows.yaml index abd0d3706..511828ece 100644 --- a/roles/add-build-sshkey/tasks/remote-windows.yaml +++ b/roles/add-build-sshkey/tasks/remote-windows.yaml @@ -16,9 +16,9 @@ echo "Add build ssh keys to authorized_keys" {% if win_admin_ssh | default(false) %} - ssh -o BatchMode=yes {{ ansible_user }}@{{ ansible_host }} cmd "type .ssh\\id_rsa.pub >> %programdata%\\ssh\\administrators_authorized_keys" + ssh -o BatchMode=yes {{ ansible_user }}@{{ ansible_host }} cmd /c "type .ssh\\id_rsa.pub >> %programdata%\\ssh\\administrators_authorized_keys" {% else %} - ssh -o BatchMode=yes {{ ansible_user }}@{{ ansible_host }} cmd "type .ssh\\id_rsa.pub >> .ssh\\authorized_keys" + ssh -o BatchMode=yes {{ ansible_user }}@{{ ansible_host }} cmd /c "type .ssh\\id_rsa.pub >> .ssh\\authorized_keys" {% endif %} register: windows_remote_ssh # Ignore errors here because this should not break non-ssh enabled windows hosts