Install Apache Cloudstack with Chef

Installation of Apache CloudStack and is dependencies using Opscode Chef community cookbooks.

To create a lab, a test environment or to just try CloudStack, you could install it using the installation documentation which is clean and fairly straight forward, but you can also install it with Chef and not worry about subtleties. Here is a quick way of installing CloudStack, MySQL server and NFS service into a single server to provide what’s required to setup a CloudStack lab. What’s remaining is to provide an Hypervisor and how you plan to deploy the initial zone within CloudStack.

By default those recipes will install on the same server:

  1. Cloudstack application
  2. MySQL + cloudstack databases
  3. get vhd-util tool (required to managed XenServer hypervisor)
  4. Download system template VMs and configure NFS export for the Secondary Storage (/data/secondary)
  5. Generate admin account api keys
  6. install and configure cloudmonkey for the root user.


This installation procedure consider that you have basic knowledge of Chef and have it already in place.

Currently working on CentOs 6.x x86_64

Prepare Chef environment

From your Chef Workstation, get community cookbook co-cloudstack and is dependencies.

knife cookbook site install co-cloudstack
knife cookbook site install co-cloudmonkey
knife cookbook site install chef-client
knife cookbook site install sudo
knife cookbook site install mysql

Upload those cookbooks into you Chef-server

cd cookbooks
knife cookbook upload *
Create role

Role will install applications in proper order:

{
  "name": "cloudstack-singlenode",
  "description": "Cloudstack on a single node",
    "default_attributes": {
    "authorization": {
      "sudo": {
        "users": [ "cloud" ],
        "passwordless": "true"
      }
    }
  },
  "run_list": [
    "recipe[mysql::server]",
    "recipe[co-cloudstack::mysql-conf]",
    "recipe[chef-client]",
    "recipe[co-nfs::server]",
    "recipe[co-cloudstack]",
    "recipe[co-cloudstack::secondary-local-nfs]",
    "recipe[co-cloudstack::sys-tmpl]",
    "recipe[co-cloudstack::admin-apikey]",
    "recipe[co-cloudmonkey]"
  ]
}
System-VM templates

By default co-cloudstack will download system vm template for XenServer only to spare some installation time. If you are using another Hypervisor, add following attributes to your role or environments in Chef:

  "default_attributes": {
    "cloudstack": {
      "repo": "http://172.30.40.99/CloudStack4.3_nodist_rpms/2014-03-31_17-17-51/",
      "hypervisor_tpl": {
        "kvm": "http://download.cloud.com/templates/4.3/systemvm64template-2014-01-14-master-kvm.qcow2.bz2",
        "vmware": "http://download.cloud.com/templates/4.3/systemvm64template-2014-01-14-master-vmware.ova"
      }
    }
  }
Create an environment

co-cloudstack will use Chef environment to search for existing services required by Cloudstack such as MySQL server , NFS server and other existing Cloudstack. co-cloudstack use tags and run_list to identify services. If nothing is found, database will be initialized, and created, NFS server will be configure locally (/data/secondary), system-vm template will be downloaded.

# knife environment create <environment name>
knife environment create env-cs-lab01

knife bootstrap

knife bootstrap <Server IP> -E "env-cs-lab01" -r "role[cloudstack-singlenode]" -P <root password>

Once bootstrap is complete, you have a Chef managed CloudStack ready with Secondary and Primary storage NFS shares, Tuned MySQL server and cloudmonkey installed and configured.

By default co-cloudstack will use “/data“ as the mountpoint for NFS shares as secondary and primary storages (“/data/secondary“,“/data/primary“). Since this NFS share is far probably slow, it would be preferable to use LocalStorage as Primary Storage.

What’s next?

You can access CloudStack webui: http://serverIP:8080/client
username = admin,
password = password
At this point you have to select and prepare hypervisor you need and how the first zone will be configured. More information at Apache CloudStack documentation.

Share Your Thoughts!

420 Guy Street
Montreal, QC H3J 1S6
CANADA
19/20 Commercial Road
Melbourne, VIC 3004
AUSTRALIA
201 Sommerville Ave.
Sommerville, MA 02143
USA
530 Broadway, 9th Floor
New York, NY 10012
USA