Mindmajix

Setting up a Chef environment for OpenStack

At this stage, you will have a functioning Opscode Chef Server, as well as a PuppetLabs Razor environment, so we can now begin to configure our OpenStack environment. For this, our Chef Server uses a .json file to define the attributes that will make up our environment, such as networks and services.

Getting ready

To set up our environment, first log into the Chef Server and sudo to root:

vagrant ssh Chef 
sudo su -

How to achieve it…

Once logged into the Chef Server, run the following commands:

cat > /root/.chef/cookbook.json <<EOF
{
"name": "cookbook",
"description": "OpenStack Cookbook environmnet", "cookbook_versions": {
},
"json_class": "chef::Environment", "chef_type": "environment", "default_attributes": {
}, "override_attributes": {
"glance": { "images": [
"cirros",
"precise"
],
"image_upload": true
}, "nova": {
"libvirt": { "virt_type": "qemu"
}, "ratelimit": {
"api": { "enabled": true
}, "volume": {
"enabled": true
}
}, "networks": [
{
"label": "public", "bridge_dev": "eth1", "dns2": "8.8.4.4", "num_networks": "1",
"ipv4_cidr": "10.10.100.0/24", "network_size": "255", "bridge": "br100",
"dns1": "8.8.8.8"
}
]
},
"developer_mode": false, "mysql": {
"allow_remote_root": true, "root_network_acl": "%"
}, "osops_networks": {
"nova": "172.16.0.0/24", "public": "172.16.0.0/24", "management": "172.16.0.0/24"
}, "monitoring": {
"metric_provider": "collectd", "procmon_provider": "monit"
}
}
}
EOF

Once you have created the file, the next step is to import it into Chef:

knife environment from file /root/.chef/cookbook.json

How it works…

The OpenStack cookbooks we imported earlier, will need details about the environment to be built. The advantage of keeping these details in Chef Server environments, is it allows you to use the same Chef Server for testing, staging, and production. Further, keeping our configuration details in a file allows us to check them into a version control system to track exactly how an environment was built and changed over time.

In the cookbook.json file we created, we provided for the minimum required to stand up OpenStack. Specifically, there are several important sections. The first one configures the OpenStack Image service Glance to download the Cirros and Ubuntu Precise images. Additionally, it configures glance to allow uploads:

"glance": { "images": [
"cirros",
"precise"
],
"image_upload": true
},

Next, we provided details for configuring the Nova Compute service. In our example, we specified that we want to use qemu as our virtualization engine. In a production environment, you would want to change this to KVM, Xen or others. Additionally, we set up an API rate limit, this is a test environment after all, and enabled volumes:

"nova": { "libvirt": {
"virt_type": "qemu"
}, "ratelimit": {
"api": { "enabled": true
}, "volume": {
"enabled": true
}
},

Next, we specify networking details. Specifically, we specify bridge devices, DNS information, how many networks to create, the size of the network and then some:

"networks": [
{
"label": "public", "bridge_dev": "eth1", "dns2": "8.8.4.4", "num_networks": "1",
"ipv4_cidr": "10.10.100.0/24", "network_size": "255", "bridge": "br100",
"dns1": "8.8.8.8"
}
]

The next several sections specify how to configure services like MySQL or Monitoring as well as provide directions for where the cookbooks can find the networks configured on our nodes.

https://docs.chef.io/openstack.html


 

0 Responses on Setting up a Chef environment for OpenStack"

Leave a Message

Your email address will not be published. Required fields are marked *

Copy Rights Reserved © Mindmajix.com All rights reserved. Disclaimer.
Course Adviser

Fill your details, course adviser will reach you.