--- # Perform configuration of the overcloud nodes' BIOS and RAID. Nodes should be # registered with the seed's ironic service but not active. The BIOS and RAID # is configured out of band using the ansible stackhpc.drac role. As such, only # Dell servers with iDRACs are currently supported. During configuration, we # set the ironic nodes' to maintenance mode to prevent ironic from managing # their power states. - name: Group controller hosts by their BMC type hosts: controllers gather_facts: no vars: # List of BMC types supporting BIOS and RAID configuration. supported_bmc_types: - idrac tasks: - name: Fail if controller has BIOS and/or RAID configuration and BMC type is not supported fail: msg: > Controller has BIOS and/or RAID configuration but BMC type {% if bmc_type is undefined %}is not defined{% else %}{{ bmc_type }} is not supported{% endif %}. when: - "{{ controller_bios_config or controller_raid_config }}" - "{{ bmc_type is undefined or bmc_type not in supported_bmc_types }}" - name: Group controller hosts by their BMC type group_by: key: "controllers_with_bmcs_of_type_{{ bmc_type | default('unknown') }}" - name: Check whether any changes to controller BIOS and RAID configuration are required hosts: controllers_with_bmcs_of_type_idrac gather_facts: no vars: # Set this to False to avoid rebooting the nodes after configuration. drac_reboot: True roles: - role: stackhpc.drac drac_address: "{{ ipmi_address }}" drac_username: "{{ ipmi_username }}" drac_password: "{{ ipmi_password }}" drac_bios_config: "{{ controller_bios_config }}" drac_raid_config: "{{ controller_raid_config }}" drac_check_mode: True tasks: - name: Set a fact about whether the configuration changed set_fact: bios_or_raid_change: "{{ drac_result | changed }}" - name: Ensure that controller BIOS and RAID volumes are configured hosts: controllers_with_bmcs_of_type_idrac gather_facts: no vars: # Set this to False to avoid rebooting the nodes after configuration. drac_reboot: True pre_tasks: - name: Set the controller nodes' maintenance mode command: > docker exec bifrost_deploy bash -c '. env-vars && export OS_URL=$IRONIC_URL && export OS_TOKEN=$OS_AUTH_TOKEN && export BIFROST_INVENTORY_SOURCE=ironic && ansible baremetal --connection local --inventory /etc/bifrost/inventory/ -e @/etc/bifrost/bifrost.yml -e @/etc/bifrost/dib.yml --limit {{ inventory_hostname }} -m command -a "openstack baremetal node maintenance set {% raw %}{{ inventory_hostname }}{% endraw %} --reason BIOS-RAID"' register: show_result # We use this convoluted construct to work around Ansible's limitations # in evaluation of the delegate_to keyword. delegate_to: "{{ item }}" with_items: - "{{ hostvars[groups['seed'][0]].ansible_host }}" when: "{{ bios_or_raid_change | bool }}" roles: - role: stackhpc.drac drac_address: "{{ ipmi_address }}" drac_username: "{{ ipmi_username }}" drac_password: "{{ ipmi_password }}" drac_bios_config: "{{ controller_bios_config }}" drac_raid_config: "{{ controller_raid_config }}" when: "{{ bios_or_raid_change | bool }}" tasks: - name: Unset the controller nodes' maintenance mode command: > docker exec bifrost_deploy bash -c '. env-vars && export OS_URL=$IRONIC_URL && export OS_TOKEN=$OS_AUTH_TOKEN && export BIFROST_INVENTORY_SOURCE=ironic && ansible baremetal --connection local --inventory /etc/bifrost/inventory/ -e @/etc/bifrost/bifrost.yml -e @/etc/bifrost/dib.yml --limit {{ inventory_hostname }} -m command -a "openstack baremetal node maintenance unset {% raw %}{{ inventory_hostname }}{% endraw %}"' register: show_result # We use this convoluted construct to work around Ansible's limitations # in evaluation of the delegate_to keyword. delegate_to: "{{ item }}" with_items: - "{{ hostvars[groups['seed'][0]].ansible_host }}" when: "{{ bios_or_raid_change | bool }}"