Browse Source

Merge pull request #432 from blesson-james/devel

Offline repo creation for iDRAC firmware updates
Lucas A. Wilson 3 years ago
parent
commit
ddb118a32a
28 changed files with 178 additions and 15 deletions
  1. 2 2
      control_plane/control_plane.yml
  2. 4 1
      control_plane/roles/control_plane_common/tasks/main.yml
  3. 0 0
      control_plane/roles/control_plane_common/tasks/nfs_server_setup.yml
  4. 11 1
      control_plane/roles/control_plane_common/vars/main.yml
  5. 1 0
      control_plane/roles/control_plane_repo/files/C4140_inv.xml
  6. 1 0
      control_plane/roles/control_plane_repo/files/C6420_inv.xml
  7. 1 0
      control_plane/roles/control_plane_repo/files/C6520_inv.xml
  8. 1 0
      control_plane/roles/control_plane_repo/files/R240_inv.xml
  9. 1 0
      control_plane/roles/control_plane_repo/files/R340_inv.xml
  10. 1 0
      control_plane/roles/control_plane_repo/files/R430_inv.xml
  11. 1 0
      control_plane/roles/control_plane_repo/files/R440_inv.xml
  12. 1 0
      control_plane/roles/control_plane_repo/files/R540_inv.xml
  13. 1 0
      control_plane/roles/control_plane_repo/files/R640_inv.xml
  14. 1 0
      control_plane/roles/control_plane_repo/files/R650_inv.xml
  15. 1 0
      control_plane/roles/control_plane_repo/files/R740_inv.xml
  16. 1 0
      control_plane/roles/control_plane_repo/files/R740xd2_inv.xml
  17. 1 0
      control_plane/roles/control_plane_repo/files/R740xd_inv.xml
  18. 1 0
      control_plane/roles/control_plane_repo/files/R750_inv.xml
  19. 1 0
      control_plane/roles/control_plane_repo/files/R750xa_inv.xml
  20. 1 0
      control_plane/roles/control_plane_repo/files/R840_inv.xml
  21. 1 0
      control_plane/roles/control_plane_repo/files/R940_inv.xml
  22. 1 0
      control_plane/roles/control_plane_repo/files/R940xa_inv.xml
  23. 18 0
      control_plane/roles/control_plane_repo/files/poweredge_models.txt
  24. 20 0
      control_plane/roles/control_plane_repo/tasks/download_fmw_updates.yml
  25. 40 0
      control_plane/roles/control_plane_repo/tasks/install_dsu.yml
  26. 13 2
      control_plane/roles/control_plane_repo/tasks/main.yml
  27. 41 0
      control_plane/roles/control_plane_repo/tasks/validate_idrac_vars.yml
  28. 11 9
      control_plane/roles/control_plane_repo/vars/main.yml

+ 2 - 2
control_plane/control_plane.yml

@@ -18,11 +18,11 @@
   connection: local
   roles:
     - control_plane_common
-    - control_plane_repo
     - control_plane_k8s
     - control_plane_device
     - provision_cobbler
+    - webui_awx
     - control_plane_ib
     - control_plane_sm
     - control_plane_customiso
-    - webui_awx
+    - control_plane_repo

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

@@ -36,4 +36,7 @@
 
 - name: Subnet manager inputs validation
   import_tasks: fetch_sm_inputs.yml
-  when: ib_switch_support
+  when: ib_switch_support
+
+- name: NFS Server setup for offline repo and awx
+  import_tasks: nfs_server_setup.yml

control_plane/roles/control_plane_repo/tasks/nfs_server_setup.yml → control_plane/roles/control_plane_common/tasks/nfs_server_setup.yml


+ 11 - 1
control_plane/roles/control_plane_common/vars/main.yml

@@ -141,4 +141,14 @@ fail_msg_config_file: ib_vars.yml file doesn't exist.
 fail_msg_opensm_config_file: opensm.conf file doesn't exist.
 
 fail_msg_ib_input_definition: Infiniband config directories must be defined.
-fail_msg_ib_input: Infiniband config directories can't be left empty.
+fail_msg_ib_input: Infiniband config directories can't be left empty.
+
+# Usage: nfs_server_setup.yml
+nfs_share_offline_repo: /var/nfs_repo
+nfs_share_awx: /var/nfs_awx
+nfs_share_dir_mode: 0644
+exports_file_path: /etc/exports
+nfs_services:
+  - mountd
+  - rpc-bind
+  - nfs

File diff suppressed because it is too large
+ 1 - 0
control_plane/roles/control_plane_repo/files/C4140_inv.xml


File diff suppressed because it is too large
+ 1 - 0
control_plane/roles/control_plane_repo/files/C6420_inv.xml


File diff suppressed because it is too large
+ 1 - 0
control_plane/roles/control_plane_repo/files/C6520_inv.xml


File diff suppressed because it is too large
+ 1 - 0
control_plane/roles/control_plane_repo/files/R240_inv.xml


File diff suppressed because it is too large
+ 1 - 0
control_plane/roles/control_plane_repo/files/R340_inv.xml


File diff suppressed because it is too large
+ 1 - 0
control_plane/roles/control_plane_repo/files/R430_inv.xml


File diff suppressed because it is too large
+ 1 - 0
control_plane/roles/control_plane_repo/files/R440_inv.xml


File diff suppressed because it is too large
+ 1 - 0
control_plane/roles/control_plane_repo/files/R540_inv.xml


File diff suppressed because it is too large
+ 1 - 0
control_plane/roles/control_plane_repo/files/R640_inv.xml


File diff suppressed because it is too large
+ 1 - 0
control_plane/roles/control_plane_repo/files/R650_inv.xml


File diff suppressed because it is too large
+ 1 - 0
control_plane/roles/control_plane_repo/files/R740_inv.xml


File diff suppressed because it is too large
+ 1 - 0
control_plane/roles/control_plane_repo/files/R740xd2_inv.xml


File diff suppressed because it is too large
+ 1 - 0
control_plane/roles/control_plane_repo/files/R740xd_inv.xml


File diff suppressed because it is too large
+ 1 - 0
control_plane/roles/control_plane_repo/files/R750_inv.xml


File diff suppressed because it is too large
+ 1 - 0
control_plane/roles/control_plane_repo/files/R750xa_inv.xml


File diff suppressed because it is too large
+ 1 - 0
control_plane/roles/control_plane_repo/files/R840_inv.xml


File diff suppressed because it is too large
+ 1 - 0
control_plane/roles/control_plane_repo/files/R940_inv.xml


File diff suppressed because it is too large
+ 1 - 0
control_plane/roles/control_plane_repo/files/R940xa_inv.xml


+ 18 - 0
control_plane/roles/control_plane_repo/files/poweredge_models.txt

@@ -0,0 +1,18 @@
+C4140
+C6420
+C6520
+R240
+R340
+R430
+R440
+R540
+R640
+R650
+R740
+R740xd
+R740xd2
+R750
+R750xa
+R840
+R940
+R940xa

+ 20 - 0
control_plane/roles/control_plane_repo/tasks/download_fmw_updates.yml

@@ -0,0 +1,20 @@
+#  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.
+---
+
+- name: Downloading Firwmare Updates (This process may take few hours depending upon the poweredge_model list)
+  command: 'dsu --destination-type=REP --input-inventory-file="{{ role_path }}/files/{{ item }}_inv.xml" \
+    --destination-location="{{ nfs_share_offline_repo }}" --non-interactive'
+  with_items: "{{ poweredge_model.split(',') | map('trim') }}"
+  changed_when: true

+ 40 - 0
control_plane/roles/control_plane_repo/tasks/install_dsu.yml

@@ -0,0 +1,40 @@
+#  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.
+---
+
+- name: Creating DSU directory
+  file:
+    path: "{{ dsu_folder_dest }}"
+    state: directory
+    mode: "{{ dsu_folder_dest_mode }}"
+
+- name: Download bootstrap.cgi
+  get_url:
+    url: "{{ bootstrap_repo_url }}"
+    dest: "{{ dsu_folder_dest }}"
+  register: bootstrap_repo_result
+  until: bootstrap_repo_result is not failed
+  retries: 20
+
+- name: Execute bootstrap.cgi
+  shell: >
+    echo "y" | bash {{ dsu_folder_dest }}/bootstrap.cgi
+  changed_when: true
+  register: bootstrap_execution_result
+  failed_when: "'FAILED' in bootstrap_execution_result.stderr"
+
+- name: Install DSU
+  package:
+    name: dell-system-update
+    state: present

+ 13 - 2
control_plane/roles/control_plane_repo/tasks/main.yml

@@ -13,5 +13,16 @@
 #  limitations under the License.
 ---
 
-- name: NFS Server setup
-  import_tasks: nfs_server_setup.yml
+- name: Include common variables
+  include_vars:  ../../control_plane_common/vars/main.yml
+
+- name: Validate idrac_vars
+  include_tasks: validate_idrac_vars.yml
+
+- name: Install DSU
+  include_tasks: install_dsu.yml
+  when: firmware_update_required
+
+- name: Download iDRAC firmware updates
+  include_tasks: download_fmw_updates.yml
+  when: firmware_update_required

+ 41 - 0
control_plane/roles/control_plane_repo/tasks/validate_idrac_vars.yml

@@ -0,0 +1,41 @@
+# 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.
+---
+
+- name: Include variable file idrac_vars.yml
+  include_vars: "{{ idrac_input_filename }}"
+  run_once: true
+
+- name: Assert firmware_update_required value
+  assert:
+    that:
+      - firmware_update_required == true or firmware_update_required == false
+    success_msg: "{{ firmware_update_success_msg }}"
+    fail_msg: "{{ firmware_update_fail_msg }}"
+
+- name: Read poweredge_model file
+  command: cat {{ role_path }}/files/poweredge_models.txt
+  ignore_errors: yes
+  register: poweredge_models_file_output
+  changed_when: false
+
+- name: Assert poweredge_model value
+  assert:
+    that:
+      - item | length > 1
+      - item in poweredge_models_file_output.stdout
+    success_msg: "{{ poweredge_model_success_msg }}"
+    fail_msg: "{{ poweredge_model_fail_msg }}"
+  when: firmware_update_required
+  with_items: "{{ poweredge_model.split(',') | map('trim') }}"

+ 11 - 9
control_plane/roles/control_plane_repo/vars/main.yml

@@ -15,12 +15,14 @@
 
 # vars file for offline_repo
 
-# Usage: nfs_server_setup.yml
-nfs_share_offline_repo: /var/nfs_repo
-nfs_share_awx: /var/nfs_awx
-nfs_share_dir_mode: 0777
-exports_file_path: /etc/exports
-nfs_services:
-  - mountd
-  - rpc-bind
-  - nfs
+# Usage: validate_idrac_vars.yml
+idrac_input_filename: input_params/idrac_vars.yml
+firmware_update_success_msg: "firmware_update_required validated"
+firmware_update_fail_msg: "Failed. firmware_update_required accepts only true or false in idrac_vars.yml"
+poweredge_model_success_msg: "poweredge_model validated"
+poweredge_model_fail_msg: "Failed. poweredge_model is incorrect or unsupported. Please update the list with the supported models in the correct format"
+
+# Usage: install_dsu.yml
+dsu_folder_dest: /root/dsu
+dsu_folder_dest_mode: 0644
+bootstrap_repo_url: https://linux.dell.com/repo/hardware/dsu/bootstrap.cgi