ansible: Enable RDP and allow pings on windows CI hosts
authorKienan Stewart <kstewart@efficios.com>
Tue, 21 May 2024 17:53:08 +0000 (13:53 -0400)
committerKienan Stewart <kstewart@efficios.com>
Tue, 21 May 2024 17:53:08 +0000 (13:53 -0400)
Change-Id: I4cae9771c6c37eec22b1a79ddc35730d17a6854e
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
automation/ansible/hosts.yml
automation/ansible/roles/common/tasks/setup-Windows.yml
automation/ansible/roles/requirements.yml

index 33b9062a953359ddfb31cf39a18d48880e27d643..1cb9dd06bc2770b4129c8ffc40e77c78f365b3f8 100644 (file)
@@ -1,10 +1,14 @@
 ---
-- hosts: hosts
+- hosts: hosts:!windows
   roles:
     # Setup filesystem and network configuration before other roles
     - zfs
     - netplan
+- hosts: hosts
+  roles:
     - common
+- hosts: hosts:!windows
+  roles:
     - libvirt
     - lxd
     - rasdaemon
index 2ef6c889f2455f39bc3028565e43bfd4a5b29627..5c81a81829c0c30f0808f4ed42d5707b7ce34dea 100644 (file)
     name: sshd
     start_mode: auto
     state: started
+- name: Allow Terminal Server connections
+  ansible.windows.win_regedit:
+    path: 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server'
+    name: 'fDenyTSConnections'
+    data: '0'
+    type: 'dword'
+- name: Run RDP automatically
+  ansible.windows.win_service:
+    name: 'TermService'
+    start_mode: 'auto'
+    state: 'started'
 - name: Turn off standy
   ansible.windows.win_command: 'C:\Windows\system32\powercfg.exe /change standby-timeout-ac 0'
 - name: Turn off hibernation
   ansible.windows.win_template:
     src: 'authorized_keys.j2'
     dest: 'c:\ProgramData\ssh\administrators_authorized_keys'
-
+# c.f. https://galaxy.ansible.com/ui/repo/published/community/windows/content/module/win_firewall_rule/
+- name: Firewall rule to alloc ICMP v4 on all type codes
+  community.windows.win_firewall_rule:
+    name: ICMP Allow incoming V4 echo request
+    enabled: true
+    state: present
+    profiles:
+      - domain
+      - private
+      - public
+    action: allow
+    direction: in
+    protocol: icmpv4
+    icmp_type_code: '*'
+- name: Firewall rule to allow RDP on TCP port 3389
+  community.windows.win_firewall_rule:
+    name: Remote Desktop
+    localport: 3389
+    action: allow
+    direction: in
+    protocol: tcp
+    profiles:
+      - domain
+      - private
+    state: present
+    enabled: true
 - name: Reboot if domain changed
   when: domain_state.reboot_required
   ansible.windows.win_reboot:
index 649feecbb0a8ffc50c4c992035a94ffe2aad971f..583571d483c778ecd07fd39fbb3e84b9c7d9cea4 100644 (file)
@@ -3,3 +3,6 @@ collections:
   - name: community.general
     version: '>=5.4.0'
     type: galaxy
+  - name: community.windows
+    version: '>=2.2.0'
+    type: galaxy
This page took 0.025354 seconds and 4 git commands to generate.