Re-add DNS nameservers into /etc/resolv.conf on NetworkManager restart#209
Conversation
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 <[email protected]>
WalkthroughReorganized 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
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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (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). (3)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Just in case, please wait for merging until Monday. Thank you |
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