Install and configure Apache Cloudstack using Chef. A wrapper cookbook is prefered in order to Install Apache CloudStack properly, refer to cloudstack_wrapper cookbook for example.
Tested on CentOS 7 Some parts work with Ubuntu 16.04 but this cookbook does not perform all configuraiton required for CloudStack Management-server on Ubuntu.
- About Apache Cloudstack
- Requirements
- Resources / Providers
- Recipes
- Attributes
- Contributing
- License and Authors
Apache CloudStack is open source software designed to deploy and manage large networks of virtual machines, as a highly available, highly scalable Infrastructure as a Service (IaaS) cloud computing platform.
More info on: http://cloudstack.apache.org/
yum
- packages managementapt
- packages managementmysql
- for MySQL database server and clientsudo
- to configure sudoers for usercloud
There is a dependency on Ruby gem cloudstack_ruby_client for chef which is handle in recipe[cloudstack::default]
.
Create MySQL database and connection configuration used by CloudStack management-server using /usr/bin/cloudstack-setup-databases
utility.
# Using attributes
cloudstack_setup_database node['cloudstack']['db']['host'] do
root_user node['cloudstack']['db']['rootusername']
root_password node['cloudstack']['db']['rootpassword']
user node['cloudstack']['db']['username']
password node['cloudstack']['db']['password']
action :create
end
# using mysql cookbook and CloudStack default passwords
cloudstack_setup_database node['cloudstack']['db']['host'] do
action :create
end
Download initial SystemVM template prior to initialize a CloudStack Region. cloudstack_system_template require access to CloudStack database which must be initated before executing this ressource. If no URL is provided cloudstack_system_template will use the default URL from the database if available to download the template.
# Using attributes
cloudstack_system_template 'xenserver' do
url node['cloudstack']['systemvm']['xenserver']
nfs_path node['cloudstack']['secondary']['path']
nfs_server node['cloudstack']['secondary']['host']
db_user node['cloudstack']['db']['username']
db_password node['cloudstack']['db']['password']
db_host node['cloudstack']['db']['host']
end
Which is equivalent to:
/usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt \
-m /mnt/secondary \
-u http://cloudstack.apt-get.eu/systemvm/4.4/systemvm64template-4.4.1-7-xen.vhd.bz2 \
-h xenserver \
-F
Simpler example:
# Using URL from CloudStack database
cloudstack_system_template 'kvm' do
end
Post package installation and Database Creation for CloudStack, cloudstack-management service must be configure using a script /usr/bin/cloudstack-setup-management
.
cloudstack_setup_management node.name
Generate api keys for account. Currently working only for admin account.
Will update attributes:
node['cloudstack']['admin']['api_key']
node['cloudstack']['admin']['secret_key']
# Create API key if now exist in Cloudstack and update node attributes
cloudstack_api_keys 'admin' do
action :create
end
# Generate new API Keys
cloudstack_api_keys 'admin' do
action :reset
end
Update Global Settings values.
cloudstack_global_setting 'expunge.delay' do
value '80'
notifies :restart, 'service[cloudstack-management]', :delayed
end
Prepare the node to be a CloudStack management server. It will not fully install CloudStack because of dependency such as MySQL server and system VM templates. Refer to cloudstack_wrapper cookbook to install a fully working CloudStack management-server.
Install, enable and start cloudstack-usage. cloudstack-usage is usefull to collect resource usage from account. This recipe make sure cloudstack-usage run on a cloudstack-management server as it is required.
Install, enable and start KVM cloudstack-agent. KVM host managed by CloudStack require an agent. This recipe install cloudstack-agent required on a KVM server.
Support Ubuntu and CentOS/RHEL KVM server.
Download the tool vhd-util which is not include in CloudStack packages and required to manage XenServer hosts.
MySQL tunning based on official CloudStack documentation.
Configure CloudStack to send Events into RabbitMQ message bus. Work for CloudStack 4.3 and latest. RabbitMQ must be installed and configured somewhere, default values are for localhost.
Chef Required dependencies in order to interact with CloudStack.
Attributes can be customized. The cookbook does not support encrypted data bag usage for now.
node['cloudstack']['yum_repo']
- YUM repo URL to use, default: http://cloudstack.apt-get.eu/rhel/4.3/node['cloudstack']['apt_repo']
- APT repo URL to use, default: http://cloudstack.apt-get.eu/ubuntunode['cloudstack']['release_major']
- Major CloudStack release ex: 4.3 or 4.2node['cloudstack']['version']
- Package version ex: 4.2.1-1.el6
TODO: (optional) If this is a public cookbook, detail the process for contributing. If this is a private cookbook, remove this section.
e.g.
- Fork the repository on Github
- Create a named feature branch (like
add_component_x
) - Write your change
- Write tests for your change (if applicable)
- Run the tests, ensuring they all pass
- Submit a Pull Request using Github
- Author:: Pierre-Luc Dion ([email protected])
- Author:: Khosrow Moossavi ([email protected])
Some snippets have been taken from: schubergphilis/cloudstack-cookbook
- Author:: Roeland Kuipers ([email protected])
- Author:: Sander Botman ([email protected])
- Author:: Hugo Trippaers ([email protected])
Copyright:: Copyright (c) 2018 CloudOps Inc.
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.