22 lines
932 B
YAML
22 lines
932 B
YAML
---
|
|
# See https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse?tabs=powershell
|
|
- name: Set Powershell Execution to Remote Signed
|
|
ansible.windows.win_powershell:
|
|
script: "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine"
|
|
changed_when: _fw.changed
|
|
|
|
- name: Install the OpenSSH Server
|
|
ansible.windows.win_powershell:
|
|
script: "Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0"
|
|
changed_when: _fw.changed
|
|
|
|
- name: Set service startup mode to auto and ensure sshd is started
|
|
ansible.windows.win_service:
|
|
name: sshd
|
|
start_mode: auto
|
|
state: started
|
|
|
|
- name: Configure Powershell as default
|
|
ansible.windows.win_powershell:
|
|
script: 'New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "$Env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force'
|
|
changed_when: _fw.changed
|