Skip to content

Fix DNS override not surviving reboot#12

Merged
csibbitt merged 1 commit intomainfrom
csibbitt_OSPRH-25653_fix_DNS_override
Feb 2, 2026
Merged

Fix DNS override not surviving reboot#12
csibbitt merged 1 commit intomainfrom
csibbitt_OSPRH-25653_fix_DNS_override

Conversation

@csibbitt
Copy link
Contributor

  • use nmcli to set it in NetworkManager instead of blindly writing to resolv.conf

* use nmcli to set it in NetworkManager instead of blindly writing to
  resolv.conf
@csibbitt
Copy link
Contributor Author

Old code

Before running the ansible

$ ssh gpu-validation -- cat /etc/resolv.conf
# Generated by NetworkManager
search openstackgate.local
nameserver 172.30.0.10

After running the ansible

$ ansible-playbook -i inventory-local --skip-tags rhoso -e gpu_validation_dns_server=192.168.25.10 main.yaml
[...]
TASK [gpu-validation : Overwrite DNS entries in /etc/resolv.conf if gpu_validation_dns_server is set] ******************************************************************************
changed: [gpu-validation-0]
[...]

$ ssh gpu-validation -- cat /etc/resolv.conf
nameserver 192.168.25.10

After reboot

$ ssh gpu-validation -- sudo reboot
Connection to 192.168.25.222 closed by remote host.

$ ssh gpu-validation -- cat /etc/resolv.conf
# Generated by NetworkManager
search openstackgate.local
nameserver 172.30.0.10

This is the problem to solve - after reboot (or other NM event, perhaps), the nameserver is set back to 172.30.0.10 instead of the 192.168.25.10 we configured.

New code

After running the ansible

$ ansible-playbook -i inventory-local --skip-tags rhoso -e gpu_validation_dns_server=192.168.25.10 main.yaml
[...]
TASK [gpu-validation : Set DNS server using nmcli if gpu_validation_dns_server is set] *********************************************************************************************
changed: [gpu-validation-0]

[...]

$ ssh gpu-validation --  cat /etc/resolv.conf 
# Generated by NetworkManager
nameserver 192.168.25.10

After reboot

$ ssh gpu-validation -- sudo reboot
Connection to 192.168.25.222 closed by remote host.

$ ssh gpu-validation -- cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 192.168.25.10

Copy link
Contributor

@MiguelCarpio MiguelCarpio left a comment

Choose a reason for hiding this comment

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

LGTM

@csibbitt csibbitt merged commit d445f4e into main Feb 2, 2026
1 check passed
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