Przeglądaj źródła

Merge pull request #541 from Shubhangi-dell/infiniband

Issue #537:Change the container base image of infiniband container from Centos 7 to Centos 8
Lucas A. Wilson 3 lat temu
rodzic
commit
bd1df05f14

+ 8 - 0
control_plane/input_params/base_vars.yml

@@ -88,6 +88,14 @@ language: "en-US"
 # Mandatory value required
 iso_file_path: "/root/CentOS-7-x86_64-Minimal-2009.iso"
 
+# Default lease time that will be used by dhcp
+# Its unit is seconds
+# Min: 21600 seconds
+# Default: 86400 seconds
+# Max: 31536000 seconds
+# Mandatory value required
+default_lease_time: "86400"
+
 ### Usage: control_plane_device ###
 
 # The nic/ethernet card that needs to be connected to provision 

+ 6 - 11
control_plane/roles/control_plane_ib/files/Dockerfile

@@ -1,21 +1,17 @@
 # Dockerfile for creating the management network container
 
-FROM centos:7
+FROM centos:8
 
 # RPM REPOs
-RUN yum install -y \
+RUN dnf install -y \
     epel-release \
-    && yum clean all \
-    && rm -rf /var/cache/yum
-
-RUN yum update -y \
-    && yum clean all \
-    && rm -rf /var/cache/yum
+    && dnf clean all \
+    && rm -rf /var/cache/dnf
 
+RUN dnf install dhcp-server -y
 RUN yum install -y \
   ansible \
   cronie \
-  dhcp \
   net-tools \
   && yum clean all \
   &&  rm -rf /var/cache/yum
@@ -24,8 +20,7 @@ RUN mkdir /root/omnia
 
 #Copy Configuration files
 COPY dhcpd.conf  /etc/dhcp/dhcpd.conf
-#COPY mngmnt_container_configure.yml /root/
 
 RUN systemctl enable dhcpd
 
-CMD ["sbin/init"]
+CMD ["sbin/init"]

+ 0 - 48
control_plane/roles/control_plane_ib/files/dhcpd.conf

@@ -1,48 +0,0 @@
-
-# ******************************************************************
-# Cobbler managed dhcpd.conf file
-#
-# generated from cobbler dhcp.conf template ($date)
-# Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes
-# in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be
-# overwritten.
-#
-# ******************************************************************
-
-ddns-update-style interim;
-
-allow booting;
-allow bootp;
-
-ignore client-updates;
-set vendorclass = option vendor-class-identifier;
-
-option pxe-system-type code 93 = unsigned integer 16;
-
-subnet 172.25.0.0 netmask 255.255.0.0 {
-option subnet-mask 255.255.0.0;
-range dynamic-bootp 172.25.0.10 172.25.0.100;
-default-lease-time  21600;
-max-lease-time  43200;
-next-server 172.25.0.1;
-#insert the static DHCP leases for configuration here
-
-
-     class "pxeclients" {
-          match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
-          if option pxe-system-type = 00:02 {
-                  filename "ia64/elilo.efi";
-          } else if option pxe-system-type = 00:06 {
-                  filename "grub/grub-x86.efi";
-          } else if option pxe-system-type = 00:07 {
-                  filename "grub/grub-x86_64.efi";
-          } else if option pxe-system-type = 00:09 {
-                  filename "grub/grub-x86_64.efi";
-          } else {
-                  filename "pxelinux.0";
-          }
-     }
-
-}
-
-#end for

+ 0 - 43
control_plane/roles/control_plane_ib/files/infiniband_inventory_creation.yml

@@ -1,43 +0,0 @@
-#  Copyright 2021 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.
----
-
-- hosts: localhost
-  connection: local
-  gather_facts: false
-  tasks:
-    - name: Read dhcp file
-      set_fact:
-        var: "{{ lookup('file', '/var/lib/dhcpd/dhcpd.leases').split()| unique | select| list }}"
-
-    - name: Filter the ip
-      set_fact:
-        vars_new: "{{ var| ipv4('address')| to_nice_yaml}}"
-
-    - name: Create the static ip
-      shell: awk -F',' 'NR >1{print $3}' omnia/appliance/roles/provision/files/new_mapping_file.csv > static_hosts.yml
-      changed_when: false
-      ignore_errors: true
-
-    - name: Create the dynamic inventory
-      shell: |
-        echo "[all]" >  omnia/appliance/roles/inventory/files/provisioned_hosts.yml
-        echo "{{ vars_new }}" > temp.txt
-        egrep -o '[1-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' temp.txt >>dynamic_hosts.yml
-      changed_when: false
-      ignore_errors: true
-
-    - name: Final inventory
-      shell: cat dynamic_hosts.yml static_hosts.yml| sort -ur  >> omnia/appliance/roles/inventory/files/provisioned_hosts.yml
-      changed_when: false

+ 2 - 2
control_plane/roles/control_plane_ib/files/k8s_infiniband.yml

@@ -21,11 +21,11 @@ spec:
       volumes:
         - name: omnia-storage
           hostPath:
-            path: /home/omnia/
+            path: /root/omnia
             type: Directory
       containers:
         - name: infiniband-container
-          image: 'localhost/infiniband_container:latest'
+          image: 'localhost/infiniband-container:latest'
           imagePullPolicy: Never
           command:
             - /sbin/init

+ 2 - 2
control_plane/roles/control_plane_ib/files/temp_dhcp.template

@@ -22,8 +22,8 @@ option pxe-system-type code 93 = unsigned integer 16;
 subnet subnet_mask netmask net_mask {
 option subnet-mask net_mask;
 range dynamic-bootp start end;
-default-lease-time  21600;
-max-lease-time  43200;
+default-lease-time 26100;
+max-lease-time 43200;
 next-server next_server;
 #insert the static DHCP leases for configuration here
 

+ 4 - 10
control_plane/roles/control_plane_ib/tasks/check_prerequisites.yml

@@ -32,7 +32,7 @@
   - name: Set status for backup file
     set_fact:
       infiniband_backup_map_status: true
-    when: infiniband_backup_map.stat.exists == true  
+    when: infiniband_backup_map.stat.exists 
   rescue:
   - name: Message
     debug:
@@ -42,14 +42,14 @@
 - name: Inspect the infiniband_container image
   command: "buildah images {{ infiniband_image_name }}"
   register: infiniband_container_image_result
-  ignore_errors: true
+  failed_when: false
   changed_when: false
   tags: install
 
 - name: Check infiniband_container status on the machine
   command: kubectl get pods -n network-config
   register: infiniband_container_result
-  ignore_errors: true
+  failed_when: false
   changed_when: false
   tags: install
 
@@ -63,10 +63,4 @@
   set_fact:
     infiniband_container_status: true
   when: "'infiniband-container' in infiniband_container_result.stdout"
-  tags: install
-
-- name: Update infiniband_container  status
-  set_fact:
-    infiniband_container_config_status: true
-  when:
-    - infiniband_container_status == true
+  tags: install

+ 2 - 2
control_plane/roles/control_plane_ib/tasks/configure_infiniband_container.yml

@@ -17,13 +17,13 @@
   command: kubectl get pods -n network-config
   changed_when: false
   register: infiniband_pod_status
-  ignore_errors: true
+  failed_when: false
 
 - name: Deploy infiniband pod
   command: "kubectl apply -f {{ role_path }}/files/k8s_infiniband.yml"
   changed_when: true
   tags: install
-  when: infiniband_container_status == true and  infiniband_container_config_status == false
+  when: infiniband_container_status and  (not infiniband_container_config_status)
 
 - name: Wait for infiniband pod to come to ready state
   command: kubectl wait --for=condition=ready -n network-config pod -l app=infiniband

+ 1 - 1
control_plane/roles/control_plane_ib/tasks/dhcp_configure.yml

@@ -43,4 +43,4 @@
   replace:
     path: "{{ role_path }}/files/dhcpd.conf"
     regexp: '^next-server next_server;'
-    replace: 'next-server {{ ib_ip }};'
+    replace: 'next-server {{ ib_ip }};'

+ 3 - 8
control_plane/roles/control_plane_ib/tasks/main.yml

@@ -14,7 +14,7 @@
 ---
 
 # Tasks file for infiniband
-
+-
 - name: Check if IB switch is supported
   block:
     - name: Check infiniband_container status on machine
@@ -29,15 +29,11 @@
       when: not infiniband_container_status
 
     - name: Include variable file base_vars.yml
-      include_vars: "{{ base_file }}"
+      include_vars: ../../../input_params/base_vars.yml
 
     - name: Dhcp Configuration
       import_tasks: dhcp_configure.yml
-      when: (not infiniband_container_image_status) or ( infiniband_backup_map_status == true)
-
-    #- name: Mapping file validation
-    #  import_tasks: mapping_file.yml
-    #  when: (not infiniband_container_image_status) and (mapping_file == true) or ( backup_map_status == true)
+      when: (not infiniband_container_image_status)
 
     - name: infiniband_container image creation
       import_tasks: infiniband_container_image.yml
@@ -57,5 +53,4 @@
             verbosity: 2
           when: not infiniband_container_status
       tags: install
-
   when: ib_switch_support

+ 0 - 1
control_plane/roles/control_plane_ib/vars/main.yml

@@ -21,4 +21,3 @@ infiniband_image_tag: latest
 mount_path: /root/omnia
 infiniband_message_skipped: "The container is already present"
 infiniband_message_installed: "The container is installed"
-ib_base_file: "{{ role_path }}/../../input_params/base_vars.yml" 

+ 2 - 2
control_plane/roles/powervault_me4/tasks/volume.yml

@@ -67,7 +67,7 @@
   fail:
     msg: "{{ pv_disk2.json.status[0].response }}"
   when:
-    - powervault_me4_pool_typ|lower e== "linear"
+    - powervault_me4_pool_type|lower == "linear"
     - pv_disk2.json.status[0] ['response-type'] == "Error"
 
 - name: Create volume1
@@ -148,4 +148,4 @@
     msg: "{{ pv_vol4.json.status[0].response }}"
   when:
     - powervault_me4_pool_type|lower == "linear"
-    - pv_vol4.json.status[0]['response-type'] == "Error"
+    - pv_vol4.json.status[0]['response-type'] == "Error"