I have a DHCP Rhel 8.6 in Azure system that runs cloud-init at each boot. I want to change the obtained DNS servers at each boot for a specific DNS. But I want to do it in ansible. My question is why the following ansible does not persist after each reboot?
- hosts: localhost
become: yes
tasks:
- name: setting DNS resolver config, remove default DNS as it is not my DC ip address
nmcli:
conn_name='System eth0'
dns4="10.1.1.38"
dns4_ignore_auto=true
dns4_search="dclabs.labs.lab"
state=present
autoconnect=true
- name: restart NetworkManager service
service: name=NetworkManager state=restarted
After each reboot, my changes are reverted and I am back to have in /etc/resolv.conf the DHCP obtained DNS entries.
Hi @ErickPH! It looks like the post might be solved - could you check to see if the response by @jbericat or @leo worked for you?
If so, it would be super helpful if you could click the on their post to accept the solution - it recognises the input of others, helps our volunteers find new issues to answer, and keeps the forum nice and tidy.
Thanks!
(this is template reply, do feel free to reply if I’ve misunderstood the situation!)