Skip to content

Ansible: Support more SMB servers, refactor homebrew and asdf install - #354

Merged
bubacoder merged 1 commit into
mainfrom
feature/ansible-refactor
Jun 27, 2026
Merged

Ansible: Support more SMB servers, refactor homebrew and asdf install#354
bubacoder merged 1 commit into
mainfrom
feature/ansible-refactor

Conversation

@bubacoder

@bubacoder bubacoder commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features
    • Added native asdf installation and shell setup for Debian hosts.
    • Added support for multiple Samba servers and per-server shares (structured server list).
  • Bug Fixes
    • Streamlined Debian Homebrew provisioning by removing the separate Homebrew role and tightening when Homebrew setup runs.
    • Improved Samba mounting behavior and defaults, including conditional execution and updated mount options.
  • Documentation
    • Updated Debian setup instructions to reflect the new role selection.

@coderabbitai

coderabbitai Bot commented Jun 24, 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: e1991c1f-610b-4602-9b4a-4eadbdb087b0

📥 Commits

Reviewing files that changed from the base of the PR and between 7a31083 and 74e602c.

📒 Files selected for processing (16)
  • .devcontainer/Dockerfile
  • ansible/inventory/group_vars/debian/vars.yaml
  • ansible/inventory/inventory.yaml
  • ansible/playbooks/cloud.yaml
  • ansible/playbooks/homelab.yaml
  • ansible/roles/common/tasks/asdf.yaml
  • ansible/roles/debian_homebrew/tasks/main.yaml
  • ansible/roles/debian_samba_client/defaults/main.yaml
  • ansible/roles/debian_samba_client/tasks/10-samba.yaml
  • ansible/roles/debian_samba_client/tasks/20-samba-server.yaml
  • ansible/roles/debian_samba_client/tasks/main.yaml
  • ansible/roles/debian_tools/tasks/20-homebrew.yaml
  • ansible/roles/debian_tools/tasks/30-asdf.yaml
  • ansible/roles/debian_tools/tasks/main.yaml
  • ansible/roles/mac_base/tasks/main.yaml
  • docs/setup.md
💤 Files with no reviewable changes (3)
  • ansible/roles/debian_homebrew/tasks/main.yaml
  • ansible/playbooks/cloud.yaml
  • ansible/playbooks/homelab.yaml
✅ Files skipped from review due to trivial changes (2)
  • docs/setup.md
  • ansible/roles/mac_base/tasks/main.yaml
🚧 Files skipped from review as they are similar to previous changes (11)
  • ansible/roles/common/tasks/asdf.yaml
  • ansible/roles/debian_samba_client/tasks/10-samba.yaml
  • ansible/roles/debian_samba_client/tasks/main.yaml
  • .devcontainer/Dockerfile
  • ansible/roles/debian_tools/tasks/30-asdf.yaml
  • ansible/roles/debian_samba_client/tasks/20-samba-server.yaml
  • ansible/roles/debian_samba_client/defaults/main.yaml
  • ansible/roles/debian_tools/tasks/main.yaml
  • ansible/inventory/group_vars/debian/vars.yaml
  • ansible/roles/debian_tools/tasks/20-homebrew.yaml
  • ansible/inventory/inventory.yaml

Walkthrough

The PR removes the standalone debian_homebrew role from Debian setup paths, installs asdf directly into ~/.local/bin, and changes the Samba client role to mount shares from a list of server objects instead of a single NAS entry.

Changes

Debian tooling and Samba updates

Layer / File(s) Summary
Homebrew ownership moved
ansible/playbooks/cloud.yaml, ansible/playbooks/homelab.yaml, .devcontainer/Dockerfile, docs/setup.md, ansible/inventory/inventory.yaml, ansible/inventory/group_vars/debian/vars.yaml, ansible/roles/debian_tools/tasks/20-homebrew.yaml, ansible/roles/debian_tools/tasks/main.yaml
debian_homebrew is removed from role lists and setup docs. Debian inventory removes the common brew group and common package list. debian_tools now installs Homebrew prerequisites, runs the installer, updates ~/.bashrc, and uses a tighter condition for including the Homebrew task.
asdf installed from binary
ansible/inventory/group_vars/debian/vars.yaml, ansible/roles/debian_tools/tasks/30-asdf.yaml, ansible/roles/debian_tools/tasks/main.yaml, ansible/roles/common/tasks/asdf.yaml, ansible/roles/mac_base/tasks/main.yaml
debian_tools adds a direct asdf download/install task for ~/.local/bin, then updates shell PATH setup. The shared asdf tasks and mac base inputs switch from asdf_brew_bin_path to asdf_bin_path, and Debian inventory sets debian_tools_asdf_version: v0.16.7.
Samba client uses server list
ansible/inventory/group_vars/debian/vars.yaml, ansible/roles/debian_samba_client/defaults/main.yaml, ansible/roles/debian_samba_client/tasks/main.yaml, ansible/roles/debian_samba_client/tasks/10-samba.yaml, ansible/roles/debian_samba_client/tasks/20-samba-server.yaml
debian_samba_client replaces flat NAS fields with debian_samba_client_servers, updates mount defaults, gates on the new list, and loops over each server to create credentials, mount directories, and CIFS mounts per share.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • bubacoder/infra#262: Modifies the same debian_tools_brew_install_groups and brew package variables that this PR trims.
  • bubacoder/infra#334: Also changes role execution paths involving debian_homebrew and debian_tools.
  • bubacoder/infra#352: Touches the shared asdf task flow and the asdf_bin_path transition used here.
🚥 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 summarizes the main changes: expanded SMB server support and Homebrew/ASDF install refactors.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/ansible-refactor

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.

@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/roles/debian_samba_client/tasks/20-samba-server.yaml`:
- Around line 2-11: The credentials file task for samba_server.hostname is
rendering admin_password directly in copy.content, which can leak secrets in
task output or diffs. Add no_log: true to the task that creates the SMB
credentials file so the sensitive content is suppressed during execution, while
keeping the existing when: admin_password is defined guard and the current copy
behavior unchanged.
- Around line 13-38: The tasks that create the mount base and share directories
are still running even when the CIFS mount in Mount shares from {{
samba_server.hostname }} is skipped by the admin_password condition. Move the
directory creation logic into the same conditional guard as the
ansible.posix.mount task, or otherwise ensure both Create mount base directory
for {{ samba_server.hostname }} and Create mount directories for {{
samba_server.hostname }} only run when the SMB mount will actually be performed.

In `@ansible/roles/debian_tools/tasks/20-homebrew.yaml`:
- Around line 15-17: The Homebrew install step is executing the upstream
installer from HEAD, which is not reproducible and creates a supply-chain risk.
Update the ansible.builtin.shell task in the Homebrew install block to use a
pinned installer revision or a locally vendored, checksummed script instead of
fetching HEAD at runtime. Keep the change confined to the Install Homebrew task
so provisioning remains deterministic and safer.

In `@ansible/roles/debian_tools/tasks/30-asdf.yaml`:
- Around line 9-27: The current guard in the asdf install task only checks
whether the binary exists, so `debian_tools_asdf_version` changes are ignored
after the first run. Update the logic around the `stat` check and the
`ansible.builtin.unarchive` task in `30-asdf.yaml` so it verifies the installed
asdf version matches `debian_tools_asdf_version` before skipping the download,
and only reuse the existing binary when the pinned version is already present.
- Around line 29-35: The PATH setup in the asdf-related task only adds the shims
directory, so interactive shells may still miss the asdf binary itself. Update
the lineinfile entry in the asdf task to add both ~/.local/bin and the shims
path to PATH, keeping the same shell startup file handling and using the
existing task name and lineinfile configuration as the place to adjust.

In `@ansible/roles/debian_tools/tasks/main.yaml`:
- Around line 7-17: The setup docs are still pointing users at the old Homebrew
role path, so update the documentation to make debian_tools the single
entrypoint for Homebrew setup and remove the separate debian_homebrew inclusion.
Adjust the relevant setup instructions in docs/setup.md to match the new role
structure introduced by debian_tools and its include_tasks flow for Homebrew, so
fresh installs follow the correct path.
🪄 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: 6167182e-61ef-4322-8792-d180482da4cd

📥 Commits

Reviewing files that changed from the base of the PR and between 35be9ee and abf4718.

📒 Files selected for processing (14)
  • ansible/inventory/group_vars/debian/vars.yaml
  • ansible/inventory/inventory.yaml
  • ansible/playbooks/cloud.yaml
  • ansible/playbooks/homelab.yaml
  • ansible/roles/common/tasks/asdf.yaml
  • ansible/roles/debian_homebrew/tasks/main.yaml
  • ansible/roles/debian_samba_client/defaults/main.yaml
  • ansible/roles/debian_samba_client/tasks/10-samba.yaml
  • ansible/roles/debian_samba_client/tasks/20-samba-server.yaml
  • ansible/roles/debian_samba_client/tasks/main.yaml
  • ansible/roles/debian_tools/tasks/20-homebrew.yaml
  • ansible/roles/debian_tools/tasks/30-asdf.yaml
  • ansible/roles/debian_tools/tasks/main.yaml
  • ansible/roles/mac_base/tasks/main.yaml
💤 Files with no reviewable changes (3)
  • ansible/roles/debian_homebrew/tasks/main.yaml
  • ansible/playbooks/cloud.yaml
  • ansible/playbooks/homelab.yaml

Comment thread ansible/roles/debian_samba_client/tasks/20-samba-server.yaml
Comment thread ansible/roles/debian_samba_client/tasks/20-samba-server.yaml
Comment on lines +15 to +17
- name: Install Homebrew
ansible.builtin.shell: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

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.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Pin the Homebrew installer instead of executing HEAD.

curl .../HEAD/install.sh | bash makes every provision depend on whatever script upstream serves at runtime. That is unreproducible and creates a direct remote-code-execution supply-chain risk on all target hosts. Fetch a pinned revision or checksummed local copy first, then execute that.

🤖 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_tools/tasks/20-homebrew.yaml` around lines 15 - 17, The
Homebrew install step is executing the upstream installer from HEAD, which is
not reproducible and creates a supply-chain risk. Update the
ansible.builtin.shell task in the Homebrew install block to use a pinned
installer revision or a locally vendored, checksummed script instead of fetching
HEAD at runtime. Keep the change confined to the Install Homebrew task so
provisioning remains deterministic and safer.

Comment on lines +9 to +27
- name: Check if asdf binary is already installed
ansible.builtin.stat:
path: "{{ ansible_facts['env']['HOME'] }}/.local/bin/asdf"
register: _debian_tools_asdf_installed
become: false

- name: Download and install asdf binary
ansible.builtin.unarchive:
src: >-
https://github.com/asdf-vm/asdf/releases/download/{{ debian_tools_asdf_version }}/asdf-{{ debian_tools_asdf_version }}-linux-{{
'amd64' if ansible_facts['architecture'] == 'x86_64' else 'arm64'
}}.tar.gz
dest: "{{ ansible_facts['env']['HOME'] }}/.local/bin"
remote_src: true
include:
- asdf
mode: "0755"
become: false
when: not _debian_tools_asdf_installed.stat.exists

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

The version pin never reapplies after the first install.

This guard only checks whether ~/.local/bin/asdf exists. Once the file is present, changing debian_tools_asdf_version will not fetch the new release, so the inventory pin is ignored on later runs. Compare the installed version against debian_tools_asdf_version before skipping the download.

🤖 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_tools/tasks/30-asdf.yaml` around lines 9 - 27, The
current guard in the asdf install task only checks whether the binary exists, so
`debian_tools_asdf_version` changes are ignored after the first run. Update the
logic around the `stat` check and the `ansible.builtin.unarchive` task in
`30-asdf.yaml` so it verifies the installed asdf version matches
`debian_tools_asdf_version` before skipping the download, and only reuse the
existing binary when the pinned version is already present.

Comment thread ansible/roles/debian_tools/tasks/30-asdf.yaml
Comment thread ansible/roles/debian_tools/tasks/main.yaml
@bubacoder
bubacoder force-pushed the feature/ansible-refactor branch from abf4718 to 7a31083 Compare June 27, 2026 09:49
@bubacoder
bubacoder force-pushed the feature/ansible-refactor branch from 7a31083 to 74e602c Compare June 27, 2026 11:11
@bubacoder
bubacoder merged commit 1a768c7 into main Jun 27, 2026
6 checks passed
@bubacoder
bubacoder deleted the feature/ansible-refactor branch June 27, 2026 11:26
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