From d9efb1085bbfb00fd9aec337f669239d7b9d5d37 Mon Sep 17 00:00:00 2001 From: vcandapp Date: Tue, 3 Jun 2025 20:07:14 +0530 Subject: [PATCH] EDPM deployment should not do network cleanup by default With nmstate-provider set as default for os-net-config, default cleanup during update/adoption is not desired. Updated description for the proper usage of this flag Signed-off-by: Jira: https://issues.redhat.com/browse/OSPRH-16537 https://issues.redhat.com/browse/OSPRH-17036 Signed-off-by: vcandapp --- docs/source/roles/role-edpm_network_config.rst | 12 ++++++++---- plugins/modules/edpm_os_net_config.py | 8 ++++---- roles/edpm_network_config/defaults/main.yml | 2 +- roles/edpm_network_config/meta/argument_specs.yml | 12 ++++++++++-- .../molecule/nmstate/converge.yml | 7 ++++--- 5 files changed, 27 insertions(+), 14 deletions(-) diff --git a/docs/source/roles/role-edpm_network_config.rst b/docs/source/roles/role-edpm_network_config.rst index 99cde19f7..728e34f39 100644 --- a/docs/source/roles/role-edpm_network_config.rst +++ b/docs/source/roles/role-edpm_network_config.rst @@ -19,10 +19,14 @@ This Ansible role does the following tasks: - Checks for the presence of required RPMS - Uses "provider" ifcfg/nmstate based on flag "edpm_network_config_nmstate" -Note: By default this role will cleanup devices/interfaces not in -"edpm_network_config_template". If there is requirement to keep them -for pre-provisioned nodes, "edpm_network_config_nonconfigured_cleanup" -ansible var can be set to "false". +Note: * With nmstate-provider as the default for os-net-config, + "os-net-config --cleanup" should be used only for very + specific use case, eg + - SSH provisioned over VLAN-tagged single interface + - os-net-config needs to override ctlplane over bond+VLAN + + * "os-net-config --cleanup" SHOULD NOT be set for update/adoption + use case Here is an example playbook to run os-net-config tool: diff --git a/plugins/modules/edpm_os_net_config.py b/plugins/modules/edpm_os_net_config.py index 4bac2bf8c..325b08717 100644 --- a/plugins/modules/edpm_os_net_config.py +++ b/plugins/modules/edpm_os_net_config.py @@ -39,11 +39,11 @@ requirements: - os-net-config description: - - Configure host network interfaces using a JSON config file format. + - Configure host network interfaces using a YAML/JSON config file format. options: cleanup: description: - - Cleanup unconfigured interfaces. + - Cleanup unconfigured interfaces, before applying. type: bool default: false config_file: @@ -69,9 +69,9 @@ default: false use_nmstate: description: - - If enabled, use nmstate and network manager for network configuration. + - If disabled, use legacy ifcfg/network-scripts for network configuration. type: bool - default: false + default: true """ EXAMPLES = """ diff --git a/roles/edpm_network_config/defaults/main.yml b/roles/edpm_network_config/defaults/main.yml index 69a01f11e..dfbc9216e 100644 --- a/roles/edpm_network_config/defaults/main.yml +++ b/roles/edpm_network_config/defaults/main.yml @@ -54,8 +54,8 @@ edpm_network_config_safe_defaults: false edpm_network_config_template: "" edpm_bond_interface_ovs_options: "bond_mode=active-backup" edpm_dns_search_domains: [] -edpm_network_config_nonconfigured_cleanup: true # Control resolv.conf management by NetworkManager # false = disable NetworkManager resolv.conf update (default) # true = enable NetworkManager resolv.conf updat edpm_bootstrap_network_resolvconf_update: "{{ edpm_network_config_nmstate | default(True) }}" +edpm_network_config_nonconfigured_cleanup: false diff --git a/roles/edpm_network_config/meta/argument_specs.yml b/roles/edpm_network_config/meta/argument_specs.yml index b879391e2..bca998a9f 100644 --- a/roles/edpm_network_config/meta/argument_specs.yml +++ b/roles/edpm_network_config/meta/argument_specs.yml @@ -81,8 +81,16 @@ argument_specs: default: nic1 edpm_network_config_nonconfigured_cleanup: type: bool - description: "Cleanup network interfaces not in network config" - default: true + description: > + Cleanup interfaces not defined in the network configa. + Usage: + - If there are any ifcfg/nm interfaces which you need to clean + before applying the desired config, set this flag to 'true' + - During network_update, if cleanup is needed for any interfaces + Warning! + - Cleanup of ssh interface might result in connectivity loss + - Cleanup of DPDK/SR-IOV interfaces is not supported + default: false edpm_bootstrap_network_resolvconf_update: type: bool default: true diff --git a/roles/edpm_network_config/molecule/nmstate/converge.yml b/roles/edpm_network_config/molecule/nmstate/converge.yml index f765a26c4..f09264456 100644 --- a/roles/edpm_network_config/molecule/nmstate/converge.yml +++ b/roles/edpm_network_config/molecule/nmstate/converge.yml @@ -14,7 +14,6 @@ # License for the specific language governing permissions and limitations # under the License. - - name: Converge hosts: all gather_facts: false @@ -30,9 +29,11 @@ state: up ipv4: address: - - ip: 192.168.180.2 - prefix-length: 24 + - ip: 192.168.180.2 + prefix-length: 24 dhcp: false enabled: true + ipv6: + enabled: false roles: - role: osp.edpm.edpm_network_config