From bc29060a738f14d3ed95ca9f77c57ffd43ceaeaa Mon Sep 17 00:00:00 2001 From: vcandapp Date: Fri, 6 Dec 2024 16:32:07 +0530 Subject: [PATCH] Prevent NM from automatic (DHCP/SLAAC) configuration on ethernet devices When edpm_network_config role uses os-net-config to perform host network configuration, duplicate DHCP requests from NM are causing issue. Eg. https://issues.redhat.com/browse/OSPRH-9142 This fix prevents NM to configure DHCP by default --- roles/edpm_network_config/tasks/main.yml | 27 ++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/roles/edpm_network_config/tasks/main.yml b/roles/edpm_network_config/tasks/main.yml index afed98124..55808b9a5 100644 --- a/roles/edpm_network_config/tasks/main.yml +++ b/roles/edpm_network_config/tasks/main.yml @@ -37,7 +37,26 @@ - name: Load system-roles.network tasks [nmstate] ansible.builtin.include_role: name: "{{ lookup('ansible.builtin.env', 'EDPM_SYSTEMROLES', default='fedora.linux_system_roles') + '.network' }}" -- name: Load edpm_network_config tasks [os-net-config] - ansible.builtin.include_tasks: - file: network_config.yml - when: edpm_network_config_tool == 'os-net-config' + +- name: Disable auto-configuration of all interfaces by NetworkManager + when: ( edpm_bootstrap_network_service == 'NetworkManager' ) and + ( edpm_network_config_tool == 'os-net-config' ) + become: true + block: + - name: Set 'no-auto-default' in /etc/NetworkManager/NetworkManager.conf + community.general.ini_file: + path: /etc/NetworkManager/NetworkManager.conf + state: present + mode: "0644" + no_extra_spaces: true + section: main + option: no-auto-default + value: "*" + backup: true + - name: Restart NetworkManager + ansible.builtin.systemd: + name: NetworkManager + state: restarted + - name: Load edpm_network_config tasks for os-net-config tool + ansible.builtin.include_tasks: + file: network_config.yml