啥也没写
分类: LINUX
2012-08-27 10:44:06
Rackspace公司推出了Private Cloud,提供了一个定制的ISO可以快速方便的部署企业自己的私有云,试用了一下感觉非常爽,只可惜它是基于Ubuntu的,我们的环境大多用CentOS,所以试着看能不能做一个基于CentOS的ISO$$
他们使用Chef来做部署,我对他们使用的Cookbook做了一些修改,现在基本可以在CentOS 6.2上部署了
Rackspace的Cookbook地址是:
由于国内网络的原因,并且我对submodule也不熟,我没有fork,而是直接复制文件创建了一个新的(从30多M => 4M)
地址是:
Chef Server使用了rabbitmq-server,如果把chef-server放在控制节点上,配置rabbitmq-server的cookbook会报错,所以你可能需要两个机子(Rackspace的作法是起一个虚拟机专门做chef-server)
使用方法
配置chef-server
rpm -Uvh yum install rubygem-chef-server service iptables stop setup-chef-server.sh上面的命令已经安装并启动chef-server相关的服务了,我们再配置一个用来管理chef的客户端
knife configure -i执行上面的命令然后一路回车就可以配置一个管理用的客户端,运行
knife node list如果没有报错,就可以继续了
下载cookbooks
yum -y install git git clone .git上传cookbook,role, environment
上传environment前你可能想要修改一个environment以适合你自己的环境(vi environments/example.json)
{ "name": "openstack", "description": "", "cookbook_versions": { }, "json_class": "Chef::Environment", "chef_type": "environment", "default_attributes": { "mysql": { "allow_remote_root": true, "root_network_acl": "%" }, "nova": { "network": { "public_interface": "eth0" } } }, "override_attributes": { "developer_mode": false, "monitoring" : { "procmon_provider" : "none" }, "keystone" : { "tenants" : [ "admin", "service", "demo" ], "admin_user" : "admin", "users" : { "admin" : { "password" : "password", "roles" : { "admin" : [ "admin", "demo" ] } }, "demo" : { "password" : "password", "default_tenant" : "demo", "roles" : { "Member" : [ "demo" ] } } } }, "glance": { "image" : { "precise" : "file:///opt/rpcs/precise-server-cloudimg-amd64.tar.gz", "cirros" : "file:///opt/rpcs/cirros-0.3.0-x86_64-uec.tar.gz" }, "images": [ "cirros", "precise" ], "image_upload": false }, "nova": { "network": { "fixed_range": "172.31.0.0/24", "dmz_cidr": "10.128.0.0/24" }, "apply_patches": false, "networks": [ { "bridge_dev": "eth1", "num_networks": "1", "network_size": "254", "bridge": "br0", "ipv4_cidr": "172.31.0.0/24", "label": "public", "dns1": "8.8.8.8", "dns2": "8.8.4.4" } ] }, "osops_networks": { "management": "192.168.24.0/24", "nova": "192.168.24.0/24", "public": "192.168.24.0/24" }, "enable_monit": true } }修改password和osops_networks,osops_networks修改成和你的IP在一个网段
# upload cookbooks cd openstack-cookbooks knife cookbook upload -o cookbooks --all # upload role knife role from file roles/*.rb # upload environment knife environment from file environments/example.json要部署openstack的机子只要配置好网络和FQDN,就可以在chef-server利用bootstrap快速配置
复制bootstrap脚本
cp -r bootstrap ~/.chef利用bootstrap配置一个allinone的服务(假设已经配置好FQDN和网络,并且IP地址是192.168.24.2,可以从chef-server能过ssh连接)
cd ~ knife bootstrap 192.168.24.2 -E openstack -r 'role[allinone]' -d centos6欢迎大家试用,有问题我会尽力解答
转:http://blog.lightcloud.cn/?p=172