win_ansible_role_sshd/templates/ssh_userkeys.ps1
2022-12-29 18:01:10 +01:00

13 lines
335 B
PowerShell

# {{ ansible_managed }}
# Variable for PS1
$content = @"
{% for pubkey in win_sshd_pubkeys %}
{{ pubkey }}
{%endfor %}
"@
# Write Public key to file for user access
[System.IO.Directory]::CreateDirectory("$env:USERPROFILE\.ssh")
$content | Set-Content -Path "$env:USERPROFILE\.ssh\authorized_keys"
echo "Writing SSH Keys successful"