From e37d8a09431401fa15a29ca3a73d1af53efa1aae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathieu=20Dupr=C3=A9?= Date: Fri, 22 Nov 2024 16:20:25 +0100 Subject: [PATCH] do not use netplan to create team0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To avoid a bug a Netplan durring OVS cleanup step that reset the RSTP configuration of the bridge that is already configured, we decided to not use Netplan to create the team0 interface. The team0 bridge is now created in anycase by the systemd-networkd. Signed-off-by: Mathieu Dupré --- inventories/netplan_cluster_example.yaml.j2 | 35 ------------------- .../seapath_cluster_definition_example.yml | 5 +-- playbooks/seapath_setup_network.yaml | 6 ++-- roles/network_clusternetwork/tasks/main.yml | 2 -- vars/network_team_only_vars.yml | 29 +++++++++++++++ vars/network_vars.yml | 4 +-- 6 files changed, 36 insertions(+), 45 deletions(-) delete mode 100644 inventories/netplan_cluster_example.yaml.j2 create mode 100644 vars/network_team_only_vars.yml diff --git a/inventories/netplan_cluster_example.yaml.j2 b/inventories/netplan_cluster_example.yaml.j2 deleted file mode 100644 index cc47f63b8..000000000 --- a/inventories/netplan_cluster_example.yaml.j2 +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright (C) 2024 Savoir-faire Linux, Inc. -# SPDX-License-Identifier: Apache-2.0 -# This netplan files defines the path of the cluster network which is managed -# by systemd. Especially, it attributes its cluster IP addr to each node. -network: - version: 2 - renderer: networkd - ethernets: - "{{ team0_0|default('0') }}": - mtu: 9000 - dhcp4: no - dhcp6: no - optional: true - "{{ team0_1|default('0') }}": - mtu: 9000 - dhcp4: no - dhcp6: no - optional: true - bridges: - team0: - interfaces: - - "{{ team0_0|default('0') }}" - - "{{ team0_1|default('0') }}" - addresses: - - "{{ cluster_ip_addr|default('0') }}/{{ subnet|default(24) }}" - openvswitch: - rstp: true - other-config: - rstp-priority: "{{ br_rstp_priority }}" - parameters: - stp: false - forward-delay: 4 - mtu: 9000 - dhcp4: no - dhcp6: no diff --git a/inventories/seapath_cluster_definition_example.yml b/inventories/seapath_cluster_definition_example.yml index d3f9c32d7..5b87c1ff6 100644 --- a/inventories/seapath_cluster_definition_example.yml +++ b/inventories/seapath_cluster_definition_example.yml @@ -15,7 +15,6 @@ all: netplan_configurations : - inventories/netplan_admin_br0_example.yaml.j2 - inventories/netplan_ptp_interface_example.yaml.j2 - - inventories/netplan_cluster_example.yaml.j2 # Main network configuration network_interface: eno8303 #admin interface @@ -60,7 +59,6 @@ all: netplan_configurations : - inventories/netplan_admin_br0_example.yaml.j2 - inventories/netplan_ptp_interface_example.yaml.j2 - - inventories/netplan_cluster_example.yaml.j2 # Main network configuration network_interface: eno8303 @@ -96,10 +94,9 @@ all: ansible_host: 10.10.10.3 hostname: "node3" - netplan_configurations : + netplan_configurations: - inventories/netplan_admin_br0_example.yaml.j2 - inventories/netplan_ptp_interface_example.yaml.j2 - - inventories/netplan_cluster_example.yaml.j2 # Main network interface configuration network_interface: eno8303 diff --git a/playbooks/seapath_setup_network.yaml b/playbooks/seapath_setup_network.yaml index ed7914698..46aa029b4 100644 --- a/playbooks/seapath_setup_network.yaml +++ b/playbooks/seapath_setup_network.yaml @@ -11,8 +11,10 @@ - standalone_machine become: true gather_facts: true - vars_files: - - ../vars/network_vars.yml + pre_tasks: + - name: Dynamically include network configuration variables + include_vars: + file: "../vars/network_{{ 'team_only_' if netplan_configurations is defined or (network_simple is defined and network_simple) else '' }}vars.yml" roles: - role: network_basics - role: systemd_networkd diff --git a/roles/network_clusternetwork/tasks/main.yml b/roles/network_clusternetwork/tasks/main.yml index 22cf39fc5..fdd8d9b42 100644 --- a/roles/network_clusternetwork/tasks/main.yml +++ b/roles/network_clusternetwork/tasks/main.yml @@ -32,7 +32,6 @@ when: - cluster_protocol is not defined or cluster_protocol != "HSR" or hsr_mac_address is not defined - skip_recreate_team0_config is not defined or skip_recreate_team0_config is not true - - netplan_configurations is not defined - block: - name: copy hsr.sh script template: @@ -71,4 +70,3 @@ state: restarted when: hsr1.changed or hsr2.changed or hsr3.changed or hsrservice.changed when: cluster_protocol is defined and cluster_protocol == "HSR" and hsr_mac_address is defined - diff --git a/vars/network_team_only_vars.yml b/vars/network_team_only_vars.yml new file mode 100644 index 000000000..9895a25e7 --- /dev/null +++ b/vars/network_team_only_vars.yml @@ -0,0 +1,29 @@ +# Copyright (C) 2021, RTE (http://www.rte-france.com) +# Copyright (C) 2024 Savoir-faire Linux, Inc. +# SPDX-License-Identifier: Apache-2.0 +--- + +systemd_networkd_network_custom: "{{ custom_network | default({}) }}" +systemd_networkd_netdev: "{{ custom_netdev | default({}) }}" + +team0_systemd_networkd_network: + 79-team0: + - Match: + - Name: "team0" + - Network: + - Address: "{{ cluster_ip_addr|default('0') }}/{{ team0subnet | default(24) }}" + 79-team0_0: + - Match: + - Name: "{{ team0_0|default('0') }}" + - Link: + - MTUBytes: 1800 + 79-team0_1: + - Match: + - Name: "{{ team0_1|default('0') }}" + - Link: + - MTUBytes: 1800 + + +systemd_networkd_network: "{{ team0_systemd_networkd_network | combine(systemd_networkd_network_custom) if cluster_ip_addr is defined else systemd_networkd_network_custom }}" + +... diff --git a/vars/network_vars.yml b/vars/network_vars.yml index f3c677116..e2712d19a 100644 --- a/vars/network_vars.yml +++ b/vars/network_vars.yml @@ -2,8 +2,8 @@ # SPDX-License-Identifier: Apache-2.0 --- -systemd_networkd_network_custom: "{{ custom_network | default([]) }}" -systemd_networkd_netdev_custom: "{{ custom_netdev | default([]) }}" +systemd_networkd_network_custom: "{{ custom_network | default({}) }}" +systemd_networkd_netdev_custom: "{{ custom_netdev | default({}) }}" br0vlan_systemd_networkd_netdev: 79-br0: