--- name: workstation-setup description: Готовит рабочий компьютер для Server Ops, устанавливает недостающие инструменты или проверяет восстановление учётных данных на чистой копии репозитория в Linux. --- Use the [server-ops checkout](../server-ops/SKILL.md#select-the-checkout) for all repository paths and commands in this skill. ## Prepare the checkout - Detect the OS and existing tools in its shell, starting before Python is available. On Linux check `/etc/os-release` and use `command -v`. In PowerShell use `$PSVersionTable`, `Get-Command`, and `Test-Path`. Reuse working tools and use the platform's approval flow for installation. - On Linux install Git, Python with venv and pip support, and OpenSSH 8.4+ from the distribution. On Debian or Ubuntu refresh APT indexes and install the missing packages among `git`, `python3`, `python3-venv`, and `openssh-client`. Select a maintained `ansible-core` compatible with the available Python. Create `.venv` with `python3 -m venv .venv` and install PyYAML, pyrage, and the compatible Ansible into it. Install SOPS, age, `age-keygen`, and Gitleaks 8.19+ from official packages or releases. Verify release checksums or signatures for manually downloaded binaries. [Ansible support matrix](https://docs.ansible.com/projects/ansible/latest/reference_appendices/release_and_maintenance.html#ansible-core-support-matrix) - On native Windows use PowerShell, Git for Windows, 64-bit Python 3.13+, and the system OpenSSH client. If Python is missing, use the official Python install manager and verify the runtime version and architecture. When WinGet is available, the manager can be installed with `winget install 9NQ7512CXL7T -e --accept-package-agreements --disable-interactivity`. Discover it in a fresh PowerShell session if needed. Install the runtime with `py install 3.13`, or use `pymanager` if a legacy launcher intercepts `py`. Create `.venv` with the selected runtime and install PyYAML into it. Verify `%SystemRoot%\System32\OpenSSH\ssh.exe`. If missing, use `Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0` from an authorized elevated PowerShell. Install Gitleaks 8.19+ for the Git hook. Use `agent` or `key_file` for native SSH. Ansible and the repository's SOPS-backed operations use Linux. [Python on Windows](https://docs.python.org/3/using/windows.html) · [Windows OpenSSH installation](https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse) - On Linux activate `.venv` with `. .venv/bin/activate` in each command shell that runs the repository tools. This exposes the interpreter and local SOPS, age, and Ansible binaries. On Windows call `./.venv/Scripts/python.exe` directly. Use `.venv/bin` or `.venv/Scripts` for project-local binaries. - In the selected server-ops checkout, configure `git config --local core.hooksPath .githooks` and verify the active path. Preserve any custom hooks already serving the checkout. If they cannot be chained safely, report the conflict and run the project check separately. ## Prepare SOPS when needed On Linux, `python3 .agents/scripts/ops.py init-age` prepares the identity using the owner-only root `.env`. If `servers/age-identity.age` already exists, restore its matching `.env`. Legacy encrypted records require their original age identity for migration. A new setup without existing ciphertext can generate a password and age identity. Keep existing entries in `.env` and follow "Credentials" in the selected checkout's `AGENTS.md`. ## Rehearse credential recovery on Linux 1. Prepare a separate Linux checkout from the backup or revision being tested. Confirm that it contains the requested server cards and their encrypted credentials. For a wrapped age identity, confirm `servers/age-identity.age` is present and restore its matching ignored `.env` from protected storage with mode `0600`. For a legacy backup, restore its original protected age identity. Treat a missing or mismatched recovery artifact as a blocker. 2. In the activated venv run `python3 .agents/scripts/ops.py doctor` and `python3 .agents/scripts/ops.py validate`. Run `python3 .agents/scripts/ops.py check-secret ALIAS` for each requested card that stores credentials. For a specific SSH profile also run `python3 .agents/scripts/ops.py doctor ALIAS --connection NAME --auth METHOD` with the selectors that apply. Restore any external key file or SSH agent identity separately when that profile requires it. 3. Record the tested snapshot, covered profiles, exit statuses, and blockers. Report local decryption and profile readiness as such. If remote login is in scope, verify it separately using the [server operation skill](../server-operate/SKILL.md#connect-and-verify). Remove only disposable rehearsal copies you are authorized to discard. ## Verify - Run `python3 .agents/scripts/ops.py doctor` in the active Linux venv or `./.venv/Scripts/python.exe .agents/scripts/ops.py doctor` in PowerShell. It checks tool availability, the active Git hook, and the project venv. Append `ALIAS` and optional `--connection NAME`, `--user LOGIN`, or `--auth METHOD` to check the pinned host key and the selected credentials locally. `doctor` reports the configured key's SHA-256 fingerprint. A failing check returns exit status 1. Connect separately to verify remote login. - Check tool versions. On Linux syntax-check `.agents/playbooks/ping.yml` using `ANSIBLE_CONFIG=.agents/ansible.cfg` and a disposable inventory. - In a temporary checkout, verify that the Git hook accepts valid staged files and rejects unsafe entries. On Linux verify a SOPS round trip with dummy data and a temporary age identity. Remove temporary data after testing. - Report specific blockers and continue independent checks. Use disposable data for bootstrap checks and continue the requested server task after its local prerequisites are ready. ## Optional RTK for Codex - Reuse an existing RTK installation and Codex hook. Check `rtk --version` and `rtk init --codex --show`. If installing RTK, select the workstation's platform and architecture and verify the archive against the published checksum. [Official RTK releases](https://github.com/rtk-ai/rtk/releases) - For automatic compression, choose one hook scope. If there is no existing hook, run `rtk init --codex` from the selected server-ops checkout. Restart Codex and trust the project hook if prompted. For manual use, run `rtk git status` or `rtk rg PATTERN PATH`. [RTK setup for Codex](https://www.rtk-ai.app/docs/getting-started/supported-agents/#codex-cli) - Run `rtk gain --project` from the server-ops checkout root to see estimated savings. Follow "Command output" in that checkout's `AGENTS.md` for SSH, credentials, and exact output.