Tomas Sedovic d20b0f9009 Remove bash highlight 7 rokov pred
..
custom-actions 3823c72af1 Add Extra CAs (custom post-provision action) (#801) 7 rokov pred
sample-inventory 2e6426bfb8 Revert the console hostname change 7 rokov pred
README.md 255bda6812 Merge branch 'master' into openstack-docs 7 rokov pred
advanced-configuration.md d20b0f9009 Remove bash highlight 7 rokov pred
ansible.cfg 4fff75f713 Streamline the OpenStack provider README 7 rokov pred
custom_flavor_check.yaml 9593ffb85a Added checks for configured images and flavors (#688) 7 rokov pred
custom_image_check.yaml 9593ffb85a Added checks for configured images and flavors (#688) 7 rokov pred
galaxy-requirements.yaml d2ff422b28 Add Flannel support (#814) 7 rokov pred
net_vars_check.yaml ca88364175 Support separate data network for Flannel SDN (#757) 7 rokov pred
post-install.yml d2ff422b28 Add Flannel support (#814) 7 rokov pred
post-provision-openstack.yml d2ff422b28 Add Flannel support (#814) 7 rokov pred
pre-install.yml 2d5704d792 Make the `rhsm_register` value optional 7 rokov pred
pre_tasks.yml 1c73318927 Replace the CASL references (#778) 7 rokov pred
prepare-and-format-cinder-volume.yaml b6dd8f112c Pre-create a Cinder registry volume 7 rokov pred
prerequisites.yml ca88364175 Support separate data network for Flannel SDN (#757) 7 rokov pred
provision-openstack.yml 288fef2dd2 Empty ssh (#729) 7 rokov pred
provision.yaml e7a7d1642c Static inventory autogeneration (#550) 7 rokov pred
roles 034be45ada Symlink roles to provisioning/openstack/roles 7 rokov pred
scale-up.yaml d361dc4b30 Upscaling OpenShift application nodes (#571) 7 rokov pred
stack_params.yaml b450ff7588 Allow the specification of server group policies when provisioning openstack (#747) 7 rokov pred

README.md

OpenStack Provisioning

This directory contains Ansible playbooks and roles to create OpenStack resources (servers, networking, volumes, security groups, etc.). The result is an environment ready for OpenShift installation via openshift-ansible.

We provide everything necessary to be able to install OpenShift on OpenStack (including the DNS and load balancer servers when necessary). In addition, we work on providing integration with the OpenStack-native services (storage, lbaas, baremetal as a service, dns, etc.).

OpenStack Requirements

Before you start the installation, you need to have an OpenStack environment to connect to. You can use a public cloud or an OpenStack within your organisation. It is also possible to use Devstack or TripleO. In the case of TripleO, we will be running on top of the overcloud.

The OpenStack release must be Newton (for Red Hat OpenStack this is version 10) or newer. It must also satisfy these requirements:

  • Heat (Orchestration) must be available
  • The deployment image (CentOS 7 or RHEL 7) must be loaded
  • The deployment flavor must be available to your user
  • The keypair for SSH must be available in openstack
  • keystonerc file that lets you talk to the openstack services
    • NOTE: only Keystone V2 is currently supported

Optional:

  • External Neutron network with a floating IP address pool

Installation

There are four main parts to the installation:

  1. Preparing Ansible and dependencies
  2. Configuring the desired OpenStack environment and OpenShift cluster
  3. Creating the OpenStack resources (VMs, networking, etc.)
  4. Installing OpenShift

This guide is going to install OpenShift Origin with CentOS 7 images with minimal customisation.

We will create the VMs for running OpenShift, in a new Neutron network, assign Floating IP addresses and configure DNS.

The OpenShift cluster will have a single Master node that will run etcd, a single Infra node and two App nodes.

You can look at the Advanced Configuration page for additional options.

1. Preparing Ansible and dependencies

First, you need to select where to run Ansible from (the Ansible host). This can be the computer you read this guide on or an OpenStack VM you'll create specifically for this purpose.

We will use a Docker image that has all the dependencies installed to make things easier. If you don't want to use Docker, take a look at the Ansible host dependencies and make sure they're installed.

Your Ansible host needs to have the following:

  1. Docker
  2. keystonerc file with your OpenStack credentials
  3. SSH private key for logging in to your OpenShift nodes

Assuming your private key is ~/.ssh/id_rsa and keystonerc in your current directory:

$ sudo docker run -it -v ~/.ssh:/mnt/.ssh:Z \
     -v $PWD/keystonerc:/root/.config/openstack/keystonerc.sh:Z \
     redhatcop/control-host-openstack bash

This will create the container, add your SSH key and source your keystonerc. It should be set up for the installation.

You can verify that everything is in order:

$ less .ssh/id_rsa
$ ansible --version
$ openstack image list

2. Configuring the OpenStack Environment and OpenShift Cluster

The configuration is all done in an Ansible inventory directory. We will clone the openshift-ansible-contrib repository and set things up for a minimal installation.

$ git clone https://github.com/openshift/openshift-ansible-contrib
$ cp -r openshift-ansible-contrib/playbooks/provisioning/openstack/sample-inventory/ inventory

If you're testing multiple configurations, you can have multiple inventories and switch between them.

OpenStack Configuration

The OpenStack configuration is in inventory/group_vars/all.yml.

Open the file and plug in the image, flavor and network configuration corresponding to your OpenStack installation.

$ vi inventory/group_vars/all.yml
  1. Set the openstack_ssh_public_key to your OpenStack keypair name.
    • See openstack keypair list to find the keypairs registered with OpenShift.
    • This must correspond to your private SSH key in ~/.ssh/id_rsa
  2. Set the openstack_external_network_name to the floating IP network of your openstack.
    • See openstack network list for the list of networks.
    • It's often called public, external or ext-net.
  3. Set the openstack_default_image_name to the image you want your OpenShift VMs to run.
    • See openstack image list for the list of available images.
  4. Set the openstack_default_flavor to the flavor you want your OpenShift VMs to use.
    • See openstack flavor list for the list of available flavors.

NOTE: In most OpenStack environments, you will also need to configure the forwarders for the DNS server we create. This depends on your environment.

Launch a VM in your OpenStack and look at its /etc/resolv.conf and put the IP addresses into public_dns_nameservers in inventory/group_vars/all.yml.

OpenShift configuration

The OpenShift configuration is in inventory/group_vars/OSEv3.yml.

The default options will mostly work, but unless you used the large flavors for a production-ready environment, openshift-ansible's hardware check will fail.

Let's disable those checks by putting this in inventory/group_vars/OSEv3.yml:

openshift_disable_check: disk_availability,memory_availability

NOTE: The default authentication method will allow any username and password in! If you're running this in a public place, you need to set up access control.

Feel free to look at the Sample OpenShift Inventory and the advanced configuration.

3. Creating the OpenStack resources (VMs, networking, etc.)

We will install the DNS server roles using ansible galaxy and then run the openstack provisioning playbook. The ansible.cfg file we provide has useful defaults -- copy it to the directory you're going to run Ansible from.

$ ansible-galaxy install -r openshift-ansible-contrib/playbooks/provisioning/openstack/galaxy-requirements.yaml -p openshift-ansible-contrib/roles
$ cp openshift-ansible-contrib/playbooks/provisioning/openstack/ansible.cfg ansible.cfg

(you will only need to do this once)

Then run the provisioning playbook -- this will create the OpenStack resources:

$ ansible-playbook -i inventory openshift-ansible-contrib/playbooks/provisioning/openstack/provision.yaml

If you're using multiple inventories, make sure you pass the path to the right one to -i.

4. Installing OpenShift

We will use the openshift-ansible project to install openshift on top of the OpenStack nodes we have prepared:

$ git clone https://github.com/openshift/openshift-ansible
$ ansible-playbook -i inventory openshift-ansible/playbooks/byo/config.yml

Next Steps

And that's it! You should have a small but functional OpenShift cluster now.

Take a look at how to access the cluster and how to remove it as well as the more advanced configuration:

License

Like the rest of the openshift-ansible-contrib repository, the code here is licensed under Apache 2.