Pārlūkot izejas kodu

Merge branch 'devel' into devel

Lucas A. Wilson 3 gadi atpakaļ
vecāks
revīzija
0f2933c5e7

+ 12 - 1
.all-contributorsrc

@@ -122,7 +122,8 @@
       "avatar_url": "https://avatars.githubusercontent.com/u/73212230?v=4",
       "profile": "https://github.com/abhishek-s-a",
       "contributions": [
-        "code"
+        "code",
+        "doc"
       ]
     },
     {
@@ -253,6 +254,16 @@
         "code",
         "test"
       ]
+    },
+    {
+      "login": "vedaprakashanp",
+      "name": "vedaprakashanp",
+      "avatar_url": "https://avatars.githubusercontent.com/u/90596073?v=4",
+      "profile": "https://github.com/vedaprakashanp",
+      "contributions": [
+        "test",
+        "code"
+      ]
     }
   ],
   "contributorsPerLine": 7,

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 2 - 1
README.md


+ 10 - 0
control_plane/test/temp_scp.xml

@@ -0,0 +1,10 @@
+<SystemConfiguration>
+<Component FQDD="BIOS.Setup.1-1">    
+<Attribute Name="BootMode">Uefi</Attribute>
+<Attribute Name="PxeDev1EnDis">Enabled</Attribute>
+<Attribute Name="SysProfile">PerfOptimized</Attribute>
+</Component>
+<Component FQDD="iDRAC.Embedded.1">
+<Attribute Name="SNMPAlert.1#State">Enabled</Attribute>
+</Component>
+</SystemConfiguration>

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1395 - 0
control_plane/test/test_idrac.yml


+ 2 - 0
control_plane/test/test_idrac_inventory

@@ -0,0 +1,2 @@
+[all]
+10.10.10.10

+ 197 - 0
control_plane/test/test_idrac_validation.yml

@@ -0,0 +1,197 @@
+#  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.
+---  
+- block: 
+
+   - name: Include idrac vars
+     include_vars: "../input_params/idrac_vars.yml"
+  
+   - name: Export SCP configuration to local file
+     idrac_server_config_profile:
+      idrac_ip: "{{ inventory_hostname }}"
+      idrac_user: "{{ idrac_username }}"
+      idrac_password: "{{ idrac_password }}"
+      share_name: "{{ playbook_dir }}"
+      command: "export"
+      scp_file: "{{ inventory_hostname }}_scp.xml"
+      job_wait: true
+     run_once: true
+         
+   - name: Fetch the SCP configuration
+     command: cat "{{ inventory_hostname }}_scp.xml"
+     register: config_file
+           
+   - name: Testcase to verify the boot mode
+     assert:
+      that: 
+        - config_file.stdout | regex_search( bootmode_regex1 )
+      fail_msg: " {{ bootmode_check_fail_msg }}"
+      success_msg: "{{ bootmode_check_success_msg }}"
+     ignore_errors: true
+         
+   - name: Testcase to verify the SNMP configuration
+     assert:
+      that: 
+       - config_file.stdout | regex_search(snmp_regex1)
+      fail_msg: " {{ snmp_check_fail_msg }}"
+      success_msg: "{{ snmp_check_success_msg }}"
+     ignore_errors: true
+     
+   - name: Testcase to verify the system profile value Performance
+     assert:
+      that: 
+       - config_file.stdout | regex_search(sysprofile_regex1)
+      fail_msg: " {{ sysprofile_check_fail_msg }}"
+      success_msg: "{{ sysprofile_check_success_msg }}"
+     ignore_errors: true
+     when: idrac_system_profile == sysprofile_value1
+          
+   - name: Testcase to verify the system profile value PerformancePerWatt(DAPC)
+     assert:
+      that: 
+       - config_file.stdout | regex_search(sysprofile_regex2)
+      fail_msg: " {{ sysprofile_check_fail_msg }}"
+      success_msg: "{{ sysprofile_check_success_msg }}"
+     ignore_errors: true
+     when: idrac_system_profile == sysprofile_value2
+
+   - name: Testcase to verify the system profile value WorkstationPerformance
+     assert:
+      that: 
+       - config_file.stdout | regex_search(sysprofile_regex3)
+      fail_msg: " {{ sysprofile_check_fail_msg }}"
+      success_msg: "{{ sysprofile_check_success_msg }}"
+     ignore_errors: true
+     when: idrac_system_profile == sysprofile_value3
+
+   - name: Testcase to verify the system profile value PerformancePerWatt(OS)
+     assert:
+      that: 
+       - config_file.stdout | regex_search(sysprofile_regex4)
+      fail_msg: " {{ sysprofile_check_fail_msg }}"
+      success_msg: "{{ sysprofile_check_success_msg }}"
+     ignore_errors: true
+     when: idrac_system_profile == sysprofile_value4  
+
+   - name: Testcase to verify the pxe device status
+     assert:
+      that: 
+       - config_file.stdout | regex_search(pxedevice)
+      fail_msg: " {{ pxedevice_check_fail_msg }}"
+      success_msg: "{{ pxedevice_check_success_msg }}"
+     ignore_errors: true
+     when: not (enterprise_license or datacenter_license)
+     
+   - name: Initialized RAID status
+     set_fact:
+       raid_type: false
+               
+   - name: Get iDRAC info details
+     idrac_system_info:
+      idrac_ip: "{{ inventory_hostname }}"
+      idrac_user: "{{ idrac_username }}"
+      idrac_password: "{{ idrac_password }}"
+     register: idrac_info 
+
+   - name: Set RAID status
+     set_fact:
+       raid_type: true
+     with_items: "{{ idrac_info.system_info.Controller }}"
+     loop_control:
+       index_var: my_idx3
+     when: '"RAID" in idrac_info.system_info.ControllerSensor[my_idx3].FQDD'
+                
+   - name: Testcase to verify virtual disk creation status
+     assert:
+      that:
+       - " 'omnia_vd' in idrac_info.system_info.VirtualDisk[0].Name "
+      fail_msg: "{{ vd_fail_msg }}"
+      success_msg: " {{ vd_success_msg }}"
+     ignore_errors: true
+     when: raid_type
+
+   - name: Execute get pods command
+     command: "kubectl get pods -n {{ awx_namespace }}"
+     changed_when: true
+     register: k8s_pods
+     ignore_errors: true
+     run_once: true
+     
+   - name: Get awx pod 
+     set_fact:
+      awx_pods: "{{ item | regex_search(awx_pod_regex) | trim  }}"
+     with_items: 
+       - "{{ k8s_pods.stdout_lines }}"
+     run_once: true
+     ignore_errors: true
+     when: item | regex_search(awx_pod_item_regex)
+
+   - name: Get awx cluster ip
+     shell: "kubectl get svc awx-ui -n {{ awx_namespace }} -o jsonpath='{.spec.clusterIP}'"
+     register: awx_cluster_ip
+     changed_when: false
+     ignore_errors: true
+
+   - name: Get AWX admin password
+     shell: "kubectl get secret awx-admin-password -n {{ awx_namespace }} -o jsonpath='{.data.password}' | base64 --decode"
+     register: awx_admin_password
+     changed_when: false
+     ignore_errors: true
+          
+   - name: Execute awx get inventory hosts command
+     shell: "awx --conf.host http://{{ awx_cluster_ip.stdout }}:8052 --conf.username admin --conf.password {{ awx_admin_password.stdout }} --conf.insecure hosts list --inventory {{ provisioned_inventory_name }} -f human --filter 'name'"
+     changed_when: true
+     register: idrac_hosts
+     run_once: true
+     ignore_errors: true
+               
+   - name: Testcase to verify IP added to provisioned_idrac_inventory
+     assert:
+      that: 
+        - idrac_hosts.stdout | regex_search( inventory_hostname )
+      fail_msg: "{{ provisioned_ip_fail_msg }}"
+      success_msg: "{{ provisioned_ip_success_msg }}"
+     ignore_errors: true 
+          
+   - name: Update firmware
+     idrac_firmware:
+      idrac_ip: "{{ inventory_hostname }}"
+      idrac_user: "{{ idrac_username }}"
+      idrac_password: "{{ idrac_password }}"
+      share_name: "/var/nfs_repo/dellupdates"
+      reboot: false
+      job_wait: true
+      apply_update: False
+      catalog_file_name: "Catalog.xml"
+     register: idrac_firmware
+     when: firmware_update_required
+
+   - name: Checking firmware update status
+     assert:
+      that:
+        - idrac_firmware.msg in firmware_status
+      fail_msg: "{{ firmware_fail_msg }}"
+      success_msg: "{{ firmware_success_msg }}"
+     ignore_errors: true
+     when: firmware_update_required  
+     
+   - name: Remove the scp file
+     file:
+       path: "{{ inventory_hostname }}_scp.xml"
+       state: absent
+     run_once: true             
+      
+  rescue:
+    - debug:
+       msg: "{{ failed_msg }}"

+ 75 - 0
control_plane/test/test_vars/test_idrac_vars.yml

@@ -0,0 +1,75 @@
+#  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.
+---
+
+# Usage: test_prepare.yml
+idrac_inventory_name: "test_idrac_inventory"
+template_value: 'idrac_template'
+job_name: "test_idrac_template"
+idrac_playbook_path: "control_plane/idrac.yml"
+tower_config_file_path: "../roles/webui_awx/files/.tower_cli.cfg"
+tower_vault_file_path: "../roles/webui_awx/files/.tower_vault_key"
+file_perm: '0644'
+
+# Usage: test_idrac.yml
+validation_script_path: "test_idrac_validation.yml"
+awx_script_path: "test_prepare.yml"
+temp_scp_path: "temp_scp.xml"
+idrac_var_path: "../input_params/idrac_vars.yml"
+login_vars_path: "../input_params/login_vars.yml"
+login_vars_vault_path: "../input_params/.login_vault_key"
+vd_name: "omnia_vd"
+bootmode_attr_name: 'Name="BootMode"'
+sysprofile_attr_name: 'Name="SysProfile"'
+snmp_attr_name: 'Name="SNMPAlert.1#State"'
+sysprofile: "idrac_system_profile:"
+sysprofile_params1: 'idrac_system_profile: "Performance"'
+sysprofile_params2: 'idrac_system_profile: "PerformancePerWatt(DAPC)"'
+sysprofile_params3: 'idrac_system_profile: "WorkstationPerformance"'
+sysprofile_params4: 'idrac_system_profile: "PerformancePerWatt(OS)"'
+sysprofile_value1: "Performance"
+sysprofile_value2: "PerformancePerWatt(DAPC)"
+sysprofile_value3: "WorkstationPerformance"
+sysprofile_value4: "PerformancePerWatt(OS)"
+
+# Usage: test_idrac_validation.yml
+provisioned_inventory_name: "provisioned_idrac_inventory"
+awx_namespace: "awx"
+awx_pod_regex: 'awx-([A-Za-z0-9]{10})-([A-Za-z0-9]{5})'
+awx_pod_item_regex: "awx-([A-Za-z0-9]{10})-([A-Za-z0-9]{5})"
+bootmode_regex1: '<Attribute Name="BootMode">Uefi</Attribute>'
+bootmode_regex2: '<Attribute Name="BootMode">Bios</Attribute>'
+snmp_regex1: '<Attribute Name="SNMPAlert.1#State">Enabled</Attribute>'
+snmp_regex2: '<Attribute Name="SNMPAlert.1#State">Disabled</Attribute>'
+sysprofile_regex1: '<Attribute Name="SysProfile">PerfOptimized</Attribute>'
+sysprofile_regex2: '<Attribute Name="SysProfile">PerfPerWattOptimizedDapc</Attribute>'
+sysprofile_regex3: '<Attribute Name="SysProfile">PerfWorkStationOptimized</Attribute>'
+sysprofile_regex4: '<Attribute Name="SysProfile">PerfPerWattOptimizedOs</Attribute>'
+pxedevice: '<Attribute Name="PxeDev1EnDis">Enabled</Attribute>'
+firmware_status: "The catalog in the repository specified in the operation has the same firmware versions as currently present on the server."
+bootmode_check_fail_msg: "Boot mode configuration is failed"
+bootmode_check_success_msg: "Boot mode configuration is successful"
+snmp_check_fail_msg: "SNMP configuration failed"
+snmp_check_success_msg: "SNMP configuration is successful"
+sysprofile_check_fail_msg: "System profile configuration failed"
+sysprofile_check_success_msg: "System profile configuration is successful"
+pxedevice_check_fail_msg: "Pxe device configuration is failed"
+pxedevice_check_success_msg: "Pxe device configuration is successful"
+vd_success_msg: "Virtual disk created successfully"
+vd_fail_msg: "Virtual disk is not present"
+provisioned_ip_success_msg: "IP added to provisioned_idrac_inventory  is successfully"
+provisioned_ip_fail_msg: "IP is not added to provisioned_idrac_inventory"
+failed_msg: "Failed. Please check input parameters and try again!"
+firmware_fail_msg: "Firmware update is failed"
+firmware_success_msg: "Firmware updated is success"

+ 2 - 1
roles/login_server/tasks/install_packages.yml

@@ -24,6 +24,7 @@
     src: "{{ resolv_conf_path }}"
     dest: "{{ temp_resolv_conf_path }}"
     mode: "{{ resolv_file_mode }}"
+    remote_src: yes
 
 - name: Add the domain name in /etc/resolv.conf
   replace:
@@ -39,4 +40,4 @@
     regexp: "# Generated by NetworkManager"
     replace: "# Generated by NetworkManager\nsearch {{ hostvars['127.0.0.1']['domain_name'] }}"
   when:
-    replace_output.msg | length == 0
+    replace_output.msg | length == 0

+ 8 - 2
roles/slurm_workers/tasks/main.yml

@@ -1,4 +1,4 @@
-#  Copyright 2020 Dell Inc. or its subsidiaries. All Rights Reserved.
+#  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.
@@ -114,6 +114,9 @@
   with_items:
     - "{{ groups['compute'] }}"
   when: '"compute" in group_names'
+  delegate_to: "{{ item }}"
+  with_items:
+    - "{{ play_hosts }}"
 
 - name: Add login node core & socket info in slurm config file
   lineinfile:
@@ -127,6 +130,9 @@
   when:
     - hostvars["127.0.0.1"]["login_node_required"]
     - '"login_node" in group_names'
+  delegate_to: "{{ item }}"
+  with_items:
+    - "{{ play_hosts }}"
 
 - name: Update hostnames of compute node when ALL in partition nodes
   replace:
@@ -152,4 +158,4 @@
   fetch:
     src: "{{ slurm_confpth }}"
     dest: "{{ buffer_path }}"
-    flat: true
+    flat: true