-
Notifications
You must be signed in to change notification settings - Fork 97
/
Copy pathsshd.yml
75 lines (69 loc) · 1.86 KB
/
sshd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
- hosts: computers
#strategy: free
tasks:
# - win_feature:
# name: OpenSSH.Server
# state: present
# - win_capability:
# name: OpenSSH.Server
# state: present
# - win_shell:
# Remove-WindowsCapability -Online -Name 'OpenSSH.Server~~~~0.0.1.0'
# become: yes
# become_user: SYSTEM
# register: ssh_uninstall
# changed_when: "'RestartNeeded : True' in ssh_install.stdout"
# failed_when: "'RestartNeeded : ' not in ssh_install.stdout"
#ignore_errors: yes
- win_chocolatey:
name: openssh
state: latest
package_params: /SSHServerFeature
register: package
tags: package
- name: open port {{ opt_openssh_port }} for inbound SSH connections
win_firewall_rule:
name: Win32-OpenSSH inbound
protocol: tcp
localport: 22
direction: in
action: allow
state: present
enabled: yes
profiles: domain,private
tags: firewall
- win_service:
name: sshd
state: started
start_mode: delayed
force: yes
force_dependent_services: yes
when: package is changed
tags: service
- name: Registry configuration for ictadmin
win_regedit:
path: HKLM:\SOFTWARE\OpenSSH
name: '{{ item.name }}'
data: '{{ item.data|default(None) }}'
type: "{{ item.type|default('dword') }}"
state: "{{ item.state|default('present') }}"
with_items:
- name: DefaultShell
type: string
data: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
- name: DefaultShellCommandOption
type: string
data: /c
state: absent
- name: DefaultShellEscapeArguments
data: 0
state: absent
tags: registry
- win_file:
path: '%USERPROFILE%/.ssh/'
state: directory
tags: key
- win_copy:
src: authorized_keys
dest: '%USERPROFILE%/.ssh/authorized_keys'
tags: key