tune cobbler snippets to deploy large scale cluster

Change-Id: I886b333ca2ede1088acb5bab69e14a8fe8884376
This commit is contained in:
xiaodongwang 2014-02-27 22:32:40 -08:00
parent 6b2c6862b0
commit 4ca3b760e4
7 changed files with 120 additions and 18 deletions

View File

@ -2,6 +2,29 @@
"os-network" : "openstack network node",
"os-compute-worker" : "openstack nova node"
},
"role_mapping": {
"os-single-controller": {
"/db/mysql/bind_address": "/networking/interfaces/management/ip",
"/mq/rabbitmq/bind_address": "/networking/interfaces/management/ip",
"/endpoints/compute/metadata/host": "/networking/interfaces/management/ip",
"/endpoints/compute/novnc/host": "/networking/interfaces/management/ip",
"/endpoints/compute/service/host": "/networking/interfaces/management/ip",
"/endpoints/compute/xvpvnc/host": "/networking/interfaces/management/ip",
"/endpoints/ec2/admin/host": "/networking/interfaces/management/ip",
"/endpoints/ec2/service/host": "/networking/interfaces/management/ip",
"/endpoints/identity/admin/host": "/networking/interfaces/management/ip",
"/endpoints/identity/service/host": "/networking/interfaces/management/ip",
"/endpoints/image/registry/host": "/networking/interfaces/management/ip",
"/endpoints/image/service/host": "/networking/interfaces/management/ip",
"/endpoints/metering/service/host": "/networking/interfaces/management/ip",
"/endpoints/network/service/host": "/networking/interfaces/management/ip",
"/endpoints/volume/service/host": "/networking/interfaces/management/ip"
},
"os-network": {
},
"os-compute-worker": {
}
},
"credential" : { "identity" : { "roles" : { "admin" : "admin",
"member" : "Member"
},

40
cobbler/conf/cobbler.conf Normal file
View File

@ -0,0 +1,40 @@
# This configuration file allows cobbler data
# to be accessed over HTTP.
AliasMatch ^/cblr/svc/op/ks/system/(.*)?$ "/var/www/cblr_ks/$1"
AliasMatch ^/cblr(?!/svc/)(.*)?$ "/var/www/cobbler$1"
AliasMatch ^/cobbler_track(.*)?$ "/var/www/cobbler$1"
#AliasMatch ^/cobbler(.*)?$ "/var/www/cobbler$1"
Alias /cobbler /var/www/cobbler
Alias /cobbler_webui_content /var/www/cobbler_webui_content
WSGIScriptAliasMatch ^/cblr/svc/([^/]*) /var/www/cobbler/svc/services.py
<Directory "/var/www/cobbler">
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
ProxyRequests off
ProxyPass /cobbler_api http://localhost:25151/
ProxyPassReverse /cobbler_api http://localhost:25151/
BrowserMatch "MSIE" AuthDigestEnableQueryStringHack=On
# the webui is now part of the "cobbler-web" package
# and is visited at http://.../cobbler_web not this URL.
# this is only a pointer to the new page.
<Directory "/var/www/cobbler/web/">
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
<Directory "/var/www/cblr_ks/">
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>

View File

@ -30,24 +30,34 @@ EOL
service rsyslog restart
cat << EOF > /etc/chef/rerun.sh
cat << EOF > /etc/chef/firstrun.sh
#raw
#!/bin/bash
pgrep chef-client
while [ "\$?" != "0" ]; do
chef-client -p /var/run/chef-client.pid -j /etc/chef/first-boot.json &> /tmp/chef.log
if [ "\$?" == "0" ]; then
sed -i "/log_location/c\log_location '/dev/null'" /etc/chef/client.rb
break
else
sleep 1m
pgrep chef-client
fi
while true; do
pgrep chef-client
if [ "\$?" == "0" ]; then
exit 1
fi
chef-client -j /etc/chef/first-boot.json -L /var/log/chef-client.log &> /tmp/chef.log
if [ "\$?" != "0" ]; then
sleep 1m
else
break
fi
done
#end raw
EOF
cat << EOF > /etc/chef/rerun.sh
#raw
#!/bin/bash
pgrep chef-client
if [ "\$?" == "0" ]; then
exit 1
fi
chef-client &> /tmp/chef.log
#end raw
EOF
## A self-destruct service to boot chef client and register cron job
cat << EOF > /etc/init.d/chef
@ -64,8 +74,9 @@ echo "path: \$PATH" 2>&1 >> /tmp/ntp.log
echo "new date is: \`date\`" 2>&1 >> /tmp/ntp.log
#end if
chmod +x /etc/chef/firstrun.sh
chmod +x /etc/chef/rerun.sh
/etc/chef/rerun.sh &
/etc/chef/firstrun.sh &
crontab -l > mycron
echo "*/30 * * * * /etc/chef/rerun.sh" >> mycron

View File

@ -1,5 +1,5 @@
log_level :info
log_location '/var/log/chef-client.log'
log_location '/dev/null'
#if $getVar('chef_url', '') != ""
chef_server_url '$chef_url'
#end if
@ -14,5 +14,7 @@ no_proxy '$ignore_proxy'
node_name '$chef_node_name'
#end if
validation_client_name 'chef-validator'
json_attribs nil
pid_file '/var/run/chef-client.pid'
# Using default node name (fqdn)
no_lazy_load true

View File

@ -61,7 +61,7 @@ net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
# increase the maximum number of requests queued to a listen socket
net.core.somaxconn = 1024
net.core.somaxconn = 8192
# avoid caching tcp network transfer statistics
net.ipv4.route.flush=1

View File

@ -0,0 +1,29 @@
#!/usr/bin/python
"""script to migrate rendered kickstart files from cobbler to outside."""
import logging
from cobbler import api
def main():
"""main entry"""
cobbler_api = api.BootAPI()
for system in cobbler_api.systems():
cobbler_api.kickgen.generate_kickstart_for_system(system.name)
try:
with open(
'/var/www/cblr_ks/%s' % system.name, 'w'
) as kickstart_file:
logging.info("Migrating kickstart for %s", system.name)
data = cobbler_api.kickgen.generate_kickstart_for_system(
system.name)
kickstart_file.write(data)
except Exception as error:
logging.error("Directory /var/www/cblr_ks/ does not exist.")
logging.exception(error)
raise error
if __name__ == '__main__':
logging.info("Running kickstart migration")
main()

View File

@ -1,3 +0,0 @@
#!/bin/bash
python /opt/compass/bin/migrate_ks.py