|
| 1 | +--- |
| 2 | +- hosts: |
| 3 | + - overcloud |
| 4 | + - baremetal-compute |
| 5 | + gather_facts: false |
| 6 | + connection: local |
| 7 | + |
| 8 | + collections: |
| 9 | + - dellemc.openmanage |
| 10 | + |
| 11 | + vars: |
| 12 | + secrets_ipmi_username: "{{ ipmi_admin_user }}" |
| 13 | + secrets_ipmi_password: "{{ ipmi_admin_password }}" |
| 14 | + |
| 15 | + # If you re-apply RAID, this recreates the disk! |
| 16 | + apply_raid: False |
| 17 | + drac_shutdown_type: "Graceful" # NoReboot or Graceful or Forced |
| 18 | + drac_export_path: "{{ playbook_dir }}" |
| 19 | + drac_profile_query_ironic: true |
| 20 | + ansible_python_interpreter: "{{ ansible_playbook_python }}" |
| 21 | + |
| 22 | + tasks: |
| 23 | + #FIXME(wszumski): Unserstand what this does |
| 24 | + # - name: Import Server Configuration Profile (NIC) |
| 25 | + # idrac_server_config_profile: |
| 26 | + # command: "import" |
| 27 | + # idrac_ip: "{{ ipmi_address }}" |
| 28 | + # idrac_user: "{{ secrets_ipmi_username }}" |
| 29 | + # idrac_password: "{{ secrets_ipmi_password }}" |
| 30 | + # share_name: "{{ drac_export_path }}" |
| 31 | + # scp_file: "golden_BIOS_no_embedded_pxe.json" |
| 32 | + # job_wait: True |
| 33 | + # end_host_power_state: "On" |
| 34 | + # shutdown_type: "{{ drac_shutdown_type }}" |
| 35 | + # scp_components: "NIC" |
| 36 | + # register: idrac_nic_output |
| 37 | + # delegate_to: localhost |
| 38 | + # when: ipmi_address is defined |
| 39 | + # |
| 40 | + |
| 41 | + - block: |
| 42 | + - name: Gather ironic state |
| 43 | + openstack.cloud.baremetal_node_info: |
| 44 | + name: "{{ inventory_hostname }}" |
| 45 | + register: node |
| 46 | + vars: |
| 47 | + ansible_python_interpreter: "{{ ansible_playbook_python }}" |
| 48 | + ansible_connection: local |
| 49 | + - name: Fail if hardware fault flag set |
| 50 | + fail: |
| 51 | + msg: >- |
| 52 | + Node has been flagged as having a hardware fault. Please clear the extra/kayobe_hardware_fault |
| 53 | + flag with `openstack baremetal node unset --extra kayobe_hardware_fault_<type>` if the fault has |
| 54 | + been resolved. |
| 55 | + when: node.nodes.0.extra | map('regex_search', '^kayobe_hardware_fault') | select | list | default([]) | truthy |
| 56 | + when: drac_profile_query_ironic | bool |
| 57 | + |
| 58 | + - name: Import Server Configuration Profile (BIOS) |
| 59 | + idrac_server_config_profile: |
| 60 | + command: "import" |
| 61 | + idrac_ip: "{{ ipmi_address }}" |
| 62 | + idrac_user: "{{ secrets_ipmi_username }}" |
| 63 | + idrac_password: "{{ secrets_ipmi_password }}" |
| 64 | + share_name: "{{ drac_export_path }}" |
| 65 | + scp_file: "server-profiles/golden_BIOS_{{ drac_profile }}.json" |
| 66 | + job_wait: True |
| 67 | + end_host_power_state: "On" |
| 68 | + shutdown_type: "{{ drac_shutdown_type }}" |
| 69 | + scp_components: "BIOS" |
| 70 | + validate_certs: false |
| 71 | + timeout: 60 |
| 72 | + register: idrac_bios_output |
| 73 | + delegate_to: localhost |
| 74 | + when: ipmi_address is defined |
| 75 | + |
| 76 | + - name: Import Server Configuration Profile (RAID) |
| 77 | + idrac_server_config_profile: |
| 78 | + command: "import" |
| 79 | + idrac_ip: "{{ ipmi_address }}" |
| 80 | + idrac_user: "{{ secrets_ipmi_username }}" |
| 81 | + idrac_password: "{{ secrets_ipmi_password }}" |
| 82 | + share_name: "{{ drac_export_path }}" |
| 83 | + scp_file: "server-profiles/golden_RAID_{{ drac_profile }}.json" |
| 84 | + job_wait: True |
| 85 | + end_host_power_state: "On" |
| 86 | + shutdown_type: "{{ drac_shutdown_type }}" |
| 87 | + validate_certs: false |
| 88 | + register: idrac_bios_output |
| 89 | + register: idrac_raid_output |
| 90 | + delegate_to: localhost |
| 91 | + when: ipmi_address is defined and apply_raid |
| 92 | + |
| 93 | + - name: Reset iDRAC if bios settings were updated |
| 94 | + idrac_reset: |
| 95 | + idrac_ip: "{{ ipmi_address }}" |
| 96 | + idrac_user: "{{ secrets_ipmi_username }}" |
| 97 | + idrac_password: "{{ secrets_ipmi_password }}" |
| 98 | + validate_certs: false |
| 99 | + register: idrac_bios_output |
| 100 | + when: ipmi_address is defined and idrac_bios_output.changed |
0 commit comments