]> git.apps.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
firmware: Add Areca RAID controller support
authorDavid Galloway <dgallowa@redhat.com>
Fri, 14 Oct 2016 19:37:18 +0000 (15:37 -0400)
committerDavid Galloway <dgallowa@redhat.com>
Tue, 8 Nov 2016 17:43:39 +0000 (12:43 -0500)
Signed-off-by: David Galloway <dgallowa@redhat.com>
roles/firmware/defaults/main.yml
roles/firmware/tasks/areca/areca-update.yml [new file with mode: 0644]
roles/firmware/tasks/areca/main.yml [new file with mode: 0644]
roles/firmware/tasks/main.yml

index 5897fbfd43e85db828edbf5045adb3691371e4e8..8f6f13b1baeec5973c7c6faed9cb4572eb7ed09a 100644 (file)
@@ -6,4 +6,6 @@ latest_bmc_version: null
 
 flashrom_location: "http://download.flashrom.org/releases/flashrom-0.9.9.tar.bz2"
 
+areca_download_location: null
+
 firmware_update_path: "/home/{{ ansible_user }}/firmware-update"
diff --git a/roles/firmware/tasks/areca/areca-update.yml b/roles/firmware/tasks/areca/areca-update.yml
new file mode 100644 (file)
index 0000000..2078d87
--- /dev/null
@@ -0,0 +1,27 @@
+---
+# This file is only called when current_areca_version
+# and latest_{{ areca_model_pretty }}_version do not match
+
+- name: Install Unzip
+  package:
+    name: unzip
+    state: latest
+
+- name: Create Areca update working directory structure
+  file:
+    path: "{{ firmware_update_path }}/areca-update"
+    state: directory
+
+# Download Areca zip archive and name it something we can consume reliably
+- name: Download Areca firmware
+  get_url:
+    url: "{{ areca_download_location }}/{{ areca_model.stdout }}.zip"
+    dest: "{{ firmware_update_path }}/areca-update/areca.zip"
+    force: yes
+
+# Only extract the binary blobs and don't recreate dir structure
+- name: Unzip Areca firmware archive
+  shell: "cd {{ firmware_update_path }}/areca-update && unzip -j areca.zip *.BIN"
+
+- name: Flash Areca firmware
+  shell: "for file in $(ls {{ firmware_update_path }}/areca-update/*.BIN); do cli64 sys updatefw path=$file; done"
diff --git a/roles/firmware/tasks/areca/main.yml b/roles/firmware/tasks/areca/main.yml
new file mode 100644 (file)
index 0000000..8bf9e9a
--- /dev/null
@@ -0,0 +1,34 @@
+---
+- name: Check for Areca devices
+  shell: "lspci | grep -q -i areca"
+  register: lspci_output
+#  ignore_errors: true
+  failed_when: False
+
+- name: Determine Areca RAID Controller Model
+  shell: "cli64 sys info | grep 'Controller Name' | awk '{ print $4 }'"
+  register: areca_model
+  when: "lspci_output.rc == 0"
+
+- name: Set areca_model_pretty var
+  set_fact:
+    areca_model_pretty: "{{ areca_model.stdout|lower|replace('-', '') }}"
+  when: "lspci_output.rc == 0"
+
+- name: Determine current Areca firmware version
+  shell: "cli64 sys info | grep 'Firmware Version' | awk '{ print $4 }'"
+  register: current_areca_version
+  when: "lspci_output.rc == 0"
+
+# We have Areca 1222 and 1880 covered.  If any other models exist, the 'when'
+# statement will gracefully allow the rest of this playbook to be skipped.
+- name: Determine if Areca firmware update needed
+  set_fact:
+    need_areca_update: true
+  when: current_areca_version is defined and
+        latest_{{ areca_model_pretty }}_version is defined and
+        (current_areca_version.stdout != latest_{{ areca_model_pretty }}_version)
+
+- name: Run Areca firmware update playbook
+  include: roles/firmware/tasks/areca/areca-update.yml
+  when: need_areca_update is defined and need_areca_update == true
index a3bb2e8d7bc84fd25847d11759aa7e8a76cfc50e..fe7f71feb0f42f7b144f14ea49c3be700a71bfcc 100644 (file)
@@ -9,6 +9,10 @@
     - bmc
   when: '"mira" in ansible_hostname'
 
+- include: areca/main.yml
+  tags:
+    - areca
+
 # This won't get run if a previous playbook fails.  So if a backup of a BIOS is
 # needed to restore, it'll still be there
 - name: Clean up firmware update directory