Skip to content

Commit 571d1d0

Browse files
committed
Doc: Update Windows Playbook Instructions
1 parent d4fb095 commit 571d1d0

File tree

1 file changed

+63
-0
lines changed
  • ansible/playbooks/AdoptOpenJDK_Windows_Playbook

1 file changed

+63
-0
lines changed

ansible/playbooks/AdoptOpenJDK_Windows_Playbook/README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,66 @@ jenkins_secret: ( This should be set to the jenkins secret used for connecting t
5858
Once all the above is complete, the playbook can then be run:
5959

6060
ansible-playbook -i << path to hosts file >> -u << target user name >> ./windows_dockerhost.yml
61+
62+
63+
# Setting up Windows Machines with SSH Access (Cygwin + OpenSSH)
64+
65+
In addition to the standard Windows and Dockerhost playbooks, a dedicated playbook (`windows_with_ssh.yml`) is provided to configure Windows test machines for **secure, key-based SSH access**, suitable for Adoptium build and test usage.
66+
67+
This playbook installs and configures OpenSSH on Windows, integrates it with **Cygwin bash as the default shell**, and ensures both the administrative Ansible user and the Jenkins user can authenticate using SSH keys with correct and hardened ACLs.
68+
69+
## What this playbook configures
70+
71+
The `windows_with_ssh.yml` playbook performs the following actions:
72+
73+
1. Ensures Windows user profiles exist for both the Ansible admin user and the Jenkins user.
74+
2. Validates that Cygwin is installed and that the configured `DefaultShell` points to Cygwin bash.
75+
3. Deploys a templated `sshd_config` suitable for Jenkins agent usage.
76+
4. Creates and populates `authorized_keys` files for both users from Ansible variables.
77+
5. Applies strict Windows ACLs to `.ssh` directories and key files:
78+
- Admin user: access limited to the user and `SYSTEM`.
79+
- Jenkins user: access limited to the Jenkins user and `SYSTEM` (Administrators explicitly removed).
80+
6. Creates Windows junctions so that Cygwin and native Windows OpenSSH share the same `.ssh` directories.
81+
7. Enables and starts the `sshd` service (and optionally `ssh-agent`).
82+
8. Automatically restarts `sshd` when configuration, shell settings, or keys change.
83+
84+
This configuration ensures compatibility with Jenkins SSH agents while meeting Windows OpenSSH security requirements.
85+
86+
---
87+
88+
# Running the `windows_with_ssh.yml` Playbook
89+
90+
Before running the playbook, ensure the following prerequisites are met:
91+
92+
1. Log on to the Windows machine via RDP and run the `ConfigureRemotingForAnsible` commands listed in `main.yml`, as described in the standard Windows setup section.
93+
2. Ensure the openssh client and server features are installed on the Windows host, and the OpenSSH server, and OpenSSH Agent services are both running.
94+
3. Ensure the path to `bash.exe` is known and available for use as the OpenSSH `DefaultShell`. This is installed via the cygwin role.
95+
5. Ensure SSH public keys are available for both the admin and Jenkins users.
96+
97+
## Required variables
98+
99+
The following variables must be set before running the playbook:
100+
101+
- `Jenkins_Username`
102+
The Windows account used to run the Jenkins agent.
103+
104+
- `admin_ssh_key`
105+
SSH public key string for the Ansible/admin user.
106+
107+
- `jenkins_ssh_key`
108+
SSH public key string for the Jenkins user.
109+
110+
- `openssh_default_shell`
111+
Full path to the Cygwin bash executable (for example: `C:\cygwin64\bin\bash.exe`).
112+
113+
- `Cygwin_INST_DIR`
114+
Base installation directory of Cygwin (for example: `C:\cygwin64`).
115+
116+
These variables are typically defined in Vendor_Files, `group_vars` or supplied via inventory, consistent with the rest of the Windows playbooks.
117+
118+
## Running the playbook
119+
120+
Once all prerequisites and variables are in place, the playbook can be run as follows:
121+
122+
```bash
123+
ansible-playbook -i << path to hosts file >> -u << admin user >> ./windows_with_ssh.yml

0 commit comments

Comments
 (0)