Skip to content

Support Ubuntu desktop environment, modernize Ansible roles - #334

Merged
bubacoder merged 1 commit into
mainfrom
kubuntu-desktop
Jun 3, 2026
Merged

Support Ubuntu desktop environment, modernize Ansible roles#334
bubacoder merged 1 commit into
mainfrom
kubuntu-desktop

Conversation

@bubacoder

@bubacoder bubacoder commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

Release Notes

  • New Features

    • Added Homebrew package manager support for Debian-based systems.
    • Added local-host application capability for Ansible playbooks.
  • Bug Fixes

    • Improved SSH key validation with clear error messages when keys are missing.
    • Enhanced tool availability detection with graceful fallbacks.
  • Documentation

    • Updated setup instructions with clearer Ansible bootstrap steps.
    • Added comprehensive infrastructure setup reference guide.
  • Chores

    • Modernized Docker repository configuration management.
    • Updated Go Task to v3.51.1.
    • Added openssh-server and GitHub CLI tool support.

@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: dfe2cd7d-fa02-45ea-8a90-ef462bb9dc88

📥 Commits

Reviewing files that changed from the base of the PR and between 071f8a7 and 1ce5d9a.

📒 Files selected for processing (18)
  • .devcontainer/Dockerfile
  • Taskfile.yaml
  • ansible/README.md
  • ansible/Taskfile.ansible.yaml
  • ansible/apply-localhost.sh
  • ansible/inventory/group_vars/debian/vars.yaml
  • ansible/inventory/inventory.yaml
  • ansible/playbooks/cloud.yaml
  • ansible/playbooks/homelab.yaml
  • ansible/requirements.yml
  • ansible/roles/debian_base/handlers/main.yaml
  • ansible/roles/debian_base/tasks/50-crowdsec.yaml
  • ansible/roles/debian_base/tasks/70-user.yaml
  • ansible/roles/debian_docker_host/tasks/10-docker-Debian.yaml
  • ansible/roles/debian_docker_host/tasks/10-docker-Ubuntu.yaml
  • ansible/roles/debian_homebrew/tasks/main.yaml
  • ansible/roles/debian_samba_client/tasks/10-samba.yaml
  • docs/setup.md
💤 Files with no reviewable changes (1)
  • ansible/requirements.yml
✅ Files skipped from review due to trivial changes (2)
  • ansible/README.md
  • docs/setup.md
🚧 Files skipped from review as they are similar to previous changes (12)
  • ansible/roles/debian_base/handlers/main.yaml
  • .devcontainer/Dockerfile
  • ansible/playbooks/cloud.yaml
  • ansible/roles/debian_samba_client/tasks/10-samba.yaml
  • ansible/playbooks/homelab.yaml
  • ansible/roles/debian_docker_host/tasks/10-docker-Ubuntu.yaml
  • ansible/apply-localhost.sh
  • ansible/Taskfile.ansible.yaml
  • ansible/inventory/inventory.yaml
  • ansible/roles/debian_docker_host/tasks/10-docker-Debian.yaml
  • ansible/roles/debian_homebrew/tasks/main.yaml
  • ansible/roles/debian_base/tasks/50-crowdsec.yaml

Walkthrough

This PR migrates infrastructure provisioning from an external Linuxbrew role to a custom Debian-native Homebrew implementation. It modernizes APT repository management across CrowdSec and Docker tasks, enables local playbook execution for dev hosts, adds safety checks to role execution, and updates documentation and tooling.

Changes

Infrastructure Modernization and Homebrew Migration

Layer / File(s) Summary
Homebrew Role Implementation and Dependency Removal
ansible/roles/debian_homebrew/tasks/main.yaml, ansible/requirements.yml
New debian_homebrew role installs Homebrew via official script with Debian prerequisite packages and bashrc integration; removes external markosamuli.linuxbrew Galaxy dependency.
Homebrew Wiring to Playbooks, Inventory, and Dev Container
ansible/playbooks/cloud.yaml, ansible/playbooks/homelab.yaml, .devcontainer/Dockerfile, ansible/inventory/group_vars/debian/vars.yaml, ansible/inventory/inventory.yaml
Updates cloud and homelab playbooks to use new debian_homebrew role; configures Python interpreter and packages in Debian group vars; adds colony host to Docker and Samba plays; sets CrowdSec suite and Homebrew package groups in inventory.
APT Repository Modernization with deb822_repository
ansible/roles/debian_base/handlers/main.yaml, ansible/roles/debian_base/tasks/50-crowdsec.yaml, ansible/roles/debian_docker_host/tasks/10-docker-Debian.yaml, ansible/roles/debian_docker_host/tasks/10-docker-Ubuntu.yaml
Replaces deprecated apt_key and apt_repository with modern deb822_repository module for CrowdSec and Docker repos; adds APT cache update handler; includes python3-debian prerequisite for Docker on Debian.
Local Ansible Execution Script and Task
ansible/apply-localhost.sh, ansible/Taskfile.ansible.yaml
New apply-localhost.sh wrapper script executes playbooks locally with hostname scope and local connection mode; creates Taskfile task for convenient invocation.
Role Safety Improvements and Conditional Execution
ansible/roles/debian_base/tasks/70-user.yaml, ansible/roles/debian_samba_client/tasks/10-samba.yaml
Adds SSH key file existence check in debian_base before authorized_key task; adds admin_password validation and conditional guards in samba_client to prevent credentials-dependent operations.
Documentation Updates and Tooling Improvements
ansible/README.md, docs/setup.md, Taskfile.yaml
Adds explicit sudo to Ansible bootstrap instruction; details dev/admin host setup with config file updates and local playbook execution; adds Ansible README cross-reference; improves version check robustness for missing tools.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • bubacoder/infra#165: Modifies the same debian_base task files for CrowdSec and user setup that this PR refactors with deb822_repository and SSH key validation.
  • bubacoder/infra#262: Introduces debian_tools role and brew package grouping that this PR extensively configures in inventory and playbooks via debian_tools_brew_install_groups.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main changes: adding Ubuntu desktop support and modernizing Ansible roles by replacing markosamuli.linuxbrew with debian_homebrew and updating to deb822_repository.
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.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch kubuntu-desktop

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: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
ansible/roles/debian_samba_client/tasks/10-samba.yaml (1)

9-23: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Treat empty admin_password as missing here too.

debian_base/tasks/70-user.yaml already uses admin_password|default('') != '', but this role only checks is defined. If the variable exists as an empty string, you'll still write a blank credentials file and the later Samba mount path will use it.

Suggested change
 - name: Warn if admin_password is not set
   ansible.builtin.debug:
-    msg: "WARNING: 'admin_password' is not defined — skipping credentials file creation. Samba mounts may fail."
-  when: admin_password is not defined
+    msg: "WARNING: 'admin_password' is not set — skipping credentials file creation. Samba mounts may fail."
+  when: admin_password | default('') == ''
@@
 - name: Create credentials file
   ansible.builtin.copy:
@@
-  when: admin_password is defined
+  when: admin_password | default('') != ''
🤖 Prompt for 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.

In `@ansible/roles/debian_samba_client/tasks/10-samba.yaml` around lines 9 - 23,
The tasks "Warn if admin_password is not set" and "Create credentials file"
currently only check admin_password is defined; change both conditions to treat
an empty string as missing by using the same check as elsewhere (e.g.,
admin_password|default('') != '' or admin_password|default('') | length > 0).
Ensure the warning task triggers when admin_password is undefined or empty, and
ensure the credentials file task only runs when admin_password is non-empty;
keep references to debian_samba_client_credentials_file, admin_user and
admin_password when updating the when clauses.
.devcontainer/Dockerfile (1)

38-38: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Stale comment references "Linuxbrew". Now that the role is debian_homebrew, consider updating the comment to "Homebrew installation is per-user" for consistency.

🤖 Prompt for 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.

In @.devcontainer/Dockerfile at line 38, Update the stale inline comment that
currently reads "Linuxbrew" to "Homebrew" so it matches the role name
debian_homebrew and clarifies that the Homebrew installation is per-user; locate
the comment line "### Setup additional roles (Linuxbrew installation is
per-user)" in the .devcontainer/Dockerfile and replace "Linuxbrew" with
"Homebrew".
ansible/roles/debian_base/tasks/50-crowdsec.yaml (1)

9-23: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Repo cache isn’t refreshed before installing Crowdsec iptables bouncer (first-run failure).

ansible.builtin.deb822_repository only notifys the Update apt cache handler; handlers run after tasks complete, so the subsequent ansible.builtin.apt install runs before APT lists include the newly added repo (the role’s apt update_cache happens earlier in 10-apt.yaml). Add a cache refresh before the install.

🐛 Proposed fix: flush handlers before install
     state: present
   notify: Update apt cache
 
+- name: Flush handlers to refresh apt cache before installing
+  ansible.builtin.meta: flush_handlers
+
 - name: Install crowdsec iptables bouncer
   ansible.builtin.apt:
     name: crowdsec-firewall-bouncer-iptables
     state: present
🤖 Prompt for 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.

In `@ansible/roles/debian_base/tasks/50-crowdsec.yaml` around lines 9 - 23, The
apt repo added by the "Add crowdsec apt repository" deb822_repository task isn't
available to the immediately following "Install crowdsec iptables bouncer" apt
task because handlers (the "Update apt cache" handler) run later; fix this by
forcing the handler to run before the install—insert a meta: flush_handlers task
immediately after the "Add crowdsec apt repository" task (or alternatively set
update_cache: yes on the "Install crowdsec iptables bouncer" ansible.builtin.apt
task) so the APT cache is refreshed from the new repo before attempting to
install crowdsec-firewall-bouncer-iptables.
ansible/roles/debian_docker_host/tasks/10-docker-Ubuntu.yaml (1)

4-14: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Missing python3-debian dependency required for deb822_repository module.

The deb822_repository module requires the python3-debian package on the target system. The Debian variant of this file correctly adds it (line 14), but the Ubuntu file is missing it. This will cause the repository task to fail.

🐛 Proposed fix
       - python3-pip
       - virtualenv
       - python3-setuptools
+      - python3-debian
     state: present
🤖 Prompt for 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.

In `@ansible/roles/debian_docker_host/tasks/10-docker-Ubuntu.yaml` around lines 4
- 14, The Ubuntu apt task "Install required system packages" using
ansible.builtin.apt is missing the python3-debian package required by the
deb822_repository module; update the pkg list in that task (the one named
"Install required system packages") to include python3-debian so the later
repository tasks can import deb822 successfully.
🤖 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`:
- Around line 4-7: The script ansible/apply-localhost.sh currently hardcodes
--limit "$(hostname)" which fails when inventory uses an alias; change the
wrapper to allow an override (e.g. read a LOCAL_HOST or LIMIT env var or accept
a first positional parameter) and fall back to $(hostname) only if no override
is provided, then pass that value into the ansible-playbook --limit flag; also
add a simple validation to error out if the resolved limit is empty to avoid
silently skipping the run (update the ansible-playbook invocation that currently
contains --limit "$(hostname)" and maintain support for passing through "$@" as
before).

In `@ansible/README.md`:
- Line 25: Update the README instruction to use the same bootstrap path as
docs/setup.md by referencing the script with its relative path from the
repository root (ansible/bootstrap-ansible.sh) instead of just
bootstrap-ansible.sh; modify the line that currently shows "sudo
bootstrap-ansible.sh" to "sudo ansible/bootstrap-ansible.sh" so the command
works without requiring users to cd into the ansible/ directory.

In `@ansible/roles/debian_base/tasks/70-user.yaml`:
- Around line 27-38: Replace the current non-fatal "Warn if SSH key file is
missing" behavior with a hard failure when both the SSH key and admin password
are absent: after the ansible.builtin.stat that registers
debian_base_ssh_key_stat, add an ansible.builtin.fail task (or change the debug
task) that triggers when not debian_base_ssh_key_stat.stat.exists and
(admin_password|default('') == '') and include a clear message referencing
admin_user and debian_base_ssh_key_file; keep the existing conditional that
skips the authorized_key task (when: debian_base_ssh_key_stat.stat.exists)
intact so key setup still proceeds only when the file exists.

---

Outside diff comments:
In @.devcontainer/Dockerfile:
- Line 38: Update the stale inline comment that currently reads "Linuxbrew" to
"Homebrew" so it matches the role name debian_homebrew and clarifies that the
Homebrew installation is per-user; locate the comment line "### Setup additional
roles (Linuxbrew installation is per-user)" in the .devcontainer/Dockerfile and
replace "Linuxbrew" with "Homebrew".

In `@ansible/roles/debian_base/tasks/50-crowdsec.yaml`:
- Around line 9-23: The apt repo added by the "Add crowdsec apt repository"
deb822_repository task isn't available to the immediately following "Install
crowdsec iptables bouncer" apt task because handlers (the "Update apt cache"
handler) run later; fix this by forcing the handler to run before the
install—insert a meta: flush_handlers task immediately after the "Add crowdsec
apt repository" task (or alternatively set update_cache: yes on the "Install
crowdsec iptables bouncer" ansible.builtin.apt task) so the APT cache is
refreshed from the new repo before attempting to install
crowdsec-firewall-bouncer-iptables.

In `@ansible/roles/debian_docker_host/tasks/10-docker-Ubuntu.yaml`:
- Around line 4-14: The Ubuntu apt task "Install required system packages" using
ansible.builtin.apt is missing the python3-debian package required by the
deb822_repository module; update the pkg list in that task (the one named
"Install required system packages") to include python3-debian so the later
repository tasks can import deb822 successfully.

In `@ansible/roles/debian_samba_client/tasks/10-samba.yaml`:
- Around line 9-23: The tasks "Warn if admin_password is not set" and "Create
credentials file" currently only check admin_password is defined; change both
conditions to treat an empty string as missing by using the same check as
elsewhere (e.g., admin_password|default('') != '' or admin_password|default('')
| length > 0). Ensure the warning task triggers when admin_password is undefined
or empty, and ensure the credentials file task only runs when admin_password is
non-empty; keep references to debian_samba_client_credentials_file, admin_user
and admin_password when updating the when clauses.
🪄 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: b8fe30e8-b8ba-4acc-8bc0-1cf2f8042431

📥 Commits

Reviewing files that changed from the base of the PR and between 098efaa and 071f8a7.

📒 Files selected for processing (18)
  • .devcontainer/Dockerfile
  • ansible/README.md
  • ansible/Taskfile.ansible.yaml
  • ansible/apply-localhost.sh
  • ansible/inventory/group_vars/debian/vars.yaml
  • ansible/inventory/inventory.yaml
  • ansible/playbooks/cloud.yaml
  • ansible/playbooks/homelab.yaml
  • ansible/requirements.yml
  • ansible/roles/debian_base/handlers/main.yaml
  • ansible/roles/debian_base/tasks/50-crowdsec.yaml
  • ansible/roles/debian_base/tasks/70-user.yaml
  • ansible/roles/debian_docker_host/tasks/10-docker-Debian.yaml
  • ansible/roles/debian_docker_host/tasks/10-docker-Ubuntu.yaml
  • ansible/roles/debian_homebrew/tasks/main.yaml
  • ansible/roles/debian_samba_client/tasks/10-samba.yaml
  • docs/setup.md
  • terraform/azure-vm/README.md
💤 Files with no reviewable changes (1)
  • ansible/requirements.yml

Comment thread ansible/apply-localhost.sh
Comment thread ansible/README.md
Comment thread ansible/roles/debian_base/tasks/70-user.yaml
@bubacoder
bubacoder merged commit b6b170f into main Jun 3, 2026
6 checks passed
@bubacoder
bubacoder deleted the kubuntu-desktop branch June 3, 2026 20:25
@coderabbitai coderabbitai Bot mentioned this pull request Jun 6, 2026
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