]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
firmware: Add BMC update support for smithi
authorDavid Galloway <dgallowa@redhat.com>
Fri, 14 Oct 2016 20:28:55 +0000 (16:28 -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/bmc-update.yml [new file with mode: 0644]
roles/firmware/tasks/smithi/bmc.yml [new file with mode: 0644]

index fe7f71feb0f42f7b144f14ea49c3be700a71bfcc..8215db7b3530a9e9a1d16bc08913ae94d91fea6d 100644 (file)
   tags:
     - areca
 
+- include: smithi/bmc.yml
+  tags:
+    - bmc
+  when: '"smithi" in ansible_hostname'
+
 # 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/bmc-update.yml b/roles/firmware/tasks/smithi/bmc-update.yml
new file mode 100644 (file)
index 0000000..77e0613
--- /dev/null
@@ -0,0 +1,31 @@
+---
+# This file is only called when current_bmc_version
+# and latest_bmc_version do not match
+
+- name: Install unzip
+  package:
+    name: unzip
+    state: latest
+
+- name: Create BMC update working directory structure
+  file:
+    path: "{{ firmware_update_path }}/bmc-update"
+    state: directory
+
+# Download the archive and rename to something the playbook can consume
+- name: Download BMC archive
+  get_url:
+    url: "{{ bmc_location }}"
+    dest: "{{ firmware_update_path }}/bmc-update/bmc.zip"
+    force: yes
+
+# Extract only the binary blob and the Linux flashing executable
+- name: Extract IPMI archive
+  shell: "cd {{ firmware_update_path }}/bmc-update && unzip -j bmc.zip *.bin */linux/x64/AlUpdate"
+
+- name: Flash new BMC (Takes around 11 minutes)
+  shell: "cd {{ firmware_update_path }}/bmc-update && chmod +x AlUpdate && ./AlUpdate -f *.bin -i kcs -r y"
+  register: bmc_flash_output
+
+# Print output of flash script
+- debug: var=bmc_flash_output.stdout_lines|last
diff --git a/roles/firmware/tasks/smithi/bmc.yml b/roles/firmware/tasks/smithi/bmc.yml
new file mode 100644 (file)
index 0000000..e733de4
--- /dev/null
@@ -0,0 +1,27 @@
+---
+- name: Install ipmitool
+  package:
+    name: ipmitool
+    state: latest
+
+- name: Enable IPMI kernel modules
+  modprobe:
+    name: "{{ item }}"
+    state: present
+  with_items:
+    - ipmi_devintf
+    - ipmi_si
+
+- name: Determine current BMC firmware version
+  shell: ipmitool mc info | grep "Firmware Revision" | awk '{ print $4 }'
+  register: current_bmc_version
+  changed_when: False
+
+- name: Determine if BMC update is needed
+  set_fact:
+    need_bmc_update: true
+  when: current_bmc_version.stdout != latest_bmc_version
+
+- name: Include BMC update logic
+  include: roles/firmware/tasks/smithi/bmc-update.yml
+  when: need_bmc_update is defined and need_bmc_update == true