From 522a9bad15682991fe1fc9efcb27b0c199ff5052 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Wed, 11 Nov 2020 14:39:50 +0100 Subject: [PATCH] Copy ssh key from windows user --- roles/user-account/tasks/main.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/roles/user-account/tasks/main.yaml b/roles/user-account/tasks/main.yaml index 813028a..115b808 100644 --- a/roles/user-account/tasks/main.yaml +++ b/roles/user-account/tasks/main.yaml @@ -8,3 +8,19 @@ state: present update_password: always register: account + +- name: ensure .ssh exists + become_user: "{{ account.name }}" + file: + path: "/home/{{ account.name }}/.ssh" + state: directory + mode: "0700" + +- name: copy ssh key + become_user: "{{ account.name }}" + copy: + src: "{{ item }}" + dest: "/home/{{ account.name }}/.ssh/" + mode: "0600" + with_fileglob: + - "/mnt/c/Users/mandl/.ssh/id_rsa*"