RETIRED, Examples and references to use Chef for OpenStack projects
Go to file
Samuel Cassiba 8193580838 Remove dedicated network node for multinode, remove cloudwatch
* cloudwatch has been deprecated since Havana, removed in Queens
* chef pinning is relaxed to major versions
* remove dedicated network node for multinode testing

Change-Id: I397bf5e61d13d217206e07351b0dbb91125c3212
2018-03-13 17:18:33 -07:00
.chef Convert provisioning recipes to cookbook 2016-06-27 21:33:08 -07:00
data_bags Add heat_domain_admin user password to data_bags 2017-10-12 16:51:18 +02:00
doc Documentation updates for Ocata 2017-08-14 09:33:34 -04:00
environments Remove dedicated network node for multinode, remove cloudwatch 2018-03-13 17:18:33 -07:00
playbooks Bumped ChefDK release to 2.3.4 2018-01-30 14:49:53 +00:00
roles Remove dedicated network node for multinode, remove cloudwatch 2018-03-13 17:18:33 -07:00
test/tempest/default Revert inspec test to use Tempest from git 2018-02-08 22:19:54 -08:00
tools Initial repo Pike updates 2017-09-27 09:04:37 +00:00
.gitignore Update repo with new testing suite 2015-02-26 15:09:06 -06:00
.gitreview Update .gitreview file for project rename 2015-06-12 23:12:30 +00:00
.kitchen.dokken.yml Remove dedicated network node for multinode, remove cloudwatch 2018-03-13 17:18:33 -07:00
.kitchen.multi.yml Remove dedicated network node for multinode, remove cloudwatch 2018-03-13 17:18:33 -07:00
.kitchen.yml Remove dedicated network node for multinode, remove cloudwatch 2018-03-13 17:18:33 -07:00
.rubocop_todo.yml Updated integration attributes and methods 2017-12-23 21:54:20 -08:00
.rubocop.yml Refactored provisioning cookbook for Ocata, ChefDK updates 2017-08-02 16:58:56 -04:00
.zuul.yaml Zuul: Remove project name 2018-01-31 19:32:47 -08:00
Berksfile use git.openstack.org for berks dependency resolution 2018-03-06 13:22:31 +01:00
bindep.txt Implement native zuul v3 tests 2017-10-27 13:34:05 +00:00
bootstrap.sh fix recipe order for allinone role and bootstrap.sh 2016-03-07 09:15:14 +01:00
CONTRIBUTING.md Updated the contrib docs 2017-11-01 11:36:23 -05:00
LICENSE Apache License v2.0 2012-10-12 15:45:47 -05:00
Rakefile Updated integration attributes and methods 2017-12-23 21:54:20 -08:00
README.md Documentation updates for Ocata 2017-08-14 09:33:34 -04:00
TESTING.md Removed Spiceweasel 2015-07-06 10:56:49 -05:00

Team and repository tags

Team and repository tags

Chef OpenStack Logo

Testing framework for deploying OpenStack using Chef

This is the testing framework for OpenStack deployed using Chef. We leverage this to test against our changes to our cookbooks to make sure that you can still build a cluster from the ground up with any changes we introduce.

This framework also gives us an opportunity to show different Reference Architectures and a sane example on how to start with OpenStack using Chef.

With the master branch of the cookbooks, which is currently tied to the base OpenStack Ocata release, this supports deploying to Ubuntu 16.04 and CentOS 7 in monolithic, or allinone, and non-HA multinode configurations with Neutron. The cookbooks support a fully HA configuration, but we do not test for that as there are far numerous paths to HA.

Prerequisites

  • ChefDK 1.0 or later for a relatively recent Berkshelf
  • Vagrant 1.9 or later with VirtualBox or some other provider

Getting the Code (this repo)

$ git clone https://github.com/openstack/openstack-chef-repo.git
$ cd openstack-chef-repo

The OpenStack cookbooks by default use encrypted data bags for configuring passwords. There are four data bags : user_passwords, db_passwords, service_passwords, secrets. There already exists a data_bags/ directory, so you shouldn't need to create any for a proof of concept. If you do, something is wrong. See the Data Bags doc for the gory details.

Supported Deployments

For each deployment model, there is a corresponding file in the doc/ directory. Please review that for specific details and additional setup that might be required before deploying the cloud.

Rake Deploy Commands

These commands will produce various OpenStack cluster configurations, the simplest being a monolithic Compute Controller with Neutron (allinone). These deployments are not intended to be production-ready, and will need adaptation to your environment. This is intended for development and proof of concept deployments.

For CentOS, set the environment variable REPO_OS=centos7. Ubuntu is the default.

Everything self-contained (allinone)

# allinone with Neutron
$ chef exec rake allinone

Access the machine

$ cd vms
$ vagrant ssh controller
$ sudo su -

Multiple nodes (non-HA)

# Multinode with Neutron (1 controller + 1 network + 2 compute nodes)
$ chef exec rake multi_node

Access the Controller

$ cd vms
$ vagrant ssh controller
$ sudo su -

Access the Network Node

$ cd vms
$ vagrant ssh network
$ sudo su -

Access the Compute nodes

$ cd vms
$ vagrant ssh compute1
# OR
$ vagrant ssh compute2
$ sudo su -

Testing The Controller

# Access the controller as noted above
$ source /root/openrc
$ nova --version
$ openstack service list && openstack hypervisor list
$ openstack image list
$ openstack user list
$ openstack server list

Working With Security Groups

To allow SSH access to instances, a security group is defined as follows:

$ openstack security group list
$ openstack security group list default
$ openstack security group create allow_ssh --description "allow ssh to instances"
$ openstack security group rule create allow_ssh --protocol tcp --dst-port 22:22 --remote-ip 0.0.0.0/0
$ openstack security group list allow_ssh

Working With Keys

To allow SSH keys to be injected into instance, a key pair is defined as follows:

# generate a new key pair
$ openstack keypair create mykey > mykey.pem
$ chmod 600 mykey.pem
$ openstack keypair create --public-key ~/.ssh/id_rsa.pub mykey
# verify the key pair has been imported
$ openstack keypair list

Booting up a cirros image on the Controller

$ openstack server create --flavor 1 --image cirros --security-group allow_ssh --key-name mykey test

Wait a few seconds and the run openstack server list if Status is not Active, wait a few seconds and repeat.

Once status is active you should be able to log in using SSH, or vagrant ssh <vm_name>

$ ssh cirros@<ip address from openstack server list output>

Accessing The OpenStack Dashboard

If you would like to use the OpenStack dashboard you should go to https://localhost:9443 and the username and password is admin/mypass.

Verifying OpenStack With Tempest

If you log in to the controller machine you can test via the most recent Tempest release.

$ cd vms
$ vagrant ssh <controller>
$ sudo su -
root@controller:~ cd /opt/tempest
root@controller:/opt/tempest$ ./run_tempest.sh -V --smoke --serial

[-- snip --]

tempest.tests.test_wrappers.TestWrappers
    test_pretty_tox                                                       1.68
    test_pretty_tox_fails                                                 1.03
    test_pretty_tox_serial                                                0.61
    test_pretty_tox_serial_fails                                          0.55

Ran 233 tests in 13.869s

OK
Running flake8 ...
root@controller:/opt/tempest#

Cleanup

To remove all the nodes and start over again with a different environment or different environment attribute overrides, using the following rake command.

$ chef exec rake destroy_machines

To refresh all cookbooks, use the following commands.

$ rm -rf cookbooks
$ chef exec rake berks_vendor

To clean up everything, use the following rake command.

$ chef exec rake clean

Tools

See the doc/tools.md for more information.

Data Bags

Some basic information about the use of data bags within this repo.

# Show the list of data bags
$ chef exec knife data bag list -z
db_passwords
secrets
service_passwords
user_passwords

# Show the list of data bag items
$ chef exec knife data bag show db_passwords -z
cinder
dash
glance
horizon
keystone
neutron
nova

# Show contents of data bag item
$ chef exec knife data bag show db_passwords nova -z
Encrypted data bag detected, decrypting with provided secret.
nova: mypass
id:   nova

# Update contents of data bag item
# set EDITOR env var to your editor. eg. EDITOR=vi
$ chef exec knife data bag edit secrets dispersion_auth_user -z

Data Bag Default Values

db_passwords are set to "mypass" secrets are set to "_token" service_passwords are set to "mypass" user_passwords are set to "mypass"

Default Encrypted Data Bag Secret

The default secret is stored here .chef/encrypted_data_bag_secret and referenced by .chef/knife.rb.

When we say defaults, we mean that they are known by everyone with access to this repository. Change these to something else before deploying for real.

Known Issues and Workarounds

Windows Platform

When using this on a Windows platform, here are some tweaks to make this work:

  • In order to get SSH to work, you will need an SSL client installed. You can use the one that comes with Git for Windows. You will need to append C:\Program Files (x86)\Git\bin; to the system PATH.

TODOs

  • Support for floating IPs
  • Better instructions for multi-node network setup
  • Easier debugging. Maybe a script to pull the logs from the controller.

License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.