Support Ubuntu desktop environment, modernize Ansible roles - #334
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (18)
💤 Files with no reviewable changes (1)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (12)
WalkthroughThis 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. ChangesInfrastructure Modernization and Homebrew Migration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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 winTreat empty
admin_passwordas missing here too.
debian_base/tasks/70-user.yamlalready usesadmin_password|default('') != '', but this role only checksis 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 winStale 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 winRepo cache isn’t refreshed before installing Crowdsec iptables bouncer (first-run failure).
ansible.builtin.deb822_repositoryonlynotifys theUpdate apt cachehandler; handlers run after tasks complete, so the subsequentansible.builtin.aptinstall runs before APT lists include the newly added repo (the role’sapt update_cachehappens earlier in10-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 winMissing
python3-debiandependency required fordeb822_repositorymodule.The
deb822_repositorymodule requires thepython3-debianpackage 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
📒 Files selected for processing (18)
.devcontainer/Dockerfileansible/README.mdansible/Taskfile.ansible.yamlansible/apply-localhost.shansible/inventory/group_vars/debian/vars.yamlansible/inventory/inventory.yamlansible/playbooks/cloud.yamlansible/playbooks/homelab.yamlansible/requirements.ymlansible/roles/debian_base/handlers/main.yamlansible/roles/debian_base/tasks/50-crowdsec.yamlansible/roles/debian_base/tasks/70-user.yamlansible/roles/debian_docker_host/tasks/10-docker-Debian.yamlansible/roles/debian_docker_host/tasks/10-docker-Ubuntu.yamlansible/roles/debian_homebrew/tasks/main.yamlansible/roles/debian_samba_client/tasks/10-samba.yamldocs/setup.mdterraform/azure-vm/README.md
💤 Files with no reviewable changes (1)
- ansible/requirements.yml
071f8a7 to
1ce5d9a
Compare
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Documentation
Chores