RETIRED, Examples and references to use Chef for OpenStack projects
Go to file
OpenDev Sysadmins 0f239f5497 OpenDev Migration Patch
This commit was bulk generated and pushed by the OpenDev sysadmins
as a part of the Git hosting and code review systems migration
detailed in these mailing list posts:

http://lists.openstack.org/pipermail/openstack-discuss/2019-March/003603.html
http://lists.openstack.org/pipermail/openstack-discuss/2019-April/004920.html

Attempts have been made to correct repository namespaces and
hostnames based on simple pattern matching, but it's possible some
were updated incorrectly or missed entirely. Please reach out to us
via the contact information listed at https://opendev.org/ with any
questions you may have.
2019-04-19 19:31:11 +00:00
environments Add usage with Chef Server manual steps doc 2015-01-22 09:13:43 +08:00
roles Cleanup ceph cookbook, replace with upstream ceph cookbook 2015-01-20 18:07:44 +08:00
.gitignore Adding roles from cookbook-ceph 2014-08-04 07:34:57 -05:00
.gitreview OpenDev Migration Patch 2019-04-19 19:31:11 +00:00
Berksfile point berkshelf at supermarket.chef.io 2015-02-24 07:12:47 -08:00
CHANGELOG.md Add usage with Chef Server manual steps doc 2015-01-22 09:13:43 +08:00
Gemfile Updated berkshelf to 3.1.5 2014-11-06 15:44:54 +01:00
LICENSE Apache License v2.0 2012-10-12 15:45:47 -05:00
README.md Add usage with Chef Server manual steps doc 2015-01-22 09:13:43 +08:00
TESTING.md Update rabbitmq and ubuntu versions 2015-02-11 15:21:29 +01:00
Vagabondfile Update rabbitmq and ubuntu versions 2015-02-11 15:21:29 +01:00
Vagrantfile-aio-neutron Update VagrantFile files 2015-02-13 13:12:00 +01:00
Vagrantfile-aio-nova Update VagrantFile files 2015-02-13 13:12:00 +01:00
Vagrantfile-multi-neutron Update VagrantFile files 2015-02-13 13:12:00 +01:00
infrastructure.yml Cleanup ceph cookbook, replace with upstream ceph cookbook 2015-01-20 18:07:44 +08:00

README.md

Description

This repository contains examples of the roles, environments and other supporting files for deploying an OpenStack Juno reference architecture using Chef. This currently includes all OpenStack core projects: Compute, Dashboard, Identity, Image, Network, Object Storage, Block Storage, Telemetry and Orchestration.

Development of the latest OpenStack release will continue on the master branch and releases tagged with 10.0.X. Once development starts against OpenStack k release, this branch will move to stable/juno and the appropriate branches will continue development.

The documentation has been moved to the https://github.com/mattray/chef-docs repository for merging to https://github.com/opscode/chef-docs and eventual release to https://docs.getchef.com/openstack_develop.html. Instructions for building the docs are included in the repository. The documentation for Chef is available at http://docs.getchef.com. There is additional documentation on the OpenStack wiki.

Usage with Chef Server

This repository uses Berkshelf (https://berkshelf.com) to manage downloading all of the proper cookbook versions, whether from Git or from the Chef Supermarket site (https://supermarket.getchef.com/). The preference is to eventually upstream all cookbook dependencies to the Chef Supermarket site. The Berksfile lists the current dependencies. Note that berks will resolve version requirements and dependencies on first run and store these in Berksfile.lock. If new cookbooks become available you can run berks update to update the references in Berksfile.lock. Berksfile.lock will be included in stable branches to provide a known good set of dependencies. Berksfile.lock will not be included in development branches to encourage development against the latest cookbooks.

There is a Spiceweasel (http://bit.ly/spcwsl) infrastructure.yml manifest documenting all the roles and environments required to deploy OpenStack.

To see the commands necessary to push all of the files to the Chef server, run the following command:

spiceweasel infrastructure.yml

To actually deploy the repository to your Chef server, run the following command:

spiceweasel -e infrastructure.yml

Usage with Chef Server manual steps

Perpare Chef Server

Pre-condition

Make sure your Chef server's hostname is resolvable(i.e. ping your hostname will show the IP address).

Install Chef Server

Download Chef server package from here: https://www.chef.io/download-open-source-chef-server-11/

Install the file using the correct method for your system.

For Debain using dpkg -i chef-server.deb, for RHEL using rpm -i chef-server.rpm.

Configure Chef Server

chef-server-ctl reconfigure

Prepare Chef Workstation

Usually we setup the Chef workstation on Chef server node.

Install Chef

curl -L https://www.chef.io/chef/install.sh | bash

Configure Chef Workstation

knife ssl fetch
knife configure -y -i --defaults -r ''

Prepare Chef repository

Download OpenStack Chef cookbooks

git clone https://github.com/stackforge/openstack-chef-repo
cd openstack-chef-repo
/opt/chef/embedded/bin/gem install berkshelf
/opt/chef/embedded/bin/berks vendor ./cookbooks

Upload Chef roles and cookbooks

cd openstack-chef-repo
knife role from file ./roles/*.json
knife cookbook upload --cookbook-path ./cookbooks --all

Create and upload Chef environment

cd openstack-chef-repo
cp environments/example.json environments/your_environment.json
knife environment from file environments/your_environment.json

NOTE: Your should update the necessary attributes in environments/your_environment.json.

Start deploy OpenStack

Make sure your nodes can connect Chef server through Chef server's hostname/FQDN.

Deploy an allinone environment

knife bootstrap allinone_node_ip -E your_environment -r 'role[allinone-compute]'

Deploy a controller + compute environment

knife bootstrap controller_node_ip -E your_environment -r 'role[os-compute-single-controller]'
knife bootstrap compute_node1_ip -E your_environment -r 'role[os-compute-worker],role[os-telemetry-agent-compute]'
knife bootstrap compute_node2_ip -E your_environment -r 'role[os-compute-worker],role[os-telemetry-agent-compute]'

Usage with Chef Zero

Chef Zero is Chef local mode, without Chef server.

Install Chef

curl -L https://www.getchef.com/chef/install.sh | sudo bash

Checkout cookbooks

git clone https://github.com/stackforge/openstack-chef-repo
cd openstack-chef-repo
/opt/chef/embedded/bin/gem install berkshelf
/opt/chef/embedded/bin/berks vendor ./cookbooks

Prepare Chef environment

Here is a minimal environment file.

{
  "name": "zero-demo",
  "override_attributes": {
    "mysql": {
      "server_root_password": "ilikerandompasswords"
    },
    "openstack": {
      "developer_mode": true
    }
  }
}

Start to deploy

Note that your_node_name below is your node's hostname.

cd openstack-chef-repo
chef-client -z -E zero-demo -r 'role[allinone-compute]'

If there are no errors in output, congratulations!

Databags

You need to have some databags when you run the stackforge without the developer_mode -> true.

You need four databags : user_passwords, db_passwords, service_passwords, secrets

Each data bag need the following item to be created.

user_passwords ITEM example : {"id" : "admin", "admin" : "mypass"} - admin - guest

for item in admin guest ; do
 knife data bag create user_passw $p --secret-file ~/.chef/openstack_data_bag_secret;
done

db_passwords ITEM example : {"id" : "nova", "nova" : "mypass"}

- nova
- horizon
- keystone
- glance
- ceilometer
- neutron
- cinder
- heat
- dash
for item in nova horizon keystone glance ceilmeter neutron cinder heat dash ; do
 knife data bag create db_passwords $p --secret-file ~/.chef/openstack_data_bag_secret;
done

service_passwords ITEM example : {"id" : "openstack-image", "openstack-image" : "mypass"}

- openstack-image
- openstack-compute
- openstack-block-storage
- openstack-orchestration
- openstack-network
- rbd
for item in openstack-image openstack-compute openstack-block-storage openstack-orchestration openstack-network rbd ; do
 knife data bag create service_passwords $p --secret-file ~/.chef/openstack_data_bag_secret;
done

secrets ITEM example : {"id" : "openstack_identity_bootstrap_token", "openstack_identity_bootstrap_token" : "mytoken"}

- openstack_identity_bootstrap_token
- neutron_metadata_secret
for item in openstack_identity_bootstrap_token neutron_metadata_secret ; do
 knife data bag create secrets $p --secret-file ~/.chef/openstack_data_bag_secret;
done

Cookbooks

The cookbooks have been designed and written in such a way that they can be used to deploy individual service components on any of the nodes in the infrastructure; in short they can be used for single node 'all-in-one' installs (for testing), right up to multi/many node production installs. In order to achieve this flexibility, they are configured by attributes which may be used to override search. Chef 11 or later is currently required. Ruby 1.9.x is considered the minimum supported version of Ruby as well. Most users of this repository test with the full-stack Chef 11 client and a Chef server (Chef Solo is not explicity supported).

Each of the OpenStack services has its own cookbook and will eventually be available on the Chef Community site.

OpenStack Block Storage

http://github.com/stackforge/cookbook-openstack-block-storage/

There is further documentation in the OpenStack Block Storage cookbook README.

OpenStack Compute

http://github.com/stackforge/cookbook-openstack-compute/

There is further documentation in the OpenStack Compute cookbook README.

OpenStack Dashboard

http://github.com/stackforge/cookbook-openstack-dashboard/

There is further documentation in the OpenStack Dashboard cookbook README.

OpenStack Identity

http://github.com/stackforge/cookbook-openstack-identity/

There is further documentation in the OpenStack Identity cookbook README.

OpenStack Image

http://github.com/stackforge/cookbook-openstack-image/

There is further documentation in the OpenStack Image cookbook README.

OpenStack Network

Http://github.com/stackforge/cookbook-openstack-network/

There is further documentation in the OpenStack Network cookbook README.

OpenStack Object Storage

http://github.com/stackforge/cookbook-openstack-object-storage/

There is further documentation in the OpenStack Object Storage cookbook README.

Testing

Please refer to the TESTING.md for instructions for testing the repository and cookbooks with Vagrant or Vagabond.

License and Author

Author Matt Ray (matt@opscode.com)
Author Jay Pipes (jaypipes@gmail.com)
Author Chen Zhiwei (zhiwchen@cn.ibm.com)
Author Juergen Brueder (juergen.brueder@gmail.com)
Author Mark Vanderwiel (vanderwl@us.ibm.com)
Copyright Copyright (c) 2011-2013 Opscode, Inc.
Copyright Copyright (c) 2014-2015 IBM, Corp.

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.