Improve Ansible compatibility - #222
Conversation
WalkthroughAdds per-host and default variables to pin Docker package versions and optionally hold them; updates Docker install tasks to install versioned packages and hold selections; standardizes Ansible boolean filter usage from Changes
Sequence Diagram(s)sequenceDiagram
participant Inv as Inventory / User variables
participant Role as debian_docker_host role
participant Apt as APT
participant Dpkg as dpkg_selections
Inv->>Role: provide version vars & hold flag
activate Role
rect rgb(220,240,230)
Note over Role,Apt: Resolve package names
Role->>Role: Build package list (versioned or base names)
Role->>Apt: Install package list (allow_downgrade: true)
Apt-->>Role: Install result
end
rect rgb(240,230,240)
Note over Role,Dpkg: Conditional hold step
alt hold flag true
Role->>Dpkg: Loop: set selection "hold" for each package
Dpkg-->>Role: Held
else hold flag false
Note over Role: Skip holds (packages upgradable)
end
end
deactivate Role
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–30 minutes
Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
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: 1
🧹 Nitpick comments (2)
ansible/roles/debian_docker_host/tasks/10-docker-Debian.yaml (1)
43-53: Inconsistent boolean filter syntax—use explicitansible.builtin.boolfor consistency.Line 53 uses the shorthand
| boolfilter, but the PR objective (evident in debian_base tasks) is to use the explicit| ansible.builtin.boolfilter. This inconsistency undermines the goal of improving Ansible compatibility.Apply this diff to align with the PR pattern:
loop_control: loop_var: package - when: debian_docker_host_hold_docker_packages | bool + when: debian_docker_host_hold_docker_packages | ansible.builtin.boolansible/roles/debian_docker_host/tasks/10-docker-Ubuntu.yaml (1)
42-52: Inconsistent boolean filter syntax—use explicitansible.builtin.boolfor consistency.Line 52 uses the shorthand
| boolfilter, inconsistent with the PR objective to use| ansible.builtin.bool(evident in debian_base tasks and Debian Docker tasks). This undermines platform consistency and the goal of improving Ansible compatibility.Apply this diff to align with the PR pattern:
loop_control: loop_var: package - when: debian_docker_host_hold_docker_packages | bool + when: debian_docker_host_hold_docker_packages | ansible.builtin.bool
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
ansible/inventory/inventory.yaml(1 hunks)ansible/roles/debian_base/tasks/10-apt.yaml(1 hunks)ansible/roles/debian_base/tasks/40-network.yaml(1 hunks)ansible/roles/debian_base/tasks/70-user.yaml(1 hunks)ansible/roles/debian_base/tasks/main.yaml(1 hunks)ansible/roles/debian_docker_host/defaults/main.yaml(1 hunks)ansible/roles/debian_docker_host/tasks/10-docker-Debian.yaml(1 hunks)ansible/roles/debian_docker_host/tasks/10-docker-Ubuntu.yaml(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{yml,yaml}
📄 CodeRabbit inference engine (AGENTS.md)
All YAML files must be linted and validated
Files:
ansible/roles/debian_base/tasks/40-network.yamlansible/roles/debian_docker_host/tasks/10-docker-Debian.yamlansible/roles/debian_base/tasks/70-user.yamlansible/roles/debian_docker_host/tasks/10-docker-Ubuntu.yamlansible/roles/debian_docker_host/defaults/main.yamlansible/inventory/inventory.yamlansible/roles/debian_base/tasks/main.yamlansible/roles/debian_base/tasks/10-apt.yaml
ansible/**/*.{yml,yaml}
📄 CodeRabbit inference engine (AGENTS.md)
Ansible playbooks and roles must pass Ansible linting
Files:
ansible/roles/debian_base/tasks/40-network.yamlansible/roles/debian_docker_host/tasks/10-docker-Debian.yamlansible/roles/debian_base/tasks/70-user.yamlansible/roles/debian_docker_host/tasks/10-docker-Ubuntu.yamlansible/roles/debian_docker_host/defaults/main.yamlansible/inventory/inventory.yamlansible/roles/debian_base/tasks/main.yamlansible/roles/debian_base/tasks/10-apt.yaml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: build-test-push (ubuntu, ubuntu:24.04)
- GitHub Check: build-test-push (debian, debian:trixie-slim)
- GitHub Check: check
🔇 Additional comments (8)
ansible/roles/debian_base/tasks/main.yaml (1)
15-15: LGTM—boolean filter modernization is consistent across debian_base tasks.Line 15 correctly replaces the shorthand
|boolwith the explicit| ansible.builtin.boolfilter, following the PR's pattern to improve Ansible compatibility.ansible/roles/debian_base/tasks/40-network.yaml (1)
8-10: LGTM—boolean filter modernization consistent across debian_base tasks.Line 9 correctly applies the explicit
| ansible.builtin.boolfilter, aligning with the broader PR pattern to improve Ansible compatibility.ansible/roles/debian_base/tasks/10-apt.yaml (1)
41-41: LGTM—boolean filter modernization is consistent.Line 41 correctly applies the explicit
| ansible.builtin.boolfilter, maintaining consistency with the PR's pattern of modernizing filter expressions.ansible/roles/debian_base/tasks/70-user.yaml (1)
18-18: LGTM—boolean filter modernization is consistent.Line 18 correctly applies the explicit
| ansible.builtin.boolfilter, maintaining consistency with the PR's objective to improve Ansible compatibility through explicit filter expressions.ansible/inventory/inventory.yaml (1)
8-14: LGTM—Docker version pinning variables are well-structured.Lines 8–14 correctly define per-host Docker package version pins and a hold flag for the
nashost. The version strings follow Debian package format, and the hold flag aligns with the intent to prevent automatic upgrades on systems with kernel compatibility constraints. Comments clearly explain the rationale.ansible/roles/debian_docker_host/defaults/main.yaml (1)
1-16: LGTM—defaults are well-documented and provide safe starting points.The new defaults file correctly defines four Docker-related variables with clear documentation. The defaults (latest versions, no hold) are appropriate starting points that can be overridden per-host in the inventory, enabling the version pinning and hold capabilities introduced in this PR.
ansible/roles/debian_docker_host/tasks/10-docker-Debian.yaml (1)
27-35: LGTM—version pinning logic is correct andallow_downgradeis appropriate.Lines 27–35 correctly implement conditional version pinning using Jinja2 ternary expressions. Each package name is conditionally suffixed with
=versionwhen the corresponding version variable is not"latest", otherwise the base package name is used. Theallow_downgrade: trueparameter is necessary and correct for supporting downgrade scenarios (e.g., reverting to older Docker versions for kernel compatibility).ansible/roles/debian_docker_host/tasks/10-docker-Ubuntu.yaml (1)
26-34: LGTM—version pinning logic and platform parity are correct.Lines 26–34 correctly mirror the Debian implementation, ensuring consistent behavior across platforms. The conditional version pinning,
allow_downgrade: trueparameter, and overall structure align well with the Debian task file.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Summary by CodeRabbit
New Features
Bug Fixes
Chores