Skip to content

Refactor: Apply code review recommendations (PR1-PR5)#46

Open
never147 wants to merge 6 commits intomainfrom
bulk-review-fixes-pr1-pr5
Open

Refactor: Apply code review recommendations (PR1-PR5)#46
never147 wants to merge 6 commits intomainfrom
bulk-review-fixes-pr1-pr5

Conversation

@never147
Copy link
Copy Markdown
Owner

@never147 never147 commented May 27, 2025

This commit incorporates a series of changes based on a comprehensive code review, addressing obsolete role/OS support, critical bug fixes, updates to ensure latest software versions, and general refactoring/cleanup.

Key changes include:

PR1: Obsolete Roles and OS Support:

  • Removed playbook references to 'chef' and 'grub' roles.
  • Updated 'meta/main.yml' across roles to remove support for Ubuntu Xenial (16.04) and Bionic (18.04).
  • Removed Bionic-specific HWE tasks from 'kernel' role.

PR2: Critical Fixes:

  • 'pandoc' role: Rewrote tasks to correctly fetch/install the latest .deb from GitHub.
  • 'yubikey' role: Fixed PKCS#11 library linking to use dynamic paths, symbolic links, and proper error handling.

PR3: Update to Latest Software Versions:

  • 'golang' role: Updated to install latest 'golang-go', removed GOROOT.
  • 'slack' role: Switched to installing latest .deb from Slack's official site.
  • 'virtualbox' role: Now uses Oracle's APT repository for VirtualBox 7.0.
  • Confirmed 'ansible' and 'docker' roles fetch latest versions.

PR4: Refactor/Cleanup (Part 1):

  • 'chrome': Uses HTTPS for GPG key, removed unused variable.
  • 'dev-toolchain': Integrated Azure/NodeJS tasks, updated OpenJDK to 17, refined Python version list.
  • 'docker': Modernized GPG key setup, removed legacy '/etc/default/docker', added 'docker-compose-plugin'.
  • 'gopass': Improved robustness of GitHub release version detection.
  • 'hid-apple': Removed unused script, simplified tasks by removing outdated conditional logic.

PR5: Refactor/Cleanup (Part 2):

  • 'network': Standardized NetworkManager connectivity check, removed OpenVPN import code.
  • 'oci': Implemented OCI CLI installation using Oracle's script.
  • 'power-save': Refactored to use TLP, removed 'tuned' and redundant tweaks.
  • 'vagrant': Removed legacy commented-out code.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added OCI CLI installation support for Ubuntu systems
    • Introduced Docker Compose plugin to default Docker packages
    • Added Azure CLI and Node.js installation capabilities
  • Chores

    • Dropped support for Ubuntu Xenial and Bionic across all components
    • Removed legacy power-saving configurations and scripts
    • Removed outdated package build automation
  • Bug Fixes

    • Updated package signing protocols to HTTPS
    • Refined package installation workflows for improved security

@never147 never147 force-pushed the bulk-review-fixes-pr1-pr5 branch from 62587ba to dc22c25 Compare June 7, 2025 19:16
@never147 never147 force-pushed the bulk-review-fixes-pr1-pr5 branch 3 times, most recently from 4432d7e to 6216f4d Compare October 24, 2025 18:25
google-labs-jules bot and others added 5 commits October 28, 2025 13:36
This commit incorporates a series of changes based on a comprehensive code review, addressing obsolete role/OS support, critical bug fixes, updates to ensure latest software versions, and general refactoring/cleanup.

Key changes include:

PR1: Obsolete Roles and OS Support:
- Removed playbook references to 'chef' and 'grub' roles.
- Updated 'meta/main.yml' across roles to remove support for Ubuntu Xenial (16.04) and Bionic (18.04).
- Removed Bionic-specific HWE tasks from 'kernel' role.

PR2: Critical Fixes:
- 'pandoc' role: Rewrote tasks to correctly fetch/install the latest .deb from GitHub.
- 'yubikey' role: Fixed PKCS#11 library linking to use dynamic paths, symbolic links, and proper error handling.

PR3: Update to Latest Software Versions:
- 'golang' role: Updated to install latest 'golang-go', removed GOROOT.
- 'slack' role: Switched to installing latest .deb from Slack's official site.
- 'virtualbox' role: Now uses Oracle's APT repository for VirtualBox 7.0.
- Confirmed 'ansible' and 'docker' roles fetch latest versions.

PR4: Refactor/Cleanup (Part 1):
- 'chrome': Uses HTTPS for GPG key, removed unused variable.
- 'dev-toolchain': Integrated Azure/NodeJS tasks, updated OpenJDK to 17, refined Python version list.
- 'docker': Modernized GPG key setup, removed legacy '/etc/default/docker', added 'docker-compose-plugin'.
- 'gopass': Improved robustness of GitHub release version detection.
- 'hid-apple': Removed unused script, simplified tasks by removing outdated conditional logic.

PR5: Refactor/Cleanup (Part 2):
- 'network': Standardized NetworkManager connectivity check, removed OpenVPN import code.
- 'oci': Implemented OCI CLI installation using Oracle's script.
- 'power-save': Refactored to use TLP, removed 'tuned' and redundant tweaks.
- 'vagrant': Removed legacy commented-out code.
Remove conflicting packages
@never147 never147 force-pushed the bulk-review-fixes-pr1-pr5 branch from 6216f4d to 2d6e164 Compare October 28, 2025 13:36
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Nov 4, 2025

Walkthrough

Removed support for older Ubuntu versions (xenial, bionic) across 28+ role metadata files, modernised package repository management by migrating from deprecated apt_key to keyring-based approaches, updated tool versions (Node.js to 22.x, OpenJDK 8 to 17), simplified power-save configurations, and added GitHub Actions workflow permissions.

Changes

Cohort / File(s) Summary
GitHub Actions & Workflow Permissions
.github/workflows/ansible-test.yml
Added top-level permissions block with contents: read and pull-requests: write.
Platform Support Removal (Ubuntu xenial & bionic)
roles/ansible/meta/main.yml, roles/apt/meta/main.yml, roles/backup/meta/main.yml, roles/chrome/meta/main.yml, roles/desktop-apps/meta/main.yml, roles/dev-toolchain/meta/main.yml, roles/docker/meta/main.yml, roles/golang/meta/main.yml, roles/gopass/meta/main.yml, roles/hid-apple/meta/main.yml, roles/jabra/meta/main.yml, roles/kernel/meta/main.yml, roles/network/meta/main.yml, roles/oci/meta/main.yml, roles/pandoc/meta/main.yml, roles/postfix/meta/main.yml, roles/power-save/meta/main.yml, roles/security/meta/main.yml, roles/shorewall/meta/main.yml, roles/slack/meta/main.yml, roles/tempcontrol/meta/main.yml, roles/vagrant/meta/main.yml, roles/virtualbox/meta/main.yml, roles/yubikey/meta/main.yml, roles/zoom/meta/main.yml
Removed xenial and bionic from supported Ubuntu versions; focal and jammy remain as supported versions.
Docker Repository & Key Modernisation
roles/docker/defaults/main.yml, roles/docker/tasks/debian.yml, roles/docker/files/etc_default_docker
Added docker-compose-plugin to packages. Migrated from deprecated apt_key to keyring-based setup with GPG key downloaded to /etc/apt/keyrings/docker.gpg. Removed legacy /etc/default/docker configuration file.
Development Toolchain Updates
roles/dev-toolchain/defaults/main.yml, roles/dev-toolchain/meta/main.yml, roles/dev-toolchain/tasks/debian.yml
Added default node_version: 22.x. Removed Python 3.13 from install list. Replaced OpenJDK 8 with OpenJDK 17. Added includes for Azure CLI and Node.js installation tasks.
Node.js Installation via Nodesource
roles/dev-toolchain/tasks/nodejs.yml
Updated Nodesource GPG key URL to nodesource-repo.gpg.key. Changed repository configuration to use versioned node_{{ node_version }} with nodistro main. Removed inline node_repo variable definition.
Chrome & Security Updates
roles/chrome/tasks/debian.yml, roles/chrome/vars/main.yml
Updated Google GPG key URL to HTTPS. Removed chrome_deb_url variable.
Slack Repository & Key Management
roles/slack/tasks/debian.yml, roles/slack/vars/main.yml
Updated apt key task to use keyring parameter. Renamed and refactored repository setup task. Added slack_keyring and slack_repo variables. Removed slack_deb_url. Changed installation to use slack-desktop via standard apt.
GoPass Version Detection Refactoring
roles/gopass/tasks/debian.yml, roles/gopass/meta/main.yml
Added version initialization and extraction logic from GitHub release URL redirects. Enhanced GitHub URI call with HEAD method and User-Agent headers. Improved version comparison guards and fallback messaging. Fixed typo in task name.
Go Language Installation Simplification
roles/golang/defaults/main.yml, roles/golang/tasks/debian.yml
Removed golang_package_version default (1.22). Simplified installation to use golang-go and golang-doc with state: latest. Removed environment variable management and commented-out installation checks. Updated alternatives paths to generic /usr/lib/go/bin.
HID-Apple Tasks Cleanup
roles/hid-apple/tasks/applespi.yaml, roles/hid-apple/tasks/hwdb.yaml, roles/hid-apple/files/make_facetimehd_package.sh
Removed commented kernel version conditional. Removed version-based evdev and libinput hwdb profile management tasks. Deleted facetimehd package build script entirely.
Kernel Module Management
roles/kernel/tasks/debian.yml
Removed HWE Xorg installation and HWE kernel purge tasks (previously targeting Bionic). Retained inotify sysctl adjustments.
Network Configuration
roles/network/tasks/debian.yml
Removed commented Network Manager OpenVPN task. Updated Network Manager connectivity check configuration with enabled=false content.
OCI CLI Installation
roles/oci/tasks/ubuntu.yml
New file. Adds installation tasks for OCI CLI including dependency setup (python3-pip, python3-venv), script download and execution with appropriate flags, and cleanup.
Pandoc Installation Modernisation
roles/pandoc/tasks/debian.yml
Refactored version detection from HTML parsing to GitHub release URL extraction. Added pandoc_available_version, pandoc_deb_url, pandoc_installed_version variables. Updated install conditions and debug messaging.
Power Save Configuration Removal
roles/power-save/files/70-wifi_powersave.rules, roles/power-save/files/80-pci_pm.rules, roles/power-save/tasks/MacBookPro12,1.yml, roles/power-save/tasks/debian.yml, roles/power-save/tasks/default.yml
Removed Wi-Fi and PCI power-save udev rules. Removed all macOS power-saving configuration tasks. Added TLP repository and installation in Debian tasks. Simplified Debian tasks to retain only USB power-save rule generation.
VirtualBox Repository & Package Updates
roles/virtualbox/tasks/debian.yml
Enabled previously commented apt key task. Changed repository task from disabled to enabled (Oracle VirtualBox repository). Removed debconf license pre-acceptance. Updated package list to virtualbox-7.2 and bridge-utils with state: latest.
Yubikey Library Link Changes
roles/yubikey/tasks/debian.yml
Updated PKCS11 lib symlink from libykcs11.so.1.6.0 to libykcs11.so. Changed both PKCS11 and OpenSC symlink modes from hard to link. Removed failed_when: false guards.
Playbook & Build Script Cleanup
playbooks/linux-desktop.yml, roles/vagrant/tasks/debian.yml
Removed commented-out chef role references. Removed large block of commented-out Vagrant version detection and installation tasks.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Areas requiring extra attention:

  • roles/gopass/tasks/debian.yml — Significant refactoring of version detection logic with new extraction from GitHub redirects, conditional guards, and rescue handling; requires validation of version comparison and install conditions.
  • roles/hid-apple/tasks/hwdb.yaml — Removal of version-based conditional logic for hwdb profiles; verify that simplified flow doesn't break hardware ID handling on supported systems.
  • roles/docker/tasks/debian.yml — Migration from apt_key to keyring-based repository setup; ensure GPG key download, permissions, and signed-by configuration are correct.
  • roles/dev-toolchain/tasks/nodejs.yml — Updated Nodesource repository configuration with versioned node paths; validate repository formatting and Node.js installation from new URL structure.
  • roles/power-save/tasks/* — Extensive removal of power-save configurations (udev rules, modprobe settings); confirm no critical power-management features are inadvertently disabled.

Poem

🐰 Hop through versions, xenial and bionic begone!
Modern keystones replace old apt keys in dawn.
From 8 to 17, the OpenJDK springs,
Node and TLP bring new power to wings.
Simpler rules, cleaner tasks, forward we bound! 🌱

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Refactor: Apply code review recommendations (PR1-PR5)' accurately summarises the main objective of consolidating five review-driven pull requests into a single changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bulk-review-fixes-pr1-pr5

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

@never147
Copy link
Copy Markdown
Owner Author

never147 commented Nov 4, 2025 via email

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Nov 4, 2025

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

@never147, I'll review this pull request for you. Let me fetch the PR details first.


🏁 Script executed:

#!/bin/bash

# Get PR details
echo "=== PR Details ==="
gh pr view 46 --repo never147/ansible-desktop --json title,body,baseRefName,headRefName,files,additions,deletions

echo -e "\n=== Changed Files ==="
gh pr diff 46 --repo never147/ansible-desktop

Length of output: 43846


@never147, I've reviewed PR #46. This is a substantial refactoring effort with excellent cleanup and modernization. Here's my detailed analysis:

🎯 Overview

This PR consolidates 5 separate code review recommendations into one comprehensive update, removing obsolete OS support, fixing critical bugs, updating to latest software versions, and performing general refactoring. Overall, the changes are well-structured and move the codebase in the right direction.

✅ Positive Changes

Security Improvements

  1. Chrome role: Changed to HTTPS for GPG key download (Line 11 in roles/chrome/tasks/debian.yml)
  2. Docker role: Modernized GPG key setup using /etc/apt/keyrings/ directory structure with proper signed-by syntax
  3. Slack role: Uses apt keyring instead of system-wide trusted keys

Modernization

  1. GitHub Actions: Added proper permissions block (read-only by default)
  2. Docker: Added docker-compose-plugin and removed legacy /etc/default/docker configuration
  3. Dev-toolchain: Updated OpenJDK 8 → 17, consolidated Azure CLI and Node.js tasks
  4. Power-save: Refactored to use TLP instead of tuned, cleaner approach
  5. VirtualBox: Now uses Oracle's official APT repository

Code Quality

  1. Removed 69 lines of commented-out code in vagrant role
  2. Removed obsolete scripts and tasks across multiple roles
  3. Improved error handling in gopass and pandoc roles

⚠️ Issues & Concerns

1. VirtualBox Version Mismatch

File: roles/virtualbox/tasks/debian.yml

The PR description mentions VirtualBox 7.0, but the code installs virtualbox-7.2:

- virtualbox-7.2

This might cause issues if 7.2 isn't available in the repository yet. Consider:

  • Verifying 7.2 availability
  • Or changing to virtualbox-7.0 to match the description
  • Or using just virtualbox to get the latest available version

2. Removed VirtualBox Extension Pack

The extension pack and guest additions were removed without explanation:

# Removed:
# - virtualbox-ext-pack
# - virtualbox-guest-additions-iso

These are often needed for USB support and seamless integration. Was this intentional?

3. Node.js Version Hardcoded

File: roles/dev-toolchain/defaults/main.yml

node_version: 22.x

The repository URL changed from versioned (node_18.x) to nodistro, but Node 22 might not be LTS yet. Consider using Node 20 (current LTS) instead.

4. Python Version List

File: roles/dev-toolchain/tasks/debian.yml

Python 3.13 was removed from the list. While it might not be released yet, the comment or reasoning would be helpful for future maintainers.

5. OCI CLI Installation

File: roles/oci/tasks/ubuntu.yml

The creates parameter uses ansible_env.HOME which will be root's home when running with sudo:

creates: "{{ ansible_env.HOME }}/lib/oracle-cli/bin/oci"

This might not work as expected. Consider using a fixed path or checking if the oci command is in PATH.

6. Pandoc Variables

File: roles/pandoc/tasks/debian.yml

The code references undefined variables name and download_page:

- name: "Get latest release information for {{ name }}"
  uri:
    url: "{{ download_page }}"

These should be defined in defaults/main.yml or vars/main.yml.

7. Network Manager Connectivity Check

File: roles/network/tasks/debian.yml

The change adds proper content to disable connectivity:

content: |
  [connectivity]
  enabled=false

This is good, but consider documenting why connectivity checks are disabled (privacy, false positives, etc.).

🔍 Minor Observations

  1. Gopass error handling: The improved error handling is excellent, but the fallback when gopass_available_version is null could be more explicit about what happens (no installation/upgrade).

  2. Yubikey symbolic links: Changed from hard links to symbolic links. This is generally better, and removing failed_when: false means failures will now be caught. Good change!

  3. Power-save refactoring: The removal of device-specific tuning (MacBookPro12,1) suggests a more generic approach with TLP. Ensure TLP provides equivalent power savings.

  4. Workflow permissions: The added permissions are minimal (good security practice), but verify that pull-requests: write is needed for your CI workflow.

📋 Recommendations

  1. Test the VirtualBox changes thoroughly, especially the version and missing extension pack
  2. Verify Node.js 22.x is appropriate for your use case (consider 20.x LTS)
  3. Add the missing pandoc variables (name and download_page)
  4. Fix the OCI CLI installation path detection
  5. Consider adding a CHANGELOG entry given the significant changes
  6. Test on a clean Ubuntu focal/jammy installation to ensure all changes work together

📝 Testing Checklist

  • Verify all roles work on Ubuntu Focal (20.04)
  • Verify all roles work on Ubuntu Jammy (22.04)
  • Test VirtualBox installation and functionality
  • Test Node.js installation with version 22.x
  • Test OCI CLI installation
  • Test Pandoc installation
  • Verify TLP provides adequate power savings

Would you like me to help create issues for any of these concerns, or would you prefer to address them in this PR?

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Caution

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

⚠️ Outside diff range comments (2)
roles/dev-toolchain/tasks/debian.yml (1)

20-25: Add Python 3.13 back to the version list or document the exclusion rationale.

Verification confirms Python 3.13 packages (python3.13, python3.13-dev, python3.13-dbg) are available in the deadsnakes PPA for both focal and jammy distributions. The removal was not due to unavailability. Either re-add Python 3.13 to lines 20–25 if excluded unintentionally, or add an inline comment explaining the intentional exclusion.

roles/chrome/tasks/debian.yml (1)

2-7: Remove commented-out legacy code.

As part of PR4's refactor/cleanup effort, please remove the commented-out conditional logic (lines 2–7) and the commented-out when clause (line 28). These represent dead code that clutters the task file.

Apply this diff to remove the dead code:

----
-#- name: Check if chrome package is already installed
-#  shell: dpkg-query -W -f='${Status}' "{{ chrome_package }}" | grep 'install ok installed'
-#  register: is_installed
-#  failed_when: no
-#  changed_when: no
-#  check_mode: no
-#
 - name: Google package signing key
   apt:
     name: "{{ chrome_package }}"
     state: latest
-#  when: is_installed.rc == 1

Also applies to: 28-28

🧹 Nitpick comments (9)
roles/virtualbox/tasks/debian.yml (1)

2-5: Consider migrating to keyring-based APT key setup for consistency.

The role still uses the deprecated apt_key module. Other roles in this PR (e.g., slack) have migrated to the keyring parameter. Consider aligning this role with the modern keyring-based approach for consistency and future maintainability.

roles/gopass/tasks/debian.yml (1)

40-48: Consider removing return_content: yes when using HEAD method.

The HEAD method does not return a response body; the uri module will still capture the final URL after redirects (which is what the code needs). The return_content: yes parameter is unnecessary in this context and may be confusing to future maintainers.

 - name: Get gopass version information from GitHub
   uri:
     url: "https://github.com/gopasspw/gopass/releases/latest"
-    return_content: yes
     headers:
       User-Agent: "Mozilla/5.0 (X11; Linux x86_64)"
     method: HEAD
roles/pandoc/tasks/debian.yml (2)

11-18: Improve robustness of version extraction from URL.

Line 13 extracts the version by splitting the URL by '/' and taking the last element, then stripping the leading 'v'. Whilst this works for typical GitHub release URLs, it assumes a specific URL structure and provides no fallback if the format is unexpected.

Consider adding explicit handling or validation:

  • Log a warning if the URL is malformed or extraction yields an unexpected result.
  • Consider using a more explicit regex pattern to validate the extracted version (e.g., semantic versioning pattern).

Example improvement:

- name: "Extract available {{ name }} version"
  set_fact:
    pandoc_available_version: "{{ extracted_version }}"
  vars:
    extracted_version: "{{ pandoc_latest_release_info.url.split('/')[-1] | regex_replace('^v', '') if pandoc_latest_release_info.url is defined and pandoc_latest_release_info.url is not none else '' }}"

- name: "Validate extracted version"
  fail:
    msg: "Failed to extract valid {{ name }} version from {{ pandoc_latest_release_info.url }}"
  when: 
    - pandoc_available_version == ""
    - pandoc_latest_release_info.url is defined and pandoc_latest_release_info.url is not none

46-53: Clarify version comparison logic with explicit epoch handling.

Line 53 uses an asymmetric comparison: pandoc_available_version (raw, from GitHub URL) versus pandoc_installed_version | regex_replace('^\\d+:', '') (epoch-stripped, from dpkg). Whilst this likely works correctly in practice (GitHub versions typically lack epochs, whereas dpkg-query output may include them), the asymmetry is implicit and could be easily misunderstood or break if version formats change.

To improve clarity and robustness, consider:

  • Apply epoch stripping to both variables before comparison, or document why asymmetry is intentional.
  • Add a comment explaining the epoch-stripping rationale.

Example improvement:

- name: "Install {{ name }} from upstream deb package"
  apt:
    deb: "{{ pandoc_deb_url }}"
    state: present
  when:
    - pandoc_available_version != ""
    - pandoc_deb_url is defined
    # Strip Debian epoch (e.g. "1:1.2.3-4" → "1.2.3-4") from installed version for comparison with GitHub version
    - pandoc_installed_version == "" or (pandoc_available_version != (pandoc_installed_version | regex_replace('^\\d+:', '')))
roles/oci/tasks/ubuntu.yml (1)

2-7: Inline comments on dependency installation are redundant and could be removed.

The comments explaining why python3-pip and python3-venv are needed restate what is already clear from the package names. Inline comments are best reserved for non-obvious logic or important caveats.

Apply this diff to remove unnecessary comments:

 - name: Ensure dependencies for OCI CLI are present
   apt:
     name:
-      - python3-pip  # pip is often used by the CLI or for updates
-      - python3-venv # Good for isolating CLI dependencies if its installer uses it
+      - python3-pip
+      - python3-venv
     state: present
roles/yubikey/tasks/debian.yml (1)

24-29: Add follow: yes for consistency and verify source path.

The PKCS11 task (line 20) includes follow: yes, but the OpenSC task lacks it. For consistency and to properly handle cases where the source might be a symlink, add follow: yes to the OpenSC task as well. Additionally, verify that the source path exists in the installed opensc package.

Apply this diff to add follow: yes for consistency:

 - name: OpenSC lib link
   file:
     path: /usr/local/lib/opensc-pkcs11.so
     src: /usr/lib/x86_64-linux-gnu/opensc-pkcs11.so
+    follow: yes
     state: link
     force: yes
roles/dev-toolchain/tasks/nodejs.yml (1)

2-3: Consider modernising GPG key handling to align with Ansible best practices.

The apt_key module is deprecated since Ansible 2.4. Per PR4 notes, GPG key setup was modernised for the Docker role. For consistency, consider migrating to the modern approach: download the GPG key with get_url and reference it via apt_repository's keyring parameter, or use signed-by in the repo URL.

This would eliminate the deprecated module and align the entire dev-toolchain role with current Ansible conventions.

Example modern approach:

- name: Download Nodesource GPG key
  get_url:
    url: https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key
    dest: /etc/apt/keyrings/nodesource-repo.gpg.key
    mode: '0644'

- name: Add Nodesource apt repo
  apt_repository:
    repo: "deb [arch=amd64 signed-by=/etc/apt/keyrings/nodesource-repo.gpg.key] https://deb.nodesource.com/node_{{ node_version }} nodistro main"
    state: present
    filename: "nodesource-{{ node_version }}"

Alternatively, if keyring management is handled elsewhere in your setup:

- name: Add Nodesource apt repo
  apt_repository:
    repo: "deb [arch=amd64] https://deb.nodesource.com/node_{{ node_version }} nodistro main"
    state: present
    filename: "nodesource-{{ node_version }}"
    keyring: /etc/apt/keyrings/nodesource-repo.gpg.key
roles/golang/tasks/debian.yml (1)

23-30: Consider adding error handling for alternatives task.

The alternatives task assumes the binary paths exist after package installation. If the paths differ from what golang-go provides, or if the package layout changes, the task will fail silently (depending on Ansible configuration) or halt the playbook.

Consider adding a check or making the alternatives task more defensive:

- name: Update alternatives for go
  alternatives:
    name: "{{ item }}"
    link: "/usr/bin/{{ item }}"
    path: "/usr/lib/go/bin/{{ item }}"
  with_items:
    - go
    - gofmt
  register: alt_result
  failed_when: 
    - alt_result is failed
    - "'does not exist' in alt_result.stderr | default('')"

Alternatively, verify the paths exist before updating alternatives using a stat task.

roles/chrome/tasks/debian.yml (1)

24-35: Consolidate redundant install tasks.

Two separate apt tasks install Chrome (lines 24–28 and 30–35). The first task appears incomplete or disabled (with a commented-out when clause), whilst the second is active and adds additional dependencies. Consolidate into a single task to reduce redundancy and improve clarity.

Apply this diff to consolidate the tasks:

-- name: Install chrome
-  apt:
-    name: "{{ chrome_package }}"
-    state: latest
-#  when: is_installed.rc == 1
-
-- apt:
+- name: Install chrome and dependencies
+  apt:
     name:
       - "{{ chrome_package }}"
       - libnss3
       - libnss3-tools
     state: latest
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 24fd921 and f364fc9.

📒 Files selected for processing (55)
  • .github/workflows/ansible-test.yml (1 hunks)
  • playbooks/linux-desktop.yml (0 hunks)
  • roles/ansible/meta/main.yml (0 hunks)
  • roles/apt/meta/main.yml (0 hunks)
  • roles/backup/meta/main.yml (0 hunks)
  • roles/chrome/meta/main.yml (0 hunks)
  • roles/chrome/tasks/debian.yml (1 hunks)
  • roles/chrome/vars/main.yml (0 hunks)
  • roles/desktop-apps/meta/main.yml (0 hunks)
  • roles/dev-toolchain/defaults/main.yml (1 hunks)
  • roles/dev-toolchain/meta/main.yml (0 hunks)
  • roles/dev-toolchain/tasks/debian.yml (2 hunks)
  • roles/dev-toolchain/tasks/nodejs.yml (1 hunks)
  • roles/docker/defaults/main.yml (1 hunks)
  • roles/docker/files/etc_default_docker (0 hunks)
  • roles/docker/meta/main.yml (0 hunks)
  • roles/docker/tasks/debian.yml (1 hunks)
  • roles/golang/defaults/main.yml (0 hunks)
  • roles/golang/meta/main.yml (0 hunks)
  • roles/golang/tasks/debian.yml (1 hunks)
  • roles/gopass/meta/main.yml (0 hunks)
  • roles/gopass/tasks/debian.yml (3 hunks)
  • roles/hid-apple/files/make_facetimehd_package.sh (0 hunks)
  • roles/hid-apple/meta/main.yml (0 hunks)
  • roles/hid-apple/tasks/applespi.yaml (0 hunks)
  • roles/hid-apple/tasks/hwdb.yaml (0 hunks)
  • roles/jabra/meta/main.yml (0 hunks)
  • roles/kernel/meta/main.yml (0 hunks)
  • roles/kernel/tasks/debian.yml (0 hunks)
  • roles/network/meta/main.yml (0 hunks)
  • roles/network/tasks/debian.yml (1 hunks)
  • roles/oci/meta/main.yml (0 hunks)
  • roles/oci/tasks/ubuntu.yml (1 hunks)
  • roles/pandoc/meta/main.yml (0 hunks)
  • roles/pandoc/tasks/debian.yml (1 hunks)
  • roles/postfix/meta/main.yml (0 hunks)
  • roles/power-save/files/70-wifi_powersave.rules (0 hunks)
  • roles/power-save/files/80-pci_pm.rules (0 hunks)
  • roles/power-save/meta/main.yml (0 hunks)
  • roles/power-save/tasks/MacBookPro12,1.yml (0 hunks)
  • roles/power-save/tasks/debian.yml (1 hunks)
  • roles/power-save/tasks/default.yml (1 hunks)
  • roles/security/meta/main.yml (0 hunks)
  • roles/shorewall/meta/main.yml (0 hunks)
  • roles/slack/meta/main.yml (0 hunks)
  • roles/slack/tasks/debian.yml (1 hunks)
  • roles/slack/vars/main.yml (1 hunks)
  • roles/tempcontrol/meta/main.yml (0 hunks)
  • roles/vagrant/meta/main.yml (0 hunks)
  • roles/vagrant/tasks/debian.yml (0 hunks)
  • roles/virtualbox/meta/main.yml (0 hunks)
  • roles/virtualbox/tasks/debian.yml (1 hunks)
  • roles/yubikey/meta/main.yml (0 hunks)
  • roles/yubikey/tasks/debian.yml (1 hunks)
  • roles/zoom/meta/main.yml (0 hunks)
💤 Files with no reviewable changes (37)
  • roles/power-save/files/80-pci_pm.rules
  • roles/hid-apple/tasks/hwdb.yaml
  • roles/chrome/vars/main.yml
  • roles/yubikey/meta/main.yml
  • roles/chrome/meta/main.yml
  • roles/ansible/meta/main.yml
  • roles/hid-apple/tasks/applespi.yaml
  • roles/desktop-apps/meta/main.yml
  • roles/shorewall/meta/main.yml
  • roles/backup/meta/main.yml
  • roles/virtualbox/meta/main.yml
  • roles/docker/meta/main.yml
  • roles/pandoc/meta/main.yml
  • roles/golang/meta/main.yml
  • roles/dev-toolchain/meta/main.yml
  • roles/hid-apple/meta/main.yml
  • roles/power-save/tasks/MacBookPro12,1.yml
  • roles/docker/files/etc_default_docker
  • roles/vagrant/meta/main.yml
  • roles/tempcontrol/meta/main.yml
  • roles/vagrant/tasks/debian.yml
  • roles/power-save/files/70-wifi_powersave.rules
  • roles/oci/meta/main.yml
  • roles/power-save/meta/main.yml
  • roles/jabra/meta/main.yml
  • roles/slack/meta/main.yml
  • roles/golang/defaults/main.yml
  • roles/hid-apple/files/make_facetimehd_package.sh
  • roles/security/meta/main.yml
  • roles/gopass/meta/main.yml
  • roles/zoom/meta/main.yml
  • roles/postfix/meta/main.yml
  • roles/kernel/tasks/debian.yml
  • roles/network/meta/main.yml
  • playbooks/linux-desktop.yml
  • roles/kernel/meta/main.yml
  • roles/apt/meta/main.yml
🧰 Additional context used
🪛 Checkov (3.2.334)
roles/pandoc/tasks/debian.yml

[medium] 2-12: Ensure that HTTPS url is used with uri

(CKV2_ANSIBLE_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)
  • GitHub Check: run-lint
  • GitHub Check: build
🔇 Additional comments (24)
roles/network/tasks/debian.yml (1)

8-13: LGTM — NetworkManager connectivity check configuration is sound.

The content block correctly disables NetworkManager's automatic connectivity check, and the YAML structure is syntactically valid. Removal of the commented OpenVPN import code aligns with the cleanup objectives.

.github/workflows/ansible-test.yml (1)

2-4: LGTM — workflow permissions follow least-privilege best practices.

The permissions block correctly restricts scopes to: read contents (for checkout) and write pull-requests (for posting status/comments). However, verify whether pull-requests: write is actually utilised by steps in this workflow.

roles/virtualbox/tasks/debian.yml (2)

2-5: Verify VirtualBox version alignment and extension pack removal intent.

The code specifies virtualbox-7.2, but the PR objectives document references VirtualBox 7.0. Additionally, virtualbox-ext-pack has been removed. Please confirm:

  1. Is version 7.2 the intended target (not 7.0)?
  2. Was the extension pack removal intentional (e.g., security/licensing concern) or an oversight?

Also applies to: 7-11


13-18: Simplified package list is correct; state: latest allows patch updates within 7.2.x.

The removal of auxiliary packages (virtualbox-qt, guest-additions-iso) and the focus on virtualbox-7.2 + bridge-utils is aligned with the modernisation objectives, provided the version and extension pack removal are intentional.

roles/slack/vars/main.yml (1)

5-6: LGTM — variables are well-named and correctly structured.

The introduction of slack_keyring (follows Linux APT keyring conventions) and slack_repo (uses official Slack packagecloud source) enables a cleaner, modernised apt-based installation flow. Removal of slack_deb_url aligns with the shift to repository-based management.

roles/slack/tasks/debian.yml (3)

3-6: LGTM — apt key configuration correctly modernised with keyring approach.

The removal of URL quotes and addition of the keyring parameter (sourced from slack_keyring) follows current APT best practices and aligns with the PR's modernisation objectives.


8-11: Verify Debian jessie codename is intentional for this repository.

The task hardcodes jessie as the Debian distribution codename. Given that the PR removes Ubuntu xenial/bionic support and targets Focal/Jammy (18.04+), please confirm:

  1. Is jessie intentional for broader Debian 8 compatibility (now EOL)?
  2. Should this be dynamic (e.g., {{ ansible_distribution_release }}) or use a default Ubuntu-compatible value?

13-16: LGTM — Slack installation task is properly simplified.

The condensed apt installation task with name: slack-desktop is correct. Omitting state (defaults to present) is appropriate since the repository refresh handles version updates through apt_repository.

roles/gopass/tasks/debian.yml (2)

50-66: Version extraction logic with defensive error handling — well structured.

Initialising gopass_available_version to null and using a separate extraction block with rescue handling is sound defensive programming. The when condition correctly validates the URL structure before extraction, and the rescue block ensures graceful fallback to apt if extraction fails.


87-90: Installation condition is logically sound.

The when condition correctly handles three cases: (1) no version detected (falls back to apt via negation), (2) package not installed, and (3) newer version available. The explicit empty-string guard (gopass_available_version != "") is redundant with the first check but aligns with the PR objective of improving robustness.

roles/pandoc/tasks/debian.yml (1)

2-9: ****

The download_page variable is already defined with an HTTPS URL. In roles/pandoc/vars/main.yml, line 4 defines: download_page: https://github.com/jgm/pandoc/releases/latest. No HTTPS enforcement action is required; the code already uses a secure endpoint. The original review comment's concern is unfounded.

Likely an incorrect or invalid review comment.

roles/oci/tasks/ubuntu.yml (1)

16-21: Based on my verification, I found key details about the OCI CLI installation path and Ansible environment variable handling:

The OCI CLI installer uses $HOME/lib/oracle-cli by default for the library and $HOME/bin for the executable, which aligns with the path specified in the Ansible code.

However, regarding ansible_env.HOME reliability: The lookup method retrieves local server environment variable details, whilst ansible_env retrieves remote server environment variable details. Additionally, when using sudo: yes with Ansible, {{ ansible_env.HOME }} becomes root's home.


ansible_env.HOME may be undefined or incorrect in certain execution contexts.

The creates parameter assumes ansible_env.HOME is populated and accurate. This variable depends on Ansible's fact gathering and may fail or return unexpected values when:

  • Running with gather_facts: false
  • Executing via become without proper user context handling
  • Using non-standard execution modes (e.g., local connection without setup module)

The OCI CLI installer does use $HOME/lib/oracle-cli/bin/oci as the default path (confirmed), but relying solely on ansible_env.HOME to verify idempotence is fragile. Consider using a more explicit check such as testing for the binary in the system PATH or verifying the installation via a dedicated fact-gathering task.

roles/power-save/tasks/debian.yml (2)

28-33: Installation of both tlp and tlp-rdw is appropriate.

Including both packages ensures Runtime PM (ALPM) support via tlp-rdw, which complements the core TLP daemon.


23-26: The original review comment is incorrect — codename is a valid apt_repository parameter.

The apt_repository module supports a codename parameter (added in Ansible 2.3), which overrides the distribution codename to use for PPA repositories. The code in roles/power-save/tasks/debian.yml lines 23–26 is valid and follows an established pattern used throughout the codebase (in roles such as golang, ansible, desktop-apps, and dev-toolchain).

The os_codename variable is referenced across multiple roles in the project, indicating it is properly defined at the playbook level or via standard Ansible variable sources (group_vars, host_vars, or role defaults).

No issues require remediation.

Likely an incorrect or invalid review comment.

roles/docker/defaults/main.yml (1)

3-7: Good modernisation with docker-compose-plugin.

Adding docker-compose-plugin is the correct approach; it replaces the deprecated standalone docker-compose tool and integrates directly with Docker CE.

roles/docker/tasks/debian.yml (3)

2-6: Good: keyring directory creation with proper permissions.

The directory creation is correct and follows modern Debian/Ubuntu GPG key management practices. The mode '0755' is appropriate for the keyrings directory.


8-13: GPG key download is modern and secure.

Using get_url to fetch the Docker GPG key into the keyrings directory is correct. The force: true flag ensures the key remains current, which is important for security.


21-24: Confirm state: latest aligns with playbook strategy.

Line 24 uses state: latest on the apt task. While acceptable for a desktop-focused playbook where uptime and versioning are less critical, this approach can introduce unexpected updates. Confirm this is intentional and aligned with the playbook's version management strategy.

If this is deliberate, consider adding a comment explaining the rationale. If stricter version control is needed elsewhere in the playbook, consider standardising on state: present with specific version pinning where appropriate.

roles/power-save/tasks/default.yml (1)

2-2: TLP installation confirmed; integration is sound.

TLP and tlp-rdw are properly installed in debian.yml, and the explicit USB udev rules coexist intentionally—TLP manages system-wide power policies whilst the 50-usb_power_save.rules template provides per-device control. The comment on line 2 accurately reflects this design.

The significant reduction in functionality (WiFi, PCI, sound power management) is intentional per the PR objectives and consolidates power management onto TLP as the primary mechanism.

roles/yubikey/tasks/debian.yml (1)

16-22: Both source paths are correctly provided by Debian packages; however, flag the missing follow: yes parameter in the OpenSC task.

The Debian opensc-pkcs11 package provides /usr/lib/x86_64-linux-gnu/opensc-pkcs11.so across all releases (buster, bullseye, bookworm, sid), confirming the OpenSC source path is valid. Similarly, earlier verification confirmed the ykcs11 package provides the unversioned libykcs11.so path.

The refactor to symbolic links (state: link) is correct, and removing failed_when: false is appropriate since both source paths are guaranteed by the respective packages.

However, the PKCS11 task includes follow: yes whilst the OpenSC task omits it. Both tasks are logically similar, so this inconsistency should be resolved by either adding follow: yes to the OpenSC task or removing it from the PKCS11 task, depending on your intended symlink handling behaviour.

roles/dev-toolchain/defaults/main.yml (1)

1-1: Clean variable declaration.

The new node_version default is properly defined and wired into the Node.js installation tasks. No concerns.

roles/dev-toolchain/tasks/debian.yml (2)

83-89: Task inclusions are properly ordered.

The new Azure CLI and Node.js installation tasks are appended after the GitHub CLI task, which is sensible. No dependency issues detected between these newly added tasks.


47-47: I need to verify OpenJDK 17 package availability and also check the Python 3.13 concern. Let me search for this information and check for additional configuration files.

Now let me search the codebase for any focal/jammy version constraints and check for source code or CI configuration files that might enforce Java 8.

Based on my verification:

OpenJDK 17 is available and appropriate for both target distributions.

OpenJDK 17 is available in Ubuntu focal (20.04) in version 17.0.15+6us1-0ubuntu120.04, and openjdk-17-jdk is available in jammy (22.04 LTS) and jammy-updates. The codebase contains no hardcoded Java 8 assumptions (the first script search produced no matches), Maven is present in the packages list and is compatible with Java 17, and OpenJDK 17 packages provide java8-sdk virtual package compatibility.

Regarding the Python 3.13 removal in the original diff: Python 3.13 is available in the deadsnakes PPA for jammy but is not provided by upstream Ubuntu. Since the playbook does not configure deadsnakes, removing Python 3.13 from the standard package list is the correct approach.

roles/dev-toolchain/tasks/nodejs.yml (1)

7-9: Versioning and repository configuration is sound.

The migration to use the node_version variable throughout the repository URL and filename is correct and enables flexible Node.js version selection. The GPG key URL update to nodesource-repo.gpg.key is appropriate.

Comment on lines 10 to +11
apt_key:
url: http://dl-ssl.google.com/linux/linux_signing_key.pub
url: https://dl-ssl.google.com/linux/linux_signing_key.pub
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Modernise to keyring-based GPG key management (inconsistent with PR objectives).

The PR objectives state that modernisation includes "migrating from deprecated apt_key to keyring-based approaches". However, this file still uses the deprecated apt_key module. Whilst the URL was updated to HTTPS (good), the underlying approach remains outdated. For consistency with the PR's modernisation goals, please migrate to a keyring-based approach using ansible.builtin.get_url and apt_repository with the signed_by parameter, or use ansible.builtin.deb822_repository if targeting newer Debian/Ubuntu versions.

Apply this diff to modernise the GPG key setup:

- name: Google package signing key
-  apt_key:
-    url: https://dl-ssl.google.com/linux/linux_signing_key.pub
+- name: Add Google package signing key
+  ansible.builtin.get_url:
+    url: https://dl-ssl.google.com/linux/linux_signing_key.pub
+    dest: /usr/share/keyrings/google-linux-signing-key.gpg
+    mode: '0644'

 - name: Google package repo
   apt_repository:
     repo: "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main"
     filename: google-chrome
+    signed_by: /usr/share/keyrings/google-linux-signing-key.gpg

I'll gather information to verify the technical claims in this review comment.





---

🌐 Web query:

```web
Ansible apt_key module deprecated

💡 Result:

Short answer: Yes — the apt_key module relies on the apt-key workflow (which Debian/Ubuntu deprecated) and is effectively deprecated for modern usage. Ansible keeps apt_key for backward compatibility, but you should stop using apt-key and instead place repository keys in keyring files and reference them with signed-by (or use deb822_repository). See Ansible docs and porting guidance for details. (docs.ansible.com)

Recommended migrations:

  • Download the repo key into a keyring file (e.g. /etc/apt/keyrings/myrepo.gpg or .asc) using get_url or a dearmor step, then add the repo with signed-by=/etc/apt/keyrings/myrepo.gpg. (jeffgeerling.com)
  • Or use ansible.builtin.deb822_repository (or add a deb822-formatted file) instead of apt_repository + apt_key. (docs.ansible.com)

Note: Ansible removed the ineffective apt_key 'key' parameter and flagged related behavior for removal in ansible-core 2.14 — update playbooks accordingly. (docs.ansible.com)

If you want, I can show a minimal Ansible task example that replaces apt_key with the recommended pattern.

Citations:


🌐 Web query:

Ansible apt_repository signed_by parameter

💡 Result:

Short answer

  • For Ansible's apt-style modules use the deb822_repository (preferred) or apt_repository; the signed_by parameter (or signed-by in a repo string) tells APT which key(s) to use for that repository. It may be:
    • an absolute path to a key/keyring file (e.g. /usr/share/keyrings/foo.gpg or /etc/apt/keyrings/foo.gpg),
    • a URL (many roles/modules will download the key and store it under /etc/apt/keyrings/),
    • or one or more key fingerprints/IDs that select keys from an existing keyring. [1][2][3]

Key notes

  • When you give a URL most tooling stores the downloaded key under /etc/apt/keyrings (or /usr/share/keyrings) and writes Signed-By into the .sources/.list entry. [1][3]
  • APT’s Signed-By expects absolute paths (and the file must be readable by the apt system user). Using Signed-By scopes trust to that key instead of the global trusted keyring. [2]
  • You can also embed signed-by in the repo string passed to apt_repository, e.g. deb [signed-by=/usr/share/keyrings/foo.gpg] https://repo.example/ stable main. [1][2]

Examples

  • deb822_repository (Ansible):
    • name: add repo
      ansible.builtin.deb822_repository:
      name: example
      types: deb
      uris: https://repo.example
      suites: stable
      components: main
      signed_by: /etc/apt/keyrings/example.gpg
  • apt_repository (repo string):
    repo: "deb [signed-by=/usr/share/keyrings/example.gpg] https://repo.example stable main"
    (ensure the key file exists and is world-/apt-readable). [1][2][3]

Sources
[1] Ansible deb822_repository module docs. [turn1search6]
[2] Debian sources.list(5) / apt Signed-By explanation. [turn0search5]
[3] DebOps / examples for signed_by handling (URLs, key storage). [turn1search0]


🌐 Web query:

Ansible deb822_repository module documentation

💡 Result:

You can find the official documentation for the Ansible deb822_repository module (usage, parameters, examples, return values) on the Ansible docs site and in the Ansible Core docs:

  • Official Ansible docs (ansible.builtin.deb822_repository). See parameters, examples, and notes. [1]
  • Ansible Core / devel docs (module added in ansible-core 2.15; includes install_python_debian info). [2]

If you want, I can paste the synopsis, parameter list, or an example playbook from the docs.



---

🌐 Web query:

```web
Ansible apt_repository signed_by parameter syntax

💡 Result:

Short answer — two forms:

  1. apt_repository (one-line sources): include signed-by inside the repo string’s bracketed options:
  • repo: "deb [arch=amd64 signed-by=/etc/apt/keyrings/myrepo.gpg] https://repo.example/ ubuntu focal main". [1]
  1. deb822_repository / .sources format: use the signed_by parameter which accepts a URL (will be stored under /etc/apt/keyrings/), an absolute keyring path, or key fingerprints:

References:

  • apt_repository module docs. [1]
  • deb822_repository module docs (signed_by semantics). [2]

Correct the apt_repository syntax in suggested diff—signed_by must be embedded within repo string.

The review comment's core concern is valid: the apt_key module relies on the apt-key workflow (which Debian/Ubuntu deprecated) and is effectively deprecated for modern usage. However, the suggested diff contains a critical syntax error.

For apt_repository, signed_by must be included inside the repo string's bracketed options, not as a separate parameter. The corrected diff should be:

- name: Add Google package signing key
  ansible.builtin.get_url:
    url: https://dl-ssl.google.com/linux/linux_signing_key.pub
    dest: /etc/apt/keyrings/google-linux-signing-key.asc
    mode: '0644'

- name: Google package repo
  apt_repository:
-   repo: "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main"
+   repo: "deb [arch=amd64 signed-by=/etc/apt/keyrings/google-linux-signing-key.asc] https://dl.google.com/linux/chrome/deb/ stable main"
    filename: google-chrome

Note: Google's GPG key is ASCII-armoured and should use .asc extension; if binary format is required, add a dearmor step. Use /etc/apt/keyrings/ as the standard location for custom repository keys.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In roles/chrome/tasks/debian.yml around lines 10-11, the current use of apt_key
and the suggested apt_repository change are incorrect: apt_key is deprecated and
apt_repository requires the signed_by option inside the repository string
bracketed options. Replace the apt_key usage by downloading Google's
ASCII-armoured key (.asc) into /etc/apt/keyrings (dearmor into .gpg if you need
a binary key), ensure the key file is created with correct permissions, and
define apt_repository with the repository URL and the signed_by option embedded
inside the repo string brackets (e.g.
[signed-by=/etc/apt/keyrings/google-archive-keyring.gpg] <repo>), removing any
separate signed_by parameter and using the key path under /etc/apt/keyrings.

Comment on lines 15 to 19
- name: Add docker apt repo
apt_repository:
repo: "deb [arch=amd64] https://download.docker.com/linux/{{ os_distro|lower }} {{ os_codename }} stable"
apt_repository:
repo: "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/{{ os_distro|lower }} {{ os_codename }} stable"
state: present
filename: docker
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify architecture assumption.

Line 17 hardcodes arch=amd64 in the repository URL. This will limit deployment to amd64-only systems and will fail silently or produce errors on arm64, ppc64le, or other architectures. Confirm whether this is intentional:

  • If amd64-only: document this limitation clearly.
  • If supporting multiple architectures: use {{ ansible_machine_arch }} fact instead.

To verify architecture support, please check the role's meta/main.yml:


🏁 Script executed:

#!/bin/bash
# Description: Verify architecture support declared in Docker role metadata.

# Check if meta/main.yml declares architecture restrictions
if [ -f roles/docker/meta/main.yml ]; then
  grep -i "arch" roles/docker/meta/main.yml || echo "No architecture restrictions found in meta/main.yml"
else
  echo "roles/docker/meta/main.yml not found"
fi

# Also check if other roles in this PR have similar patterns
echo -e "\n--- Checking other roles for architecture patterns ---"
rg -n "arch=" roles/*/tasks/*.yml | head -20

Length of output: 1298


Searching for documentation on architecture support in the codebase:

I need to check for documentation about architecture support in this playbook:

Based on the verification, the original review comment is valid and critical. The investigation reveals this is not a localised issue with the Docker role but a systematic limitation affecting all 9 roles that specify apt repositories. The mapping pattern for Debian packages is established: 'amd64' if ansible_architecture == 'x86_64' else ansible_architecture, and Docker officially supports multiple architectures including amd64, arm32v5, arm32v6, arm32v7, arm64v8, i386, ppc64le, and s390x. The playbook currently lacks any mechanism to support these alternative architectures.

Update the apt repository architecture specification to support multiple architectures.

The hardcoded arch=amd64 across all roles (Docker, VirtualBox, Vagrant, Node.js, GitHub CLI, Azure CLI, Chrome) will fail on arm64, ppc64le, or other non-amd64 systems. This is a systematic issue, not limited to the Docker role alone.

Recommended actions:

  • Define an architecture translation variable in a common location (e.g., group_vars or role defaults) using the mapping pattern: {{ 'amd64' if ansible_architecture == 'x86_64' else ansible_architecture }}
  • Update all 9 roles to use this variable instead of hardcoded arch=amd64
  • If amd64-only deployment is intentional, document this clearly in the playbook's README or role metadata
🤖 Prompt for AI Agents
In roles/docker/tasks/debian.yml around lines 15 to 19, the apt_repository is
hardcoding arch=amd64 which breaks non-amd64 systems; replace this by using a
shared architecture translation variable (e.g., define in group_vars/all or role
defaults: arch_map = "{{ 'amd64' if ansible_architecture == 'x86_64' else
ansible_architecture }}") and update the repo line to use that variable for the
signed-by arch value; apply the same change across the other 8 roles that set
apt repos (VirtualBox, Vagrant, Node.js, GitHub CLI, Azure CLI, Chrome, etc.),
or if you intend to support only amd64, document that constraint clearly in the
playbook README/role metadata instead of hardcoding the arch.

Comment on lines +16 to 21
- name: "Install latest Go packages"
apt:
#name: "{{ golang_package }}={{ golang_package_version }}"
name:
- "{{ golang_package }}-{{ golang_package_version }}-go"
- "{{ golang_package }}-{{ golang_package_version }}-doc"
name:
- "golang-go"
- "golang-doc"
state: latest
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify alternatives path matches golang-go package layout.

The task installs latest golang-go and golang-doc packages, which aligns with PR3's goal to track the latest stable version. However, line 27 assumes binaries are located at /usr/lib/go/bin/{{ item }}. This path must match where the system's golang-go package actually places the Go binaries.

Please verify that the golang-go package from the Debian/Ubuntu repository places binaries at /usr/lib/go/bin/go and /usr/lib/go/bin/gofmt:


🏁 Script executed:

#!/bin/bash
# Description: Verify Go binary locations in the golang-go package

# Check which command resolves to the package-provided Go
which go gofmt

# Check the actual binary paths
dpkg -L golang-go | grep -E 'bin/(go|gofmt)$'

# Verify the alternatives configuration will succeed
ls -la /usr/lib/go/bin/go /usr/lib/go/bin/gofmt 2>&1 || echo "Paths not found"

Length of output: 237


Alternatives path is incorrect and will fail on both supported distributions.

The golang-1.N-go package installs binaries under /usr/lib/go-1.N/bin, not /usr/lib/go/bin/. On jammy, golang-go depends on golang-1.18-go, meaning binaries are placed at /usr/lib/go-1.18/bin/go and /usr/lib/go-1.18/bin/gofmt. The alternatives task on line 27 uses /usr/lib/go/bin/{{ item }}, which does not exist and will cause the task to fail.

Options to fix:

  1. Use the version-specific path (e.g., /usr/lib/go-1.18/bin/), but this assumes a specific Go version and hardcodes it into the task.
  2. Verify whether the golang-go metapackage creates symlinks under /usr/bin and use those directly instead of the alternatives mechanism.
  3. Document which Go version is expected for each supported distribution and adjust the alternatives path accordingly.

Comment on lines +10 to +13
get_url:
url: https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh
dest: /tmp/oci_install.sh
mode: '0755'
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Download executable script without integrity verification poses security and reliability risks.

Downloading a shell script from GitHub and immediately executing it without verifying its integrity introduces:

  1. Security risk: No protection against man-in-the-middle attacks or repository compromise
  2. Integrity risk: Script content could be corrupted or modified without detection
  3. Reliability risk: Using the master branch as a reference is unstable; releases may contain breaking changes

Consider:

  • Pinning to a specific release version instead of master
  • Adding checksum verification (if the project publishes checksums)
  • Using a dedicated Ansible module for OCI CLI (if available) rather than executing arbitrary scripts

To assess this concern, check whether Oracle publishes checksums for the OCI CLI installer or provides alternative installation methods:


🌐 Web query:

Oracle OCI CLI installation documentation and security best practices

💡 Result:

Here are official Oracle resources and concise installation + security best-practice pointers for the OCI CLI.

Official docs

  • OCI CLI Quickstart / installation (install script, OS packages, Homebrew, PowerShell, Cloud Shell). [1]
  • Manual / offline / pip / virtualenv installation and offline install steps. [2]
  • OCI security guidance and service-specific security best practices (recommendations such as limiting credential exposure, using Vault, least privilege, etc.). [3][4]

Quick installation options (summary)

  • One-line install script (Linux/macOS): bash -c "$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)". See Quickstart for flags (--accept-all-defaults, --offline-install). [1][2]
  • OS packages: dnf/yum (Oracle Linux/CentOS), Homebrew on macOS, PowerShell installer on Windows. [1][7]
  • pip / virtualenv: pip install oci-cli (recommended to use a Python venv for isolation). [2]
  • Cloud Shell: pre-configured CLI available in OCI Cloud Shell (no local install needed). [3]

Essential post‑install configuration

  • Run oci setup config to create a profile, generate/add API signing key pair (or upload your own), and populate tenancy/compartment/user/region in ~/.oci/config. Use the CLI help and docs for per-profile configuration and switching. [1][3]

Security best practices (concise checklist)

  • Use least-privilege IAM policies and separate compartments for isolation; grant only required actions to users/groups. [3]
  • Avoid embedding long‑lived credentials in code; store secrets in OCI Vault and retrieve them at runtime. [4]
  • Prefer instance principals / dynamic credentials where possible (avoid long-lived user API keys for compute instances). (See OCI auth concepts and service best practices.) [3][4]
  • Rotate API keys/credentials regularly and remove unused keys. [3][4]
  • Use MFA for console users and secure the machine where CLI runs (keep OS/CLI updated; use virtualenv or container installs to isolate). [3][5]
  • Use network controls (VCN, security lists/NSGs) and limit public exposure of management endpoints. [4]
  • For automation, use dedicated service accounts or groups with scoped policies and short-lived tokens; log and monitor CLI/API activity with Audit and Logging. [3][4]

Where to read details (open these pages)

  1. OCI CLI installation / Quickstart — Oracle docs. [1]
  2. Manual & offline installation / pip / virtualenv — Oracle docs. [2]
  3. OCI Command Line concepts & configuration (including setup config) — Oracle docs. [3]
  4. OCI Security best practices (Vault, least privilege, limiting credential exposure, logging) — Oracle docs. [4]

If you want, I can:

  • give exact install commands for your OS (macOS, Linux distro, or Windows), or
  • produce a short secure CI/CD pattern using instance principals + Vault and example IAM policies.

Consider pinning OCI CLI installation to a specific release and using alternative installation methods where feasible.

The current approach downloads and executes a script from the master branch without integrity verification. While this is Oracle's documented installation method, the concern is valid:

  • Oracle provides multiple installation methods: OS packages (dnf/yum, Homebrew, PowerShell), pip/virtualenv, and Cloud Shell
  • The web search confirms no checksums are published for the installer script
  • Using master branch introduces volatility compared to versioned releases

Recommended actions:

  • Use OS packages (dnf/yum on Oracle Linux/CentOS, or Homebrew on macOS) where available for the target system
  • Alternatively, install via pip in a Python virtualenv for isolation
  • If the shell script is necessary, pin to a specific release tag instead of master

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.

2 participants