Skip to content

Comments

fix: install __hpc_base_packages early via dedicated task#83

Open
ggoklani wants to merge 1 commit intolinux-system-roles:mainfrom
ggoklani:install_pssh
Open

fix: install __hpc_base_packages early via dedicated task#83
ggoklani wants to merge 1 commit intolinux-system-roles:mainfrom
ggoklani:install_pssh

Conversation

@ggoklani
Copy link
Collaborator

@ggoklani ggoklani commented Feb 18, 2026

Enhancement: Add a new top-level "Install base packages" task to ensure the role’s baseline packages (defined in __hpc_base_packages) are installed consistently and independently of optional feature blocks such as Moneo.

The task is placed immediately after repository configuration so required repos are available before package installation, and it uses the same OSTree-safe package backend selection pattern used elsewhere in the role.

this change only introduces a common baseline package installation step.

Reason: 'pssh required to configure moneo'

Result: TASK [linux-system-roles.hpc : Install base packages] **************************
changed: [localhost] => {"attempts": 1, "changed": true, "msg": "", "rc": 0, "results": ["Installed: pssh-2.3.4-1.el9.noarch"]}

Issue Tracker Tickets (Jira or BZ if any): https://issues.redhat.com/browse/RHELHPC-166

Summary by Sourcery

Add a dedicated task to install baseline HPC packages immediately after repository configuration to ensure required utilities are always present.

New Features:

  • Introduce a top-level base package installation step that runs independently of optional feature blocks.

Enhancements:

  • Define and use a reusable __hpc_base_packages variable currently including pssh to standardize baseline package installation across the role.

@sourcery-ai
Copy link

sourcery-ai bot commented Feb 18, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Introduces a dedicated, early "Install base packages" task in the main role flow that installs a new __hpc_base_packages list (currently just pssh) using the existing OSTree-aware package backend pattern, ensuring baseline packages are present independent of optional feature blocks like Moneo.

Class diagram for __hpc_base_packages variable

classDiagram
  class HPCVars {
    list~string~ __hpc_base_packages
  }

  class BasePackageList {
    +string pssh
  }

  HPCVars "1" --> "1" BasePackageList : defines
Loading

Flow diagram for early base package installation task

flowchart TD
  A[Role start] --> B[Configure repositories
__hpc_nvidia_cuda_repo
__hpc_microsoft_prod_repo]
  B --> C[Install base packages
package name __hpc_base_packages
state present
use ostree aware backend]
  C --> D[Install optional components
such as Moneo]
  C --> E[Continue remaining role tasks]
Loading

File-Level Changes

Change Details Files
Add a top-level base package installation task that runs immediately after repository configuration using the OSTree-safe package module pattern with retry logic.
  • Insert an "Install base packages" task in the main task list right after repository setup to install __hpc_base_packages with state=present.
  • Use the same conditional use parameter to select ansible.posix.rhel_rpm_ostree when on OSTree systems, otherwise omit it.
  • Register the installation result in __hpc_base_packages_install and wrap the task with an until loop that retries until the installation succeeds.
tasks/main.yml
Define the baseline package list for the role so it can be installed consistently via the new task.
  • Introduce a new __hpc_base_packages variable intended to hold baseline packages for the role.
  • Seed __hpc_base_packages with pssh to satisfy Moneo configuration requirements.
vars/main.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • The Install base packages task uses an until: ... is success loop but does not configure retries/delay, so the loop has no practical effect; either add explicit retry settings or drop the until for clarity.
  • Consider guarding the Install base packages task with a condition that __hpc_base_packages is defined and non-empty (e.g. when: __hpc_base_packages | default([]) | length > 0) to make the intent explicit and avoid running a no-op task if the list is empty in other contexts.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `Install base packages` task uses an `until: ... is success` loop but does not configure `retries`/`delay`, so the loop has no practical effect; either add explicit retry settings or drop the `until` for clarity.
- Consider guarding the `Install base packages` task with a condition that `__hpc_base_packages` is defined and non-empty (e.g. `when: __hpc_base_packages | default([]) | length > 0`) to make the intent explicit and avoid running a no-op task if the list is empty in other contexts.

## Individual Comments

### Comment 1
<location> `tasks/main.yml:74-81` </location>
<code_context>
     - "{{ __hpc_nvidia_cuda_repo }}"
     - "{{ __hpc_microsoft_prod_repo }}"

+- name: Install base packages
+  package:
+    name: "{{ __hpc_base_packages }}"
+    state: present
+    use: "{{ (__hpc_server_is_ostree | d(false)) |
+      ternary('ansible.posix.rhel_rpm_ostree', omit) }}"
+  register: __hpc_base_packages_install
+  until: __hpc_base_packages_install is success
+
 - name: Replace default RHUI Azure repository with the EUS repository
</code_context>

<issue_to_address>
**suggestion:** The `until` clause is effectively a no-op without explicit `retries`/`delay` and may not provide the intended resilience.

As written, this still executes only once because no `retries`/`delay` are defined, so `until: __hpc_base_packages_install is success` doesn’t add real resilience. If you want to handle transient repo/lock errors, add explicit `retries` and `delay`; otherwise consider removing the `until` to avoid suggesting a retry mechanism that isn’t there.

```suggestion
- name: Install base packages
  package:
    name: "{{ __hpc_base_packages }}"
    state: present
    use: "{{ (__hpc_server_is_ostree | d(false)) |
      ternary('ansible.posix.rhel_rpm_ostree', omit) }}"
  register: __hpc_base_packages_install
  retries: 5
  delay: 10
  until: __hpc_base_packages_install is success
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +74 to +81
- name: Install base packages
package:
name: "{{ __hpc_base_packages }}"
state: present
use: "{{ (__hpc_server_is_ostree | d(false)) |
ternary('ansible.posix.rhel_rpm_ostree', omit) }}"
register: __hpc_base_packages_install
until: __hpc_base_packages_install is success
Copy link

Choose a reason for hiding this comment

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

suggestion: The until clause is effectively a no-op without explicit retries/delay and may not provide the intended resilience.

As written, this still executes only once because no retries/delay are defined, so until: __hpc_base_packages_install is success doesn’t add real resilience. If you want to handle transient repo/lock errors, add explicit retries and delay; otherwise consider removing the until to avoid suggesting a retry mechanism that isn’t there.

Suggested change
- name: Install base packages
package:
name: "{{ __hpc_base_packages }}"
state: present
use: "{{ (__hpc_server_is_ostree | d(false)) |
ternary('ansible.posix.rhel_rpm_ostree', omit) }}"
register: __hpc_base_packages_install
until: __hpc_base_packages_install is success
- name: Install base packages
package:
name: "{{ __hpc_base_packages }}"
state: present
use: "{{ (__hpc_server_is_ostree | d(false)) |
ternary('ansible.posix.rhel_rpm_ostree', omit) }}"
register: __hpc_base_packages_install
retries: 5
delay: 10
until: __hpc_base_packages_install is success

Add a new top-level "Install base packages" task to ensure the role’s baseline
packages (defined in __hpc_base_packages) are installed consistently and
independently of optional feature blocks such as Moneo.

The task is placed immediately after repository configuration so required repos
are available before package installation, and it uses the same OSTree-safe
package backend selection pattern used elsewhere in the role.

Anything we need that isn't a direct dependency of some other install target should be listed here.

Signed-off-by: Gaurav Goklani <ggoklani@redhat.com>

__hpc_microsoft_prod_rpm_key: https://packages.microsoft.com/keys/microsoft.asc

__hpc_base_packages:
Copy link
Collaborator

Choose a reason for hiding this comment

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

The naming here is too vague to me, can you come up with a more descriptive name? Base for what is this?

Copy link
Collaborator

Choose a reason for hiding this comment

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

"base" as in "we can't build a house without first preparing a solid base to build on". e.g. RHEL 9.6 is the "base image" we build the HPC product on top of.

The "base HPC packages" are packages that we always need to install into the HPC cluster image, regardless of whether there are any downstream installation dependencies on them or not.

FWIW, you've said many times we should group all the packages we really need into a single install rule to avoid having to run DNF over and over again as teh system role script runs. This is where we are going to define that packages list to provide form the base level environment everything else in the system role script is built upon...

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.

3 participants