Skip to content

feat: Support extra dracut settings for static IP#268

Open
richm wants to merge 1 commit into
linux-system-roles:mainfrom
richm:feat-support-static-networking
Open

feat: Support extra dracut settings for static IP#268
richm wants to merge 1 commit into
linux-system-roles:mainfrom
richm:feat-support-static-networking

Conversation

@richm

@richm richm commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Feature: Introduce the nbde_client_extra_dracut_settings variable.
This is a list of strings written to
/etc/dracut.conf.d/nbde_client.conf in addition to the implicit
platform-specific __nbde_client_dracut_settings.

Reason: NBDE clients with static IP addressing need custom early-boot
network settings in dracut (for example kernel_cmdline with a static
ip= and nameserver). Previously the role only wrote fixed platform
settings, so users had to disable early boot or manage dracut config
outside the role.

Result: Users can pass extra dracut configuration lines via
nbde_client_extra_dracut_settings (documented in README.md) while
keeping the role's implicit settings. A new integration test verifies
the static IP kernel_cmdline example is written to the conf file.

Assisted-by: Cursor using models Cursor Grok 4.5, Composer 2.5, Sonnet 5

Signed-off-by: Rich Megginson rmeggins@redhat.com

Summary by CodeRabbit

  • New Features
    • Added a new option to include extra dracut configuration lines for early-boot networking.
    • Updated role documentation with the new variable, defaults, and usage guidance (including a note that early boot must be enabled).
  • Bug Fixes
    • Ensures extra dracut settings are written into the generated dracut configuration.
    • Triggers the initramfs update when the dracut configuration changes.
    • Fails fast if extra dracut settings are set while early boot is disabled.
  • Tests
    • Added coverage validating the generated configuration and idempotency, plus rejection when early boot is disabled.

@richm
richm requested review from sergio-correia and spetrosi July 20, 2026 14:31
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@richm, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 42 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 794aef3c-10ec-4d8b-b70d-a0b416c22353

📥 Commits

Reviewing files that changed from the base of the PR and between 9e3b0a1 and 45abc5a.

📒 Files selected for processing (7)
  • README.md
  • defaults/main.yml
  • tasks/main-clevis.yml
  • tasks/main.yml
  • templates/nbde_client.conf
  • tests/tests_default_vars.yml
  • tests/tests_extra_dracut_settings.yml
📝 Walkthrough

Walkthrough

Changes

Extra dracut settings

Layer / File(s) Summary
Settings variable contract
defaults/main.yml, README.md
Defines nbde_client_extra_dracut_settings with an empty-list default and documents its dracut configuration format, usage example, and early-boot requirement.
Settings rendering and regeneration
templates/nbde_client.conf, tasks/main-clevis.yml, tests/tests_default_vars.yml, tests/tests_extra_dracut_settings.yml
Renders platform-specific and extra settings together, notifies initramfs regeneration when the configuration changes, and verifies defaults, generated content, and idempotency.
Early-boot validation
tasks/main.yml, tests/tests_extra_dracut_settings.yml
Rejects extra dracut settings when early boot is disabled and verifies the resulting error message.

Possibly related PRs

Suggested reviewers: spetrosi

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed The title follows Conventional Commits and clearly matches the change to support extra dracut settings.
Description check ✅ Passed The description covers the enhancement, reason, and result; it is mostly complete despite using different headings and omitting issue-tracker tickets.
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.
Description Format ✅ Passed PR description includes Feature, Reason, Result, and Signed-off-by, with optional Assisted-by; it matches the repo template’s required structure.

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

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
tests/tests_extra_dracut_settings.yml (1)

1-1: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove AI-generation artifact.

Consider removing this auto-generated comment before merging, as it does not add value to the codebase.

♻️ Proposed fix
-# Generated by: Cursor using models Cursor Grok 4.5, Composer 2.5, Sonnet 5
🤖 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 `@tests/tests_extra_dracut_settings.yml` at line 1, Remove the auto-generated
“Generated by” comment from tests/tests_extra_dracut_settings.yml, leaving the
file content otherwise unchanged.
🤖 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 `@tests/tests_extra_dracut_settings.yml`:
- Around line 11-13: Extend the test task block in
tests_extra_dracut_settings.yml with a failure scenario for
nbde_client_extra_dracut_settings, passing an invalid value such as a dictionary
instead of a list of strings and asserting that role execution fails. Preserve
the existing success and idempotency checks.
- Around line 8-18: Update tests/tests_extra_dracut_settings.yml at lines 8-18
and 49-53: use ansible.builtin.include_tasks for both wrapper invocations, and
move nbde_client_extra_dracut_settings from the play-level vars into each
invocation’s vars block. Do not alter the other tasks unless required for these
corrections.

---

Nitpick comments:
In `@tests/tests_extra_dracut_settings.yml`:
- Line 1: Remove the auto-generated “Generated by” comment from
tests/tests_extra_dracut_settings.yml, leaving the file content otherwise
unchanged.
🪄 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 Plus

Run ID: 568d5884-403a-4e72-ab2c-a1cabc7d5491

📥 Commits

Reviewing files that changed from the base of the PR and between f7a8153 and 98183ce.

📒 Files selected for processing (5)
  • README.md
  • defaults/main.yml
  • templates/nbde_client.conf
  • tests/tests_default_vars.yml
  • tests/tests_extra_dracut_settings.yml

Comment thread tests/tests_extra_dracut_settings.yml
Comment thread tests/tests_extra_dracut_settings.yml
@richm

richm commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

[citest]

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 @.github/workflows/ansible-lint.yml:
- Line 47: Update the tox-lsr dependency in the workflow’s pip3 install command
to reference a reviewed immutable commit SHA or trusted immutable tag instead of
the mutable tox-4.58-fixes branch, preserving the existing repository source.
🪄 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 Plus

Run ID: c7d41000-7fab-4a1f-9223-ff66d823de85

📥 Commits

Reviewing files that changed from the base of the PR and between 98183ce and 1b31b5a.

📒 Files selected for processing (1)
  • .github/workflows/ansible-lint.yml

Comment thread .github/workflows/ansible-lint.yml Outdated

@sergio-correia sergio-correia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A couple of issues to address beyond what CodeRabbit flagged.

Initramfs not rebuilt when only extra_dracut_settings changes

The template task at tasks/main-clevis.yml:18-24 has no notify: Handle nbde_client update initramfs. The only task that notifies the handler is "Perform clevis operations" (line 68), which only fires when bindings change. So if a user adds nbde_client_extra_dracut_settings on a host whose bindings are already in place, the conf file is updated but dracut -fv --regenerate-all never runs. The initramfs stays stale. Please add notify: Handle nbde_client update initramfs to the template task. This is safe because the template module only reports changed when the file content actually differs, and __nbde_client_update_initramfs is already true in vars/main.yml.

extra_dracut_settings silently dropped when early_boot is false

The template task is gated on when: nbde_client_early_boot | bool. If a user sets nbde_client_early_boot: false and provides nbde_client_extra_dracut_settings, the settings are silently ignored with no warning. Would it be worth adding a validation task that fails when both are set, something like:

- name: Fail when extra dracut settings are set but early boot is disabled
  fail:
    msg: >-
      nbde_client_extra_dracut_settings has
      {{ nbde_client_extra_dracut_settings | length }} entries, but
      nbde_client_early_boot is false so they will not be written.
  when:
    - not (nbde_client_early_boot | bool)
    - nbde_client_extra_dracut_settings | length > 0

Comment thread README.md Outdated
@richm
richm force-pushed the feat-support-static-networking branch 2 times, most recently from 5d98f3b to f1dcc64 Compare July 21, 2026 20:11
@richm

richm commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

@sergio-correia Thanks! Done

@richm

richm commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

[citest]

@richm
richm force-pushed the feat-support-static-networking branch from f1dcc64 to 9e3b0a1 Compare July 21, 2026 20:52
@richm

richm commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

@sergio-correia I reviewed the docs again - I had to add leading and trailing spaces to the kernel_cmdline like this:

kernel_cmdline+=" ip=192.0.2.10::192.0.2.1:255.255.255.0::ens3:none nameserver=192.0.2.100 "

@richm

richm commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

[citest]

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 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 `@tasks/main.yml`:
- Line 4: Update the module reference in the task to use the fully qualified
builtin name ansible.builtin.fail instead of fail, preserving the task’s
existing behavior and configuration.
- Around line 10-12: Update the early-boot condition in the task’s when clause
to evaluate nbde_client_early_boot through the bool filter, using the normalized
negated value before checking nbde_client_extra_dracut_settings.

In `@tests/tests_extra_dracut_settings.yml`:
- Around line 83-104: Add an always section to the failure-path task block
containing the required tagged cleanup for this test. Keep the existing rescue
assertions unchanged, and ensure cleanup runs after both expected and unexpected
failures.
- Around line 67-72: Update the “Clean up generated dracut config” task to
notify the existing “Handle nbde_client update initramfs” handler when the file
is removed, ensuring cleanup rebuilds initramfs and leaves subsequent test runs
isolated.
🪄 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 Plus

Run ID: cb0761bf-82ed-4de4-81fd-743f59437eda

📥 Commits

Reviewing files that changed from the base of the PR and between 5d98f3b and 9e3b0a1.

📒 Files selected for processing (7)
  • README.md
  • defaults/main.yml
  • tasks/main-clevis.yml
  • tasks/main.yml
  • templates/nbde_client.conf
  • tests/tests_default_vars.yml
  • tests/tests_extra_dracut_settings.yml
🚧 Files skipped from review as they are similar to previous changes (4)
  • templates/nbde_client.conf
  • defaults/main.yml
  • tests/tests_default_vars.yml
  • README.md

Comment thread tasks/main.yml
Comment thread tasks/main.yml
Comment thread tests/tests_extra_dracut_settings.yml
Comment thread tests/tests_extra_dracut_settings.yml Outdated
Feature: Introduce the nbde_client_extra_dracut_settings variable.
This is a list of strings written to
/etc/dracut.conf.d/nbde_client.conf in addition to the implicit
platform-specific __nbde_client_dracut_settings.

Reason: NBDE clients with static IP addressing need custom early-boot
network settings in dracut (for example kernel_cmdline with a static
ip= and nameserver). Previously the role only wrote fixed platform
settings, so users had to disable early boot or manage dracut config
outside the role.

Result: Users can pass extra dracut configuration lines via
nbde_client_extra_dracut_settings (documented in README.md) while
keeping the role's implicit settings. A new integration test verifies
the static IP kernel_cmdline example is written to the conf file.

Assisted-by: Cursor using models Cursor Grok 4.5, Composer 2.5, Sonnet 5

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
@richm
richm force-pushed the feat-support-static-networking branch from 9e3b0a1 to 45abc5a Compare July 21, 2026 21:09
@richm

richm commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

[citest]

@richm

richm commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

the centos-9 failure is due to a python problem which looks like it has now been fixed in Testing Farm images but not in qcow2 images
the fedora 42 failure is probably because f42 is obsolete - need to remove that and add f44

@sergio-correia sergio-correia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks!

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