Ansible roles and playbooks to enable a standalone Ironic install
Go to file
2015-06-26 15:02:11 +00:00
bifrost Add the rest of the cookiecutter-generated files for testing 2015-06-24 16:09:08 -07:00
doc/source Move explicit URLs in ironic-install to defaults 2015-06-18 08:09:43 -04:00
playbooks Merge "Individual playbook for creating a test VM" 2015-06-26 15:02:11 +00:00
scripts Refactor ironic-install playbook to support CentOS & RHEL 2015-06-24 07:58:48 -04:00
tools Add ability to write CSV file 2015-05-26 16:47:09 -07:00
.gitignore Add cookiecutter-generated files for project 2015-06-10 08:40:19 -07:00
.gitreview Add .gitreview file 2015-05-25 13:52:46 +00:00
.mailmap Add cookiecutter-generated files for project 2015-06-10 08:40:19 -07:00
.testr.conf Add the rest of the cookiecutter-generated files for testing 2015-06-24 16:09:08 -07:00
babel.cfg Add cookiecutter-generated files for project 2015-06-10 08:40:19 -07:00
CONTRIBUTING.rst Add cookiecutter-generated files for project 2015-06-10 08:40:19 -07:00
env-vars Blind stab at breaking things into more roles 2015-03-12 17:07:46 -04:00
HACKING.rst Add cookiecutter-generated files for project 2015-06-10 08:40:19 -07:00
LICENSE Adding LICENSE file 2015-04-16 15:58:23 -04:00
MANIFEST.in Add cookiecutter-generated files for project 2015-06-10 08:40:19 -07:00
openstack-common.conf Add cookiecutter-generated files for project 2015-06-10 08:40:19 -07:00
README.rst Merge "Add README note about cleaning" 2015-06-25 16:27:56 +00:00
requirements.txt Adding agent_ucs driver to the driver list 2015-06-17 17:31:51 +00:00
setup.cfg Add cookiecutter-generated files for project 2015-06-10 08:40:19 -07:00
setup.py Add cookiecutter-generated files for project 2015-06-10 08:40:19 -07:00
test-requirements.txt Add cookiecutter-generated files for project 2015-06-10 08:40:19 -07:00
TODO.rst Updating documentation 2015-04-20 16:06:20 -04:00
tox.ini Add the rest of the cookiecutter-generated files for testing 2015-06-24 16:09:08 -07:00
troubleshooting.rst Fix documentation in bifrost 2015-05-25 13:53:01 +00:00

Bifrost

Bifrost is a set of Ansible playbooks that automates the task of deploying a base image onto a set of known hardware using Ironic. It provides modular utility for one-off operating system deployment with as few operational requirements as reasonably possible.

This is split into roughly three steps:

  • install: prepare the local environment by downloading and/or building machine images, and installing and configuring the necessary services.
  • enroll: take as input a customizable hardware inventory file and enroll the listed hardware with Ironic, configuring each appropriately for deployment with the previously-downloaded images.
  • deploy: instruct Ironic to deploy the operating system onto each machine.

Supported Operating Systems:

  • Ubuntu
  • Red Hat Enterprise Linux (RHEL) 7
  • CentOS 7

Pre-install steps

Installing bifrost on RHEL or CentOS requires a few extra pre-install steps.

Enable additional repositories (RHEL only)

The extras and optional yum repositories must be enabled to satisfy bifrost's dependencies. To check:

sudo yum repolist | grep 'optional\|extras'

To add the repositories:

sudo yum repolist all | grep 'optional\|extras'

The output will look like this:

!rhui-REGION-rhel-server-debug-extras/7Server/x86_64        Red H disabled
rhui-REGION-rhel-server-debug-optional/7Server/x86_64       Red H disabled
rhui-REGION-rhel-server-extras/7Server/x86_64               Red H disabled
rhui-REGION-rhel-server-optional/7Server/x86_64             Red H disabled
rhui-REGION-rhel-server-source-extras/7Server/x86_64        Red H disabled
rhui-REGION-rhel-server-source-optional/7Server/x86_64      Red H disabled

Use the names of the repositories (minus the version and architecture) to enable them:

sudo yum-config-manager --enable rhui-REGION-rhel-server-optional
sudo yum-config-manager --enable rhui-REGION-rhel-server-extras

Enable the EPEL repository (RHEL)

The Extra Packages for Enterprise Linux (EPEL) repository contains some of bifrost's dependencies. To enable it, install the epel-release package as follows:

sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Enable the EPEL repository (CentOS)

To enable EPEL on CentOS, run:

sudo yum install epel-release

Installation

The installation is split in to two parts.

The first part is a bash script which lays the basic groundwork of installing Ansible itself.

Edit ./playbooks/inventory/group_vars/all to match your environment.

  • If MySQL is already installed, update mysql_password to match your local installation.
  • Change network_interface to match the interface that will need to service DHCP requests.
  • Change the ironic_db_password which is set by Ansible in MySQL and in Ironic's configuration file.

Then run:

bash ./scripts/env-setup.sh
source /opt/stack/ansible/hacking/env-setup
cd playbooks

The second part is an Ansible playbook that installs and configures Ironic in a stand-alone fashion.

  • Keystone is NOT installed, and Ironic's API is accessible without authentication. It is possible to put basic password auth on Ironic's API by changing the nginx configuration accordingly.
  • Neutron is NOT installed. Ironic performs static IP injection via config-drive.
  • dnsmasq is configured statically and responds to all PXE boot requests by chain-loading to iPXE, which then fetches the ironic-python-agent ramdisk from Nginx.
  • standard ipmitool is used. TODO: make optional support for other hardware drivers

The re-execution of the playbook will cause states to be re-asserted. If not already present, a number of software packages including MySQL and RabbitMQ will be installed on the host. Python code will be re-installed regardless if it has changed, RabbitMQ user passwords will be reset, and services will be restarted.

Run:

If you have password-less sudo enabled, run:
   ansible-playbook -vvvv -i inventory/localhost install.yaml
Otherwise, add -K option to let Ansible prompting for the sudo  password:
   ansible-playbook -K -vvvv -i inventory/localhost install.yaml

With regards to testing, you may wish to set your installation such that ironic node cleaning is disabled. You can achieve this by passing the option "-e cleaning=false" to the command line or executing the command below. This is because cleaning can take a substantial amount of time while disks are being wiped.:

ansible-playbook -K -vvvv -i inventory/localhost install.yaml -e cleaning=false

After you have performed an installation, you can edit /etc/ironic/ironic.conf to enable or disable cleaning as desired.

Manual CLI Use

If you wish to utilize Ironic's CLI in no-auth mode, you must set two environment variables:

  • IRONIC_URL - A URL to the Ironic API, such as http://localhost:6385/
  • OS_AUTH_TOKEN - Any value, such as an empty space, is required to cause the client library to send requests directly to the API.

For your ease of use, env-vars can be sourced to allow the CLI to connect to a local Ironic installation operating in noauth mode.

Hardware Enrollment

The following requirements are installed during the Install step above:

  • openstack-infra/shade library
  • openstack-infra/os-client-config

You will also need a CSV file containing information about the hardware you are enrolling.

CSV File Format

The CSV file has the following columns:

  1. MAC Address
  2. Management username
  3. Management password
  4. Management Address
  5. CPU Count
  6. Memory size in MB
  7. Disk Storage in GB
  8. Flavor (Not Used)
  9. Type (Not Used)
  10. Host UUID
  11. Host or Node name
  12. Host IP Address to be set
  13. ipmi_target_channel - Requires: ipmi_bridging set to single
  14. ipmi_target_address - Requires: ipmi_bridging set to single
  15. ipmi_transit_channel - Requires: ipmi_bridging set to dual
  16. ipmi_transit_address - Requires: ipmi_bridging set to dual

Example definition:

00:11:22:33:44:55,root,undefined,192.168.122.1,1,8192,512,NA,NA,aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee,hostname_100,192.168.2.100,,,,

This file format is fairly flexible and can be easily modified although the enrollment and deployment playbooks utilize the model of a host per line model in order to process through the entire list, as well as reference the specific field items.

An example file can be found at inventory/baremetal.csv.example.

How this works?

The enroll.yaml playbook requires a variable (baremetal_csv_file) be set or passed into the playbook execution. NOTE: This MUST be the full path to the CSV file to be consumed by the Ansible playbooks and loaded into ironic.

Example:

ansible-playbook -i inventory/localhost -vvvv enroll.yaml -e baremetal_csv_file=inventory/baremetal.csv

Note that enrollment is a one-time operation. The Ansible module does not synchronize data for existing nodes. You should use the Ironic CLI to do this manually at the moment.

Additionally, it is important to note that the playbooks for enrollment are split into three separate playbooks based up the setting of ipmi_bridging.

Hardware Deployment

Requirements:

  • The baremetal.csv file that was utilized for the enrollment process.

How this works?

The deploy.yaml playbook is intended to create configdrives for servers, and initiate the node deployments through Ironic. IPs are injected into the config drive and are statically assigned.

Example:

ansible-playbook -i inventory/localhost -vvvv deploy.yaml -e baremetal_csv_file=inventory/baremetal.csv

Testing with a single command

A simple scripts/test-bifrost.sh script can be utilized to install pre-requisite software packages, Ansible, and then execute the test-bifrost.yaml playbook in order to provide a single step testing mechanism.

The playbook utilized by the script, playbooks/test-bifrost.yaml, is a single playbook that will create a local virtual machine, save a baremetal.csv file out, and then utilize it to execute the remaining roles. Two additional roles are invoked by this playbook which enables Ansible to connect to the new nodes by adding them to the inventory, and then logging into the remote machine via the user's ssh host key. Once that has successfully occurred, additional roles will unprovision the host(s) and delete them from Ironic.

Command:

scripts/test-bifrost.sh

Note:

  • Cleaning mode is explicitly disabled in the test-bifrost.yaml playbook due to the fact that is an IO intensive operation that can take a great deal of time.

Testing with Virtual Machines

Bifrost supports using virtual machines to emulate the hardware. All of the steps mentioned above are mostly the same.

It is assumed you have an SSH server running on the host machine. The agent_ssh driver, used by Ironic with VM testing, will need to use SSH to control the virtual machines.

An SSH key is generated for the ironic user when testing. The ironic conductor will use this key to connect to the host machine and run virsh commands.

  1. Set testing to true in the playbooks/inventory/group_vars/all file.
  2. You may need to adjust the value for ssh_public_key_path.
  3. Run the install step, as documented above.
  4. Run the tools/create_vm_nodes.sh script. By default, it will create a single VM node. Read the documentation within the script to see how to create more than one.
  5. The tools/create_vm_nodes.sh script will output CSV entries that can be used for the enrollment step. You will need to create a CSV file with this output.
  6. Run the enrollment step, as documented above, using the CSV file you created in the previous step.
  7. Run the deployment step, as documented above.

Future Support

  • Config drive network_info.json - Bifrost will automatically place a json structured file which is intended to replace the direct placement of a /etc/network/interfaces file. This will ultimately allow for more complex user defined networking as well as greater compatibility with other Linux distributions. At present, the diskimage-builder element simple-init can be used to facilitate this.