]> git.apps.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
firmware: Add NVMe firmware update support for smithi
authorDavid Galloway <dgallowa@redhat.com>
Thu, 3 Nov 2016 20:43:19 +0000 (16:43 -0400)
committerDavid Galloway <dgallowa@redhat.com>
Tue, 8 Nov 2016 17:43:41 +0000 (12:43 -0500)
Signed-off-by: David Galloway <dgallowa@redhat.com>
roles/firmware/tasks/main.yml
roles/firmware/tasks/smithi/nvme.yml [new file with mode: 0644]

index 8215db7b3530a9e9a1d16bc08913ae94d91fea6d..c679df4433d997107555192109829b646defe658 100644 (file)
     - bmc
   when: '"smithi" in ansible_hostname'
 
+# NVMe firmware flashing is only supported on RHEL/CentOS
+- include: smithi/nvme.yml
+  tags:
+    - nvme
+  when: '"smithi" in ansible_hostname and ansible_pkg_mgr == "yum"'
+
 # 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
diff --git a/roles/firmware/tasks/smithi/nvme.yml b/roles/firmware/tasks/smithi/nvme.yml
new file mode 100644 (file)
index 0000000..60bd3ba
--- /dev/null
@@ -0,0 +1,29 @@
+---
+- name: Install Intel SSD Data Center Tool
+  yum:
+    name: "{{ nvme_firmware_package }}"
+    state: present
+
+# This will gather a list of serial numbers in case there are multiple NVMe drives.
+- name: Gather list of NVMe device serial numbers
+  shell: isdct show -d SerialNumber -intelssd | grep SerialNumber | awk '{ print $3 }'
+  register: nvme_serial_list_raw
+
+- name: Store ansible-friendly list of NVMe device Serial Numbers
+  set_fact:
+    nvme_device_list: "{{ nvme_serial_list_raw.stdout.split('\n') }}"
+
+# Despite the -force flag, this command won't flash firmware on a device that
+# already has the latest firmware.  It'll just return 3 as the exit code.
+# Ansible fails a task with an rc of 3 hence the added failed_when logic.
+# A successful firmware update return code is 0.
+- name: Update each NVMe device's firmware
+  shell: "isdct load -force -intelssd {{ item }}"
+  with_items: "{{ nvme_device_list|default([]) }}"
+  register: nvme_update_output
+  failed_when: "'Error' in nvme_update_output.stdout"
+  changed_when: nvme_update_output.rc == 0
+
+# Print firmware flash output
+# Syntax discovered here: https://github.com/ansible/ansible/issues/5564
+- debug: var=nvme_update_output.results|map(attribute='stdout_lines')|list