2022-12-29 16:40:39 +01:00
|
|
|
# {{ ansible_managed }}
|
|
|
|
# Variable for PS1
|
|
|
|
$content = @"
|
|
|
|
{% for pubkey in win_sshd_pubkeys %}
|
|
|
|
{{ pubkey }}
|
|
|
|
{%endfor %}
|
|
|
|
"@
|
|
|
|
|
|
|
|
# Write public key to file for admin access
|
|
|
|
[System.IO.Directory]::CreateDirectory("$Env:ProgramData\ssh")
|
|
|
|
$content | Set-Content -Path "$Env:ProgramData\ssh\administrators_authorized_keys"
|
|
|
|
|
|
|
|
# Write Public key to file for user access
|
|
|
|
[System.IO.Directory]::CreateDirectory("$env:USERPROFILE\.ssh")
|
2022-12-29 18:01:10 +01:00
|
|
|
$content | Set-Content -Path "$env:USERPROFILE\.ssh\authorized_keys"
|
2022-12-29 16:40:39 +01:00
|
|
|
|
|
|
|
echo "Writing SSH Keys successful"
|