From 49999e99f0d4fef993bd0bc4cb7df15857fd8c7b Mon Sep 17 00:00:00 2001 From: akrzos Date: Tue, 27 Feb 2018 11:00:03 -0500 Subject: [PATCH] Adjust Microcode via rpm Change-Id: I38ceb1601910a21e541a6b670953d059674f189d --- ansible/browbeat/adjust-microcode-rpm.yml | 87 +++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 ansible/browbeat/adjust-microcode-rpm.yml diff --git a/ansible/browbeat/adjust-microcode-rpm.yml b/ansible/browbeat/adjust-microcode-rpm.yml new file mode 100644 index 000000000..083febb2e --- /dev/null +++ b/ansible/browbeat/adjust-microcode-rpm.yml @@ -0,0 +1,87 @@ +--- +# +# Playbook to push new microcode via an rpm. Please read playbook before running. +# +# Examples: +# +# Update microcode on Overcloud: +# ansible-playbook -i hosts browbeat/adjust-microcode-rpm.yml -e 'rpm_url=http://example.com.com/microcode.rpm' +# +# Update microcode on Controllers +# ansible-playbook -i hosts browbeat/adjust-microcode-rpm.yml -e 'target=controller rpm_url=http://example.com.com/microcode.rpm'' +# +# "target" can be any of the typical groups or a specific host in the hosts file +# Set rpm_url to the url of a webserver serveing the micrcode rpm +# + +- hosts: "{{target|default('overcloud')}}" + gather_facts: true + remote_user: "{{ host_remote_user }}" + vars: + rpm_url: http://example.com.com/microcode.rpm' + vars_files: + - ../install/group_vars/all.yml + tasks: + + - name: Get Microcode RPM + become: true + get_url: + url: "{{rpm_url}}" + dest: /root/{{rpm_url|basename}} + force: true + + - name: Install Microcode RPM + become: true + yum: + name: /root/{{rpm_url|basename}} + state: present + + - name: Attempt graceful reboot + become: true + shell: nohup sh -c '( sleep 5 ; reboot )' & + async: 0 + poll: 0 + ignore_errors: true + + # 8 minute timeout + - name: Wait for Machine Ready (1st try) + wait_for: + host: "{{ansible_default_ipv4.address}}" + port: 22 + delay: 15 + timeout: 480 + delegate_to: undercloud + remote_user: "{{local_remote_user}}" + register: machine_rebooted + ignore_errors: true + + # "Rescue" the node + - name: Use Ironic to start each machine + shell: | + . /home/stack/stackrc + openstack baremetal node power off {{ironic_uuid}} + sleep 30 + openstack baremetal node power on {{ironic_uuid}} + delegate_to: undercloud + remote_user: "{{local_remote_user}}" + when: machine_rebooted.failed + + - name: Wait for Machine Ready (2nd try) + wait_for: + host: "{{ansible_default_ipv4.address}}" + port: 22 + delay: 15 + timeout: 480 + delegate_to: undercloud + remote_user: "{{local_remote_user}}" + when: machine_rebooted.failed + + - name: Check if Feat available + become: true + command: grep "FEATURE" /var/log/dmesg + ignore_errors: true + register: check_feat + + - name: Debug print results of Feature Grep in dmesg + debug: + msg: "{{check_feat.stdout_lines}}"