Support configuration of BIOS and RAID for controllers

This commit is contained in:
Mark Goddard 2017-04-04 15:25:02 +01:00
parent b9b62138f6
commit 17c198fc69
7 changed files with 179 additions and 19 deletions

View File

@ -6,6 +6,36 @@
# to setup the Kayobe user account.
controller_bootstrap_user: "{{ lookup('env', 'USER') }}"
###############################################################################
# Controller node BIOS configuration.
# Dict of controller BIOS options. Format is same as that used by stackhpc.drac
# role.
controller_bios_config: "{{ controller_bios_config_default | combine(controller_bios_config_extra) }}"
# Dict of default controller BIOS options. Format is same as that used by
# stackhpc.drac role.
controller_bios_config_default: {}
# Dict of additional controller BIOS options. Format is same as that used by
# stackhpc.drac role.
controller_bios_config_extra: {}
###############################################################################
# Controller node RAID configuration.
# List of controller RAID volumes. Format is same as that used by stackhpc.drac
# role.
controller_raid_config: "{{ controller_raid_config_default + controller_raid_config_extra }}"
# List of default controller RAID volumes. Format is same as that used by
# stackhpc.drac role.
controller_raid_config_default: []
# List of additional controller RAID volumes. Format is same as that used by
# stackhpc.drac role.
controller_raid_config_extra: []
###############################################################################
# Controller node LVM configuration.

View File

@ -19,13 +19,11 @@ inspector_manage_firewall: False
# List of of default inspector processing plugins.
inspector_processing_hooks_default:
- root_disk_selection
- ramdisk_error
- scheduler
- validate_interfaces
- ramdisk_error
- capabilities
- pci_devices
- raid_device
- local_link_connection
- lldp_basic

View File

@ -0,0 +1,90 @@
---
- name: Group controller hosts by their BMC type
hosts: controllers
gather_facts: no
tasks:
- 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 }}"

View File

@ -285,6 +285,20 @@ to add them to the Kayobe and bifrost Ansible inventories::
(kayobe-venv) $ kayobe overcloud inventory discover
BIOS and RAID Configuration
---------------------------
.. note::
BIOS and RAID configuration may require one or more power cycles of the
hardware to complete the operation. These will be performed automatically.
Configuration of BIOS settings and RAID volumes is currently performed out of
band as a separate task from hardware provisioning. To configure the BIOS and
RAID::
(kayobe-venv) $ kayobe overcloud bios raid configure
Provisioning
------------

View File

@ -15,6 +15,36 @@
# List of extra networks to which controller nodes are attached.
#controller_extra_network_interfaces:
###############################################################################
# Controller node BIOS configuration.
# Dict of controller BIOS options. Format is same as that used by stackhpc.drac
# role.
#controller_bios_config:
# Dict of default controller BIOS options. Format is same as that used by
# stackhpc.drac role.
#controller_bios_config_default:
# Dict of additional controller BIOS options. Format is same as that used by
# stackhpc.drac role.
#controller_bios_config_extra:
###############################################################################
# Controller node RAID configuration.
# List of controller RAID volumes. Format is same as that used by stackhpc.drac
# role.
#controller_raid_config:
# List of default controller RAID volumes. Format is same as that used by
# stackhpc.drac role.
#controller_raid_config_default:
# List of additional controller RAID volumes. Format is same as that used by
# stackhpc.drac role.
#controller_raid_config_extra:
###############################################################################
# Controller node LVM configuration.

View File

@ -293,25 +293,22 @@ class OvercloudInventoryDiscover(KayobeAnsibleMixin, Command):
tags="config")
class OvercloudBIOSRAIDConfigure(KayobeAnsibleMixin, Command):
"""Configure BIOS and RAID for the overcloud hosts."""
def take_action(self, parsed_args):
self.app.LOG.debug("Configure overcloud BIOS and RAID")
playbooks = _build_playbook_list("overcloud-bios-raid")
self.run_kayobe_playbooks(parsed_args, playbooks)
class OvercloudProvision(KayobeAnsibleMixin, Command):
"""Provision the overcloud."""
def take_action(self, parsed_args):
self.app.LOG.debug("Provisioning overcloud")
self._configure_network(parsed_args)
self._configure_bios_and_raid(parsed_args)
self._deploy_servers(parsed_args)
def _configure_network(self, parsed_args):
self.app.LOG.debug("TODO: configure overcloud network")
def _configure_bios_and_raid(self, parsed_args):
self.app.LOG.debug("TODO: configure overcloud BIOS and RAID")
def _deploy_servers(self, parsed_args):
self.app.LOG.debug("Deploying overcloud servers via Bifrost")
self.run_kayobe_playbook(parsed_args,
"ansible/overcloud-provision.yml")
playbooks = _build_playbook_list("overcloud-provision")
self.run_kayobe_playbooks(parsed_args, playbooks)
class OvercloudDeprovision(KayobeAnsibleMixin, Command):
@ -319,8 +316,8 @@ class OvercloudDeprovision(KayobeAnsibleMixin, Command):
def take_action(self, parsed_args):
self.app.LOG.debug("Deprovisioning overcloud")
self.run_kayobe_playbook(parsed_args,
"ansible/overcloud-deprovision.yml")
playbooks = _build_playbook_list("overcloud-deprovision")
self.run_kayobe_playbooks(parsed_args, playbooks)
class OvercloudHostConfigure(KollaAnsibleMixin, KayobeAnsibleMixin, Command):

View File

@ -40,6 +40,7 @@ setup(
'control_host_bootstrap = kayobe.cli.commands:ControlHostBootstrap',
'configuration_dump = kayobe.cli.commands:ConfigurationDump',
'kolla_ansible_run = kayobe.cli.commands:KollaAnsibleRun',
'overcloud_bios_raid_configure = kayobe.cli.commands:OvercloudBIOSRAIDConfigure',
'overcloud_container_image_build = kayobe.cli.commands:OvercloudContainerImageBuild',
'overcloud_container_image_pull = kayobe.cli.commands:OvercloudContainerImagePull',
'overcloud_deprovision = kayobe.cli.commands:OvercloudDeprovision',