From d5831661f878d7e0fc0e27d4feb532cc2d75bcc2 Mon Sep 17 00:00:00 2001 From: vcandapp Date: Mon, 5 Aug 2024 18:11:39 +0530 Subject: [PATCH] Update edpm_network_config for no-auto-default Set no-auto-defult flag for os-net-config --- roles/edpm_network_config/tasks/main.yml | 26 ++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/roles/edpm_network_config/tasks/main.yml b/roles/edpm_network_config/tasks/main.yml index 71b79971c..7a9f42903 100644 --- a/roles/edpm_network_config/tasks/main.yml +++ b/roles/edpm_network_config/tasks/main.yml @@ -36,7 +36,25 @@ - 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 + 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 + ansible.builtin.include_tasks: + file: network_config.yml