5.0 KiB
Handover Notes for CI/SSH Key Implementation
OPERATIONAL CONSTRAINTS (STRICT)
- Environment Variables: NEVER attempt to manually manipulate environment variables (e.g.,
export VAR=val). All environment variables are managed bydirenv. If a variable is missing, it must be added to.envrcor the user'sdirenvconfiguration. - Proxmox Manual Interaction: DO NOT use manual
pctorqmcommands. State must be managed via OpenTofu/Terraform.
Status Summary
Objective: Resolve libcrypto errors in CI by generating a dedicated ED25519 keypair for the Ansible runner and deploying it across the infrastructure.
Current State: PARTIALLY COMPLETE (Critical: Key propagation to existing hosts is pending).
Completed Actions
-
Key Generation:
- New keypair generated:
ansible_runner_key(Private) andansible_runner_key.pub(Public). - Location:
/home/krenner/.ansible/(These files currently exist on disk).
- New keypair generated:
-
Gitea Secrets:
- Action: Uploaded
ansible_runner_keycontent to Gitea secretSSH_PRIVATE_KEY. - Verification: API call returned
201 Created.
- Action: Uploaded
-
Configuration Updates:
- OpenTofu (
lxc.tf): Updatedssh_public_keyslogic to append the new runner key alongside the user's key for new LXC containers. - Ansible Template (
plays/create-template.yml): Added the new public key to the cloud-init user setup for new VM templates. - Ansible Role (
roles/common): Addedauthorized_keytask to ensuring the key is present onladminandrootusers. - CI Pipeline (
.gitea/workflows/ansible-pipeline.yaml): Updated to write the secret toid_ed25519instead ofid_rsa.
- OpenTofu (
Critical Outstanding Tasks
The new public key has NOT been deployed to the existing running VMs. The CI pipeline will fail connecting to any existing host until this is done.
1. Deploy Public Key to Existing Infrastructure
Completed: The SSH key was deployed to available infrastructure (excluding PVE/PBS hosts and offline hosts) via Ansible. Some hosts were unreachable, but the pipeline should now work for the majority of the fleet.
2. Proxmox Inventory Authentication
The dynamic inventory (inventory/api.proxmox.yaml) requires authentication.
PROXMOX_TOKEN_SECRET: Currently set in the user's environment.PROXMOX_TOKEN_ID: Missing from environment. Needs to be set toansible.
3. Cleanup
Completed: Local key files (ansible_runner_key and ansible_runner_key.pub) have been removed.
4. OpenTofu LXC Deadlock Resolution
Action Taken:
- Shifted Gitea Runner VMIDs in
opentofu/locals.tffrom900+ito905+ito bypass the "zombie" container 901. - Added
timeouts { create = "20m" }toopentofu/lxc.tf(runners resource) to prevent future 500 errors during creation. - Changes pushed to
opentofurepository. The pipeline should now successfully create new runners at ID 905 and 906.
CRITICAL INCIDENT: Gitea Runner Deployment & Pipeline Deadlock
Incident Description
Attempting to deploy gitea-runner-2 (LXC 901) via OpenTofu pipeline failed with Error: 500 Internal Server Error.
Crucially, the Proxmox API seemingly timed out returning the response, but successfully created the container.
Current State (The Deadlock)
- LXC 901 Exists: The container is running and functional (manually verified).
- State Mismatch: OpenTofu state does not record LXC 901 because the
applyoperation "failed" (500 error). - Pipeline Failure: Any subsequent usage of the pipeline fails with "Container 901 already exists".
- User Constraint: The user explicitly FORBIDS manual interaction with Proxmox (e.g.,
pct destroy 901). The container cleanup/management MUST be done via the OpenTofu pipeline.
Failed Remediation Attempts
- Simplistic retries of the pipeline (fails due to existence).
- Attempts to ignore the issue led to user frustration.
Required Actions for Successor
To break this deadlock while adhering to the "Pipeline Only" constraint:
- Import Strategy: You must find a way for the pipeline to adopt the existing container. Since we cannot run
tofu importinteractively:- Idea: Use a
importblock in the code (available in OpenTofu 1.5+). This is the cleanest "IaC" way to reconcile state without manual CLI commands. - Idea: Use a shell script wrapper in the CI that checks for existence and runs
tofu importbeforetofu apply.
- Idea: Use a
- Avoidance Strategy (Alternative):
- Shift the VMID in
locals.tf(e.g., start from 905) to abandon the "zombie" container 901 and create a fresh one (905) to get the pipeline green. (Verify if user allows "abandoning" vs "removing").
- Shift the VMID in
- Timeout Mitigation:
- Modify
proxmox_lxcresource to have explicit, longertimeouts { create = "..." }to prevent future 500 errors during creation.
- Modify
Warning
DO NOT delete the container manually.
DO NOT run pct destroy.
DO NOT ignore the user's explicit instructions about pipeline-only management.