Просмотр исходного кода

Merge pull request #1006 from Shubhangi-dell/bugfix

Dhcp Routing configuration fix
Sujit Jadhav 3 лет назад
Родитель
Сommit
f3d15db3a6

+ 48 - 0
control_plane/roles/control_plane_common/tasks/ip_metric.yml

@@ -0,0 +1,48 @@
+#  Copyright 2022 Dell Inc. or its subsidiaries. All Rights Reserved.
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+---
+
+- name: Setting metric
+  command: nmcli connection modify {{ item.name }} ipv4.route-metric {{ item.value }}
+  with_items:
+    - { name: "{{ public_nic }}", value: "{{ public_metric }}" }
+    - { name: "{{ host_network_nic }}", value: "{{ host_metric }}" }
+  changed_when: false
+
+- name: Reactivate the nics
+  command: nmcli connection up {{ item.name }}
+  with_items:
+    - { name: "{{ public_nic }}" }
+    - { name: "{{ host_network_nic }}" }
+  changed_when: false
+
+- name: Set metric for device container
+  command: nmcli connection modify {{ mngmnt_network_nic }} ipv4.route-metric {{ mngmnt_metric }}
+  changed_when: false
+  when: device_config_support
+
+- name: Reactivate the device nic
+  command: nmcli connection up {{ mngmnt_network_nic }}
+  changed_when: false
+  when: device_config_support
+
+- name: Set metric for ib nic
+  command: nmcli connection modify {{ ib_network_nic }} ipv4.route-metric {{ ib_metric }}
+  changed_when: false
+  when: ib_switch_support
+
+- name: Reactivate the ib nic
+  command: nmcli connection up {{ ib_network_nic }}
+  changed_when: false
+  when: ib_switch_support

+ 4 - 0
control_plane/roles/control_plane_common/tasks/main.yml

@@ -30,6 +30,10 @@
   
 - name: Basic configuration
   import_tasks: fetch_base_inputs.yml
+  
+- name: Routing configurations
+  import_tasks: ip_metric.yml
+  tags: init
 
 - name: Omnia inputs validation
   import_tasks: verify_omnia_params.yml

+ 6 - 0
control_plane/roles/control_plane_common/vars/main.yml

@@ -179,6 +179,12 @@ fail_device_config: "Failed. Give a valid value in device_config_support"
 device_ip_list_not_supported: "[Warning] Device_ip_list is invalid as minimum idrac_support should be true"
 mgmnt_device_fail: "Failed. Container already present. Either delete the container or make device_config_support as true"
 
+# Usage: ip_metric.yml
+public_metric: 101
+mngmnt_metric: 102
+host_metric: 103
+ib_metric: 150
+
 # Usage: device_config_validations
 success_msg_ib: "Infiniband variables validated"
 fail_msg_ib: "Failed. Please provide all the InfiniBand related parameters in base_vars.yml"

+ 5 - 0
control_plane/roles/control_plane_device/files/inventory_creation.yml

@@ -17,6 +17,11 @@
   connection: local
   gather_facts: false
   tasks:
+    - name: Install python-netaddr
+      package:
+        name: py3-netaddr
+        state: present  
+  
     - name: Read dhcp file
       set_fact:
         var: "{{ lookup('file', '/var/lib/dhcp/dhcpd.leases').split()| unique | select| list }}"