Skip to content

Commit

Permalink
Stop NetworkManager from overriding resolv.conf
Browse files Browse the repository at this point in the history
When ``resolv_is_managed`` is set, Kayobe templates resolv.conf. This
patch stops NetworkManager from overriding these changes.

Closes-Bug: #2044537
Change-Id: I90b61dfe03d53c58327d2b15e70b7b8489bdfb47
(cherry picked from commit 578a257)
  • Loading branch information
MoteHue committed Dec 12, 2023
1 parent 56d7faf commit fde242b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ansible/roles/network-redhat/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@
when: resolv_is_managed | bool
become: True

- name: Ensure NetworkManager DNS config is present only if required
become: true
community.general.ini_file:
path: /etc/NetworkManager/NetworkManager.conf
section: main
option: "{{ item.option }}"
value: "{{ item.value }}"
state: "{{ 'present' if resolv_is_managed | bool else 'absent'}}"
loop:
- option: dns
value: none
- option: rc-manager
value: unmanaged
when:
- ansible_facts.os_family == "RedHat" and ansible_facts.distribution_major_version == "9"

- name: Configure network interfaces (RedHat)
import_role:
name: MichaelRigart.interfaces
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
fixes:
- |
Fixes a bug where NetworkManager would overwrite resolv.conf when
``resolv_is_managed`` is set to ``True``.
`LP#2044537 <https://launchpad.net/bugs/2044537>`__

0 comments on commit fde242b

Please sign in to comment.