-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
frsauvage
committed
Jul 1, 2020
1 parent
5c2b4d0
commit 8bce0fb
Showing
50 changed files
with
965 additions
and
616 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,7 +110,7 @@ | |
</div> | ||
</div> | ||
<div class="LoginModal-footer"> | ||
version: 2.0.9 | ||
version: 2.1.0 | ||
</div> | ||
</div> | ||
</div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
143 changes: 15 additions & 128 deletions
143
ansible/playbooks/openbmc/firmware/activate_firmware_update.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,148 +1,35 @@ | ||
--- | ||
- hosts: all | ||
connection: local | ||
name: Activate Firmwares | ||
connection: local | ||
gather_facts: False | ||
vars_files: | ||
- "{{ ANSIBLE_EXTERNAL_VARS }}" | ||
- "{{ ANSIBLE_PASSWORDS }}" | ||
|
||
tasks: | ||
- include_tasks: ../utils/utils_create_token.yml | ||
|
||
- name: assert forceoff variable | ||
assert: | ||
that: | ||
- forceoff is defined | ||
fail_msg: "The variable forceoff is NOT defined in inventory (AWX) or vars/external_vars file (Ansible). See readme.md for more details." | ||
success_msg: "The variable forceoff is defined" | ||
run_once: true | ||
|
||
- debug: | ||
msg: "forceoff is {{ forceoff }}" | ||
when: forceoff is defined | ||
run_once: true | ||
|
||
- name: assert reboot variable | ||
assert: | ||
that: | ||
- reboot is defined | ||
fail_msg: "The variable reboot is NOT defined in inventory (AWX) or vars/external_vars file (Ansible). See readme.md for more details." | ||
success_msg: "The variable reboot is defined" | ||
run_once: true | ||
- include_tasks: ../utils/assert_activate_variables.yml | ||
|
||
- debug: | ||
msg: "reboot is {{ reboot }}" | ||
when: reboot is defined | ||
run_once: true | ||
|
||
- name: validate activating_countdown variable | ||
assert: | ||
that: | ||
- activating_countdown is defined | ||
fail_msg: "The variable activating_countdown is NOT defined in inventory (AWX) or vars/external_vars file (Ansible). See readme.md for more details." | ||
success_msg: "The variable activating_countdown is defined" | ||
run_once: true | ||
|
||
- debug: | ||
msg: "activating_countdown is {{ activating_countdown }}" | ||
when: activating_countdown is defined | ||
run_once: true | ||
- include_tasks: ../utils/utils_create_token.yml | ||
|
||
- include_tasks: ../utils/utils_firmware_inventory.yml | ||
|
||
- name: render Ready Firmwares | ||
debug: | ||
msg: "Ready {{ item.value.Purpose }} - {{ item.value.Version }} ({{ item.key }})" | ||
when: item.value.Activation is defined and item.value.Activation == "xyz.openbmc_project.Software.Activation.Activations.Ready" | ||
with_dict: "{{ firmware_inventory }}" | ||
|
||
- name: render old Active Firmwares BEFORE activation | ||
debug: | ||
msg: "Active {{ item.value.Purpose }} - {{ item.value.Version }} ({{ item.key }})" | ||
when: item.value.Activation is defined and item.value.Activation == "xyz.openbmc_project.Software.Activation.Activations.Active" | ||
with_dict: "{{ firmware_inventory }}" | ||
- include_tasks: ../utils/should_poweroff.yml | ||
|
||
- include_tasks: ../utils/utils_active_firmware_update.yml | ||
|
||
- include_tasks: ../utils/utils_firmware_inventory.yml | ||
|
||
- name: render Requested for Active Firmwares AFTER Activation | ||
debug: | ||
msg: "Requested Activation {{ item.value.Purpose }} - {{ item.value.Version }} ({{ item.key }})" | ||
when: item.value.RequestedActivation is defined and item.value.RequestedActivation == "xyz.openbmc_project.Software.Activation.RequestedActivations.Active" | ||
with_dict: "{{ firmware_inventory }}" | ||
- include_tasks: ../utils/should_reboot.yml | ||
|
||
- name: check Activation Failures AFTER Activation | ||
- name: Fails on Failed state | ||
fail: | ||
msg: "Failure in activation for {{item.value.Purpose}} - {{item.value.Version}}" | ||
when: item.value.Activation is defined and item.value.Activation == 'xyz.openbmc_project.Software.Activation.Activations.Failed' and item.value.RequestedActivation is defined and item.value.RequestedActivation =='xyz.openbmc_project.Software.Activation.RequestedActivations.Active' | ||
with_dict: "{{ firmware_inventory }}" | ||
|
||
- name: render Requested for Active Firmwares AFTER Activation | ||
debug: | ||
msg: "Requested Activation {{ item.value.Purpose }} - {{ item.value.Version }} ({{ item.key }})" | ||
when: item.value.RequestedActivation is defined and item.value.RequestedActivation == "xyz.openbmc_project.Software.Activation.RequestedActivations.Active" | ||
with_dict: "{{ firmware_inventory }}" | ||
|
||
- name: reboot BMC | ||
uri: | ||
url: https://{{ baseuri }}/xyz/openbmc_project/state/bmc0/attr/RequestedBMCTransition | ||
method: PUT | ||
validate_certs: no | ||
headers: | ||
X-Auth-Token: "{{ x_token }}" | ||
Content-Type: "application/json" | ||
body: | ||
data: xyz.openbmc_project.State.BMC.Transition.Reboot | ||
body_format: json | ||
when: reboot == True and item.value.Purpose is defined and item.value.RequestedActivation is defined and item.value.Purpose == "xyz.openbmc_project.Software.Version.VersionPurpose.BMC" and item.value.RequestedActivation == "xyz.openbmc_project.Software.Activation.RequestedActivations.Active" | ||
msg: "Fails on {{item.value.Purpose}} - {{item.value.Version}} - {{item.value.Activation}} - {{item.value.RequestedActivation}}" | ||
when: > | ||
( item.value.RequestedActivation is defined and | ||
not item.value.RequestedActivation == "xyz.openbmc_project.Software.Activation.RequestedActivations.None" | ||
) | ||
or | ||
( item.value.Activation is defined and | ||
item.value.Activation == "xyz.openbmc_project.Software.Activation.Activations.Failed" | ||
) | ||
with_dict: "{{ firmware_inventory }}" | ||
|
||
- name: pause {{ reboot_countdown }} minutes for BMC to reboot | ||
pause: | ||
minutes: "{{ reboot_countdown }}" | ||
when: reboot == True and item.value.Purpose is defined and item.value.RequestedActivation is defined and item.value.Purpose == "xyz.openbmc_project.Software.Version.VersionPurpose.BMC" and item.value.RequestedActivation == "xyz.openbmc_project.Software.Activation.RequestedActivations.Active" | ||
with_dict: "{{ firmware_inventory }}" | ||
|
||
- name: pause {{ activating_countdown }} seconds while activating firmware updates | ||
pause: | ||
seconds: "{{ activating_countdown }}" | ||
when: item.value.Purpose is defined and item.value.RequestedActivation is defined and not item.value.Purpose == "xyz.openbmc_project.Software.Version.VersionPurpose.BMC" and item.value.RequestedActivation == "xyz.openbmc_project.Software.Activation.RequestedActivations.Active" | ||
with_dict: "{{ firmware_inventory }}" | ||
|
||
- include_tasks: ../utils/utils_create_token.yml | ||
|
||
- name: get new firmware inventory | ||
uri: | ||
url: https://{{ baseuri }}/xyz/openbmc_project/software/enumerate | ||
method: GET | ||
validate_certs: no | ||
headers: | ||
X-Auth-Token: "{{ x_token }}" | ||
register: result_firmware_inventory | ||
|
||
- set_fact: | ||
new_firmware_inventory: "{{ result_firmware_inventory.json.data }}" | ||
|
||
- name: check key is defined in New Active Firmwares | ||
debug: | ||
msg: "Failure in activation for {{ item }}" | ||
verbosity: 2 | ||
with_items: "{{ firmware_inventory.keys() }}" | ||
when: not new_firmware_inventory[item] is defined | ||
|
||
- name: check New Active Firmwares | ||
fail: | ||
msg: "Failure in activation for {{ new_firmware_inventory[item].value.Purpose }} - {{ new_firmware_inventory[item].value.Version }}" | ||
when: new_firmware_inventory[item] is defined and new_firmware_inventory[item].value is defined and new_firmware_inventory[item].value.Version is defined and new_firmware_inventory[item].value.Purpose is defined and new_firmware_inventory[item].value.Activation is defined and not new_firmware_inventory[item].Activation == 'xyz.openbmc_project.Software.Activation.Activations.Active' and new_firmware_inventory[item].RequestedActivation is defined and not new_firmware_inventory[item].RequestedActivation == 'xyz.openbmc_project.Software.Activation.RequestedActivations.None' | ||
with_items: "{{ firmware_inventory.keys() }}" | ||
|
||
- include_tasks: ../utils/utils_firmware_inventory.yml | ||
|
||
- name: check Activation Failures | ||
fail: | ||
msg: "Failure in activation for {{item.value.Purpose}} - {{item.value.Version}}" | ||
when: item.value.Activation is defined and item.value.Activation == 'xyz.openbmc_project.Software.Activation.Activations.Failed' and item.value.RequestedActivation is defined and item.value.RequestedActivation =='xyz.openbmc_project.Software.Activation.RequestedActivations.Active' | ||
with_dict: "{{ firmware_inventory }}" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.