Skip to content

Conversation

@danpawlik
Copy link
Collaborator

@danpawlik danpawlik commented Nov 14, 2025

After restarting NetworkManager, the /etc/resolv.conf file is cleaned-up to default values, so it might not contain local dnsmasq ip address set as first nameserver.
Change order to avoid situation that none nameserver would be available in /etc/resolv.conf file.

Summary by CodeRabbit

  • Chores
    • Improved deployment reliability by enhancing network manager and DNS configuration handling to ensure proper initialization order and file permissions, preventing conflicts during setup.

After restarting NetworkManager, the /etc/resolv.conf file is
cleaned-up to default values, so it might not contain
local dnsmasq ip address set as first nameserver.
Change order to avoid situation that none nameserver would be available
in /etc/resolv.conf file.

Signed-off-by: Daniel Pawlik <dpawlik@redhat.com>
@coderabbitai
Copy link

coderabbitai bot commented Nov 14, 2025

Walkthrough

Reorganized DNS configuration tasks in an Ansible playbook by moving NetworkManager DNS-disabling logic to the top and adding explicit /etc/resolv.conf file state management, with conditional NetworkManager restart based on configuration changes.

Changes

Cohort / File(s) Summary
DNS configuration task reorganization
ansible/roles/deploy-crc-cloud/tasks/dnsmasq.yaml
Added three new tasks at the top: disable NetworkManager from overwriting /etc/resolv.conf (with registration), conditional NetworkManager restart, and /etc/resolv.conf file state enforcement. Removed duplicate tasks from later section, consolidating DNS setup logic at the beginning of the playbook.

Sequence Diagram(s)

sequenceDiagram
    participant Playbook
    participant NM as NetworkManager Config
    participant Service as NetworkManager Service
    participant File as resolv.conf File

    Playbook->>NM: Write NM conf to disable DNS overwrite
    Note over Playbook: Register _disable_dns_overwrite
    alt _disable_dns_overwrite.changed
        Playbook->>Service: Restart NetworkManager
    end
    Playbook->>File: Ensure regular file with proper permissions
    Note over Playbook: Continue with dnsmasq config
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Single file with straightforward task reorganization and consolidation
  • Conditional logic based on registration is standard Ansible pattern
  • No complex dependencies or multi-step interactions introduced
  • Primary focus: verify task order correctness and idempotency of the reorganized workflow

Poem

🐰 The tasks hop into place, DNS now set right,
No more NetworkManager writes—resolv.conf's tight!
We bundled the logic, moved chaos above,
Where dnsmasq awaits with files it shall love. 🔧✨

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 clearly relates to the main change: ensuring DNS nameservers persist in /etc/resolv.conf after NetworkManager restart, which aligns with the task reordering and NetworkManager restart handling in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 784d40a and 50aaf88.

📒 Files selected for processing (1)
  • ansible/roles/deploy-crc-cloud/tasks/dnsmasq.yaml (1 hunks)
⏰ 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 (ubuntu-latest, 1.20)
  • GitHub Check: build (macOS-latest, 1.20)
  • GitHub Check: build-and-push-image
🔇 Additional comments (1)
ansible/roles/deploy-crc-cloud/tasks/dnsmasq.yaml (1)

3-26: Good ordering of DNS configuration setup.

The sequence of tasks properly ensures that NetworkManager is configured to stop managing /etc/resolv.conf before attempting to manage nameservers. The explicit file state management (lines 19–26) is a solid safeguard against symlinks or permission issues.


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 and usage tips.

@danpawlik
Copy link
Collaborator Author

Just in case, please wait for merging until Monday. Thank you

@praveenkumar praveenkumar merged commit 49d5584 into crc-org:main Nov 17, 2025
4 checks passed
@danpawlik danpawlik deleted the ensure-dns-set-resolv branch November 17, 2025 07:25
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