Skip to content

Ubuntu desktop role - #337

Merged
bubacoder merged 9 commits into
mainfrom
feature/ubuntu-desktop-role
Jun 6, 2026
Merged

Ubuntu desktop role#337
bubacoder merged 9 commits into
mainfrom
feature/ubuntu-desktop-role

Conversation

@bubacoder

@bubacoder bubacoder commented Jun 6, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Automated Ubuntu desktop setup: snap package support plus optional Chrome, RustDesk, and Sunshine installs with configurable defaults.
  • Chores

    • Improved deployment scripts to use explicit inventories and preserve CLI forwarding.
    • Added example secret placeholders and pinned script dependencies.
    • CI now includes additional audit checks for scripts and infra requirements.
  • Bug Fixes

    • Graceful error message when a required Python package is missing.

@coderabbitai

coderabbitai Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@bubacoder, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 15 minutes and 2 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: cf51323c-2796-47e9-b376-71aefda2453b

📥 Commits

Reviewing files that changed from the base of the PR and between 3c55f74 and b6e0818.

⛔ Files ignored due to path filters (1)
  • scripts/infra-mcp/uv.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • .github/workflows/pre-commit.yml
  • ansible/inventory/group_vars/debian/vars.yaml
  • ansible/roles/debian_base/tasks/70-user.yaml
  • ansible/roles/ubuntu_desktop/tasks/40-sunshine.yaml
  • scripts/labctl.py
  • scripts/requirements.txt

Walkthrough

Adds an ubuntu_desktop Ansible role (snap, Chrome, RustDesk, Sunshine), integrates it into the homelab playbook, refactors apply-* scripts to pass explicit inventory files, moves tea to Homebrew, supplies example secrets, pins Python deps, and adds CI pip-audit jobs.

Changes

Ubuntu Desktop Infrastructure

Layer / File(s) Summary
Ansible Playbook Script Infrastructure
ansible/apply-cloud.sh, ansible/apply-homelab.sh, ansible/apply-localhost.sh
Refactors wrapper scripts to multi-line invocations and explicitly pass -i inventory/inventory.yaml -i ../config/ansible/inventory/inventory.yaml to ansible-playbook, preserving existing limits and argument forwarding.
Ubuntu Desktop Role Configuration and Orchestration
ansible/roles/ubuntu_desktop/defaults/main.yaml, ansible/roles/ubuntu_desktop/tasks/main.yaml
Adds role defaults for snap lists, classic snaps, install toggles, and pinned RustDesk/Sunshine versions; main tasks import snap installation unconditionally and Chrome/RustDesk/Sunshine installers conditionally.
Ubuntu Desktop Installation Task Implementations
ansible/roles/ubuntu_desktop/tasks/10-snap.yaml, .../20-chrome.yaml, .../30-rustdesk.yaml, .../40-sunshine.yaml
New task files: snap installs (regular and classic); Chrome presence check, download, install, and cleanup; RustDesk version check and versioned .deb install; Sunshine version check, dependency install, release checksum extraction, download, install, and cleanup.
Homelab Playbook and System Configuration Integration
ansible/playbooks/homelab.yaml, ansible/inventory/group_vars/debian/vars.yaml
Homelab playbook adds Setup Ubuntu desktop software applying ubuntu_desktop to colony. Debian group vars move tea from apt to Homebrew dev tools and add uv to the Homebrew dev list.
Example Configuration and Python Dependencies
config-example/ansible/inventory/group_vars/debian/secret.yaml, scripts/labctl.py, scripts/requirements.txt, .github/workflows/pre-commit.yml
Adds example secret placeholders for Debian group_vars; guards yaml import in labctl.py with user-facing error and exit; pins pyyaml and requests in scripts/requirements.txt; adds audit-scripts and audit-infra-mcp pip-audit jobs to pre-commit workflow.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

  • bubacoder/infra#245: Modifies ansible/inventory/group_vars/debian/vars.yaml dev package lists related to tea and apt/Homebrew tooling.
  • bubacoder/infra#334: Related changes to ansible/apply-localhost.sh invocation and homelab playbook usage.
  • bubacoder/infra#262: Also edits Debian dev package selections in ansible/inventory/group_vars/debian/vars.yaml.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Ubuntu desktop role' directly reflects the main addition of a new ubuntu_desktop Ansible role across multiple files, which is a primary focus of the changeset alongside supporting infrastructure changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/ubuntu-desktop-role

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ansible/apply-localhost.sh`:
- Line 9: The script currently uses --limit "$(hostname)" which can miss the
inventory host alias; replace the runtime hostname usage with the inventory
alias (e.g., --limit "local-debian") or read a variable (e.g.,
INVENTORY_LOCAL_ALIAS) and pass that to --limit so the play targets the
inventory entry mapped in ansible/inventory/inventory.yaml (the current symbol
to change is the --limit "$(hostname)" argument in apply-localhost.sh).

In `@ansible/roles/ubuntu_desktop/tasks/40-sunshine.yaml`:
- Around line 20-23: Add a checksum to the ansible.builtin.get_url task that
downloads the Sunshine .deb to /tmp/sunshine.deb: fetch the SHA256 from the
release checksums file for the release identified by
ubuntu_desktop_sunshine_version and set the checksum: field on the get_url task
(using the "sha256:<hex>" form) so ansible verifies the artifact before the
installation step that uses /tmp/sunshine.deb.
- Around line 22-29: The tasks that download and install Sunshine use a fixed,
predictable path (/tmp/sunshine.deb) which is unsafe under privilege escalation;
replace that with a unique private temp file created by ansible.builtin.tempfile
and reuse that variable for download, the ansible.builtin.apt deb parameter, and
cleanup. Locate the tasks named "Install Sunshine" (and the earlier download
task that sets dest: /tmp/sunshine.deb) and change them to call
ansible.builtin.tempfile to register a temp path (e.g., register: sunshine_deb),
reference sunshine_deb.path for get_url/download and for the ansible.builtin.apt
deb: parameter, and remove the fixed /tmp path and add a final cleanup task to
file: state=absent path={{ sunshine_deb.path }}.

In `@config-example/ansible/inventory/group_vars/debian/secret.yaml`:
- Around line 3-4: Remove the inline KICS suppression comment "# kics-scan
ignore-line" from the template so the scanner can detect accidental plaintext
secrets; replace the hardcoded admin_password placeholder with a non-secret
template value (e.g. empty string or "<REPLACE_WITH_VAULT_SECRET>") and
document/migrate the real secret into Ansible Vault or environment-backed secret
management, and ensure the secret.yaml template remains tracked while actual
secrets are stored encrypted or excluded (admin_password reference).

In `@scripts/labctl.py`:
- Around line 14-18: The current broad ImportError around "import yaml" can hide
errors raised from within the yaml package; change the except to only handle
missing module by catching ModuleNotFoundError (or check e.name == "yaml") for
the "import yaml" statement and print the install message in that case, while
re-raising any other ImportError/Exception so internal package errors aren't
masked; locate the try/except around the "import yaml" line in scripts/labctl.py
and implement the selective handling (e.g., except ModuleNotFoundError:
print...; except Exception: raise).

In `@scripts/requirements.txt`:
- Around line 1-2: The requirements file currently lists unpinned dependencies
`pyyaml` and `requests` in scripts/requirements.txt; update this by pinning them
to exact, audited versions (e.g., match repo standards like pyyaml==6.0.3 or the
vetted version you choose and a specific requests==<version>) or replace the
file with a generated constraints/lock file and reference it from
scripts/requirements.txt; then add/verify a CI step that runs pip-audit against
that pinned/locked requirements to fail on vulnerabilities.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b8e17774-2737-4c88-86af-694eb513c7eb

📥 Commits

Reviewing files that changed from the base of the PR and between 2354ede and 30c8084.

📒 Files selected for processing (14)
  • ansible/apply-cloud.sh
  • ansible/apply-homelab.sh
  • ansible/apply-localhost.sh
  • ansible/inventory/group_vars/debian/vars.yaml
  • ansible/playbooks/homelab.yaml
  • ansible/roles/ubuntu_desktop/defaults/main.yaml
  • ansible/roles/ubuntu_desktop/tasks/10-snap.yaml
  • ansible/roles/ubuntu_desktop/tasks/20-chrome.yaml
  • ansible/roles/ubuntu_desktop/tasks/30-rustdesk.yaml
  • ansible/roles/ubuntu_desktop/tasks/40-sunshine.yaml
  • ansible/roles/ubuntu_desktop/tasks/main.yaml
  • config-example/ansible/inventory/group_vars/debian/secret.yaml
  • scripts/labctl.py
  • scripts/requirements.txt

Comment thread ansible/apply-localhost.sh
Comment thread ansible/roles/ubuntu_desktop/tasks/40-sunshine.yaml
Comment thread ansible/roles/ubuntu_desktop/tasks/40-sunshine.yaml Outdated
Comment thread config-example/ansible/inventory/group_vars/debian/secret.yaml
Comment thread scripts/labctl.py
Comment thread scripts/requirements.txt Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/pre-commit.yml:
- Around line 9-27: For both jobs audit-scripts and audit-infra-mcp, restrict
GITHUB_TOKEN to read-only and stop persisting checkout credentials: add a
permissions: block (e.g., permissions: contents: read) at the job level (or
top-level) and update each actions/checkout step to include persist-credentials:
false (on the Checkout steps that use actions/checkout@de0fac2e...). This
ensures the audit jobs only get read access and do not retain credentials in git
config.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4bee8d63-a677-4acc-be83-d4927093f028

📥 Commits

Reviewing files that changed from the base of the PR and between 30c8084 and 3c55f74.

⛔ Files ignored due to path filters (1)
  • scripts/infra-mcp/uv.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • .github/workflows/pre-commit.yml
  • ansible/roles/ubuntu_desktop/tasks/40-sunshine.yaml
  • scripts/requirements.txt
🚧 Files skipped from review as they are similar to previous changes (2)
  • scripts/requirements.txt
  • ansible/roles/ubuntu_desktop/tasks/40-sunshine.yaml

Comment thread .github/workflows/pre-commit.yml
@bubacoder
bubacoder force-pushed the feature/ubuntu-desktop-role branch from 3c55f74 to caa810b Compare June 6, 2026 14:47
@bubacoder
bubacoder force-pushed the feature/ubuntu-desktop-role branch from caa810b to 876b7f7 Compare June 6, 2026 15:05
@bubacoder
bubacoder force-pushed the feature/ubuntu-desktop-role branch from 876b7f7 to b6e0818 Compare June 6, 2026 15:21
@bubacoder
bubacoder merged commit d7367e3 into main Jun 6, 2026
8 checks passed
@bubacoder
bubacoder deleted the feature/ubuntu-desktop-role branch June 6, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant