配色: 字号:
OneNoteAuto
2012-12-11 | 阅:  转:  |  分享 
  
#!/bin/bash
#YouCanUse##wgetftp://122.228.129.222/LDS/noenoteauto.sh##ForOpenStack
#SomeSoftForInstalling
cd/root
apt-get-yupdate
#
apt-get-yinstallntp
apt-get-yinstalltgt
apt-get-yinstallopen-iscsiopen-iscsi-utils
apt-get-yinstallbridge-utils
apt-get-yinstallrabbitmq-servermemcachedpython-memcachekvmlibvirt-bincurl
apt-get-yinstallmysql-serverpython-mysqldb
apt-get-yinstallkeystonepython-keystonepython-keystoneclient
#
/etc/init.d/networkingrestart
#
#SomeConf-FileMustToConfig
#nano/etc/ntp.conf
#serverntp.ubuntu.com
#server127.127.1.0
#fudge127.127.1.0stratum10
sed-i-e"s/serverntp.ubuntu.com/serverntp.ubuntu.com\nserver127.127.1.0\nfudge127.127.1.0stratum10\n/g"/etc/ntp.conf
#
servicentprestart
#
#========================YouMustModifyForYouNeed====================
#ENV
cat>/root/novarc<exportOS_TENANT_NAME=admin
exportOS_USERNAME=admin
exportOS_PASSWORD=cloud
exportMYSQL_PASS=cloud
exportMYSQL_PASSWORD=cloud
exportSERVICE_PASSWORD=cloud
exportFIXED_RANGE=192.168.84.0/24
exportFLOATING_RANGE=$(/sbin/ifconfigeth0|awk''/inetaddr/{print$2}''|cut-f2-d":"|awk-F"."''{print$1"."$2"."$3}'').224/27
exportOS_AUTH_URL="http://localhost:5000/v2.0/"
exportSERVICE_ENDPOINT="http://localhost:35357/v2.0"
exportSERVICE_TOKEN=$(opensslrand-hex10)
exportMASTER="$(/sbin/ifconfigeth0|awk''/inetaddr/{print$2}''|cut-f2-d":")"
EOF
sourcenovarc
echo"sourcenovarc">>.bashrc
#
#===========================MySql=============================
#nano/etc/mysql/my.cnf
#bind-address=0.0.0.0
sed-i-e"s/#bind-address/bind-address/g"/etc/mysql/my.cnf
sed-i-e"s/127.0.0.1/0.0.0.0/g"/etc/mysql/my.cnf
#
servicemysqlrestart
#
#createdatabases
mysql-uroot-p$MYSQL_PASS<CREATEDATABASEnova;
GRANTALLPRIVILEGESONnova.TO''nova''@''%''IDENTIFIEDBY''$MYSQL_PASS'';
CREATEDATABASEglance;
GRANTALLPRIVILEGESONglance.TO''glance''@''%''IDENTIFIEDBY''$MYSQL_PASS'';
CREATEDATABASEkeystone;
GRANTALLPRIVILEGESONkeystone.TO''keystone''@''%''IDENTIFIEDBY''$MYSQL_PASS'';
FLUSHPRIVILEGES;
EOF
#
servicentprestart
servicemysqlrestart
/etc/init.d/networkingrestart
#
#exe1.sh
################################################################
#exe2.sh
#==========================Keystone==================
sed-i-e"s/#bind_host/bind_host/g"/etc/keystone/keystone.conf
sed-i-e"s/admin_token=ADMIN/admin_token=$SERVICE_TOKEN/g"/etc/keystone/keystone.conf
sed-i''/connection=./{s|sqlite:///.|mysql://''"keystone"'':''"$MYSQL_PASS"''@''"$MASTER"''/keystone|g}''/etc/keystone/keystone.conf
keystone-managedb_sync
#
servicekeystonerestart
servicemysqlrestart
#
#Setkeystonedatabases
wgetftp://122.228.129.222/LDS/keystone_data.sh_.txt
wgetftp://122.228.129.222/LDS/endpoints.sh_.txt
mvkeystone_data.sh_.txtkeystone_data.sh&&bash./keystone_data.sh
mvendpoints.sh_.txtendpoints.sh&&bash./endpoints.sh
#
servicemysqlrestart
servicekeystonerestart
#
#curl-d''{"auth":{"tenantName":"admin","passwordCredentials":{"username":"admin","password":"$OS_PASSWORD"}}}''-H"Content-type:application/json"http://$MASTER:35357/v2.0/tokens|python-mjson.tool
#
apt-get-yupdate
#InstallNeedSoft
apt-get-yinstallglanceglance-apiglance-clientglance-commonglance-registrypython-glance
apt-get-yinstallnova-apinova-certnova-commonnova-objectstore\
nova-schedulernova-volumenova-consoleauthnovncpython-novapython-novaclient\
nova-computenova-compute-kvmnova-network
apt-getinstall-yapache2libapache2-mod-wsgiopenstack-dashboard
#apt-get-yinstallswiftswift-proxyswift-accountswift-containerswift-object
apt-get-yinstallxfsprogscurlpython-pastedeploy
#
#======================Glance=================
#glance
sed-i-e"s/%SERVICE_TENANT_NAME%/service/g;s/%SERVICE_USER%/glance/g;s/%SERVICE_PASSWORD%/$SERVICE_PASSWORD/g;"/etc/glance/glance-api-paste.ini
sed-i-e"s/%SERVICE_TENANT_NAME%/service/g;s/%SERVICE_USER%/glance/g;s/%SERVICE_PASSWORD%/$SERVICE_PASSWORD/g;"/etc/glance/glance-registry-paste.ini
sed-i''/sql_connection=./{s|sqlite:///.|mysql://''"glance"'':''"$MYSQL_PASS"''@''"$MASTER"''/glance|g}''/etc/glance/glance-registry.conf
cat<>/etc/glance/glance-api.conf
[paste_deploy]
flavor=keystone
EOF
cat<>/etc/glance/glance-registry.conf
[paste_deploy]
flavor=keystone
EOF
#
serviceglance-apirestart
serviceglance-registryrestart
glance-manageversion_control0
glance-managedb_sync
serviceglance-apirestart
serviceglance-registryrestart
#
sed-i-e"s/%SERVICE_TENANT_NAME%/service/g;s/%SERVICE_USER%/nova/g;s/%SERVICE_PASSWORD%/$SERVICE_PASSWORD/g;"/etc/nova/api-paste.ini
cat>/etc/nova/nova.conf<[DEFAULT]
######LOGS/STATE
#verbose=True
verbose=False

######AUTHENTICATION
auth_strategy=keystone

######SCHEDULER
#--compute_scheduler_driver=nova.scheduler.filter_scheduler.FilterScheduler
scheduler_driver=nova.scheduler.simple.SimpleScheduler

######VOLUMES
volume_group=nova-volumes
volume_name_template=volume-%08x
iscsi_helper=tgtadm

######DATABASE
sql_connection=mysql://nova:$MYSQL_PASS@$MASTER/nova

######COMPUTE
libvirt_type=kvm
#libvirt_type=qemu
connection_type=libvirt
instance_name_template=instance-%08x
api_paste_config=/etc/nova/api-paste.ini
allow_resize_to_same_host=True
libvirt_use_virtio_for_bridges=true
start_guests_on_host_boot=true
resume_guests_state_on_host_boot=true

######APIS
osapi_compute_extension=nova.api.openstack.compute.contrib.standard_extensions
allow_admin_api=true
s3_host=$MASTER
cc_host=$MASTER

######RABBITMQ
rabbit_host=$MASTER

######GLANCE
image_service=nova.image.glance.GlanceImageService
glance_api_servers=$MASTER:9292

######NETWORK
network_manager=nova.network.manager.FlatDHCPManager
force_dhcp_release=True
dhcpbridge_flagfile=/etc/nova/nova.conf
dhcpbridge=/usr/bin/nova-dhcpbridge
firewall_driver=nova.virt.libvirt.firewall.IptablesFirewallDriver
public_interface=eth0
flat_interface=eth1
flat_network_bridge=br100
fixed_range=$FIXED_RANGE
multi_host=true

######NOVNCCONSOLE
novnc_enabled=true
novncproxy_base_url=http://$MASTER:6080/vnc_auto.html
vncserver_proxyclient_address=$MASTER
vncserver_listen=$MASTER

########Nova
logdir=/var/log/nova
state_path=/var/lib/nova
lock_path=/var/lock/nova

#####MISC
use_deprecated_auth=false
root_helper=sudonova-rootwrap
EOF
#
chown-Rnova:nova/etc/nova
chmod640/etc/nova/nova.conf
#
forainrabbitmq-serverlibvirt-binnova-networknova-certnova-compute\
nova-apinova-objectstorenova-schedulernova-volume\
novncnova-consoleauth;doservice"$a"stop;done
forainrabbitmq-serverlibvirt-binnova-networknova-certnova-compute\
nova-apinova-objectstorenova-schedulernova-volume\
novncnova-consoleauth;doservice"$a"start;done
sleep3
#
nova-managedbsync
#
servicenova-managerestart
sleep3
#
nova-managenetworkcreateprivate--fixed_range_v4=$FIXED_RANGE\
--num_networks=1--bridge=br100--bridge_interface=eth1\
--network_size=256--multi_host=T
nova-managefloatingcreate--ip_range=$FLOATING_RANGE
#
forainrabbitmq-serverlibvirt-binnova-networknova-certnova-compute\
nova-apinova-objectstorenova-schedulernova-volume\
novncnova-consoleauth;doservice"$a"stop;done
forainrabbitmq-serverlibvirt-binnova-networknova-certnova-compute\
nova-apinova-objectstorenova-schedulernova-volume\
novncnova-consoleauth;doservice"$a"start;done
sleep3
#
novalist
novaimage-list
novafloating-ip-create
novaflavor-list
novasecgroup-add-ruledefaulttcp22220.0.0.0/0
novasecgroup-add-ruledefaulticmp-1-10.0.0.0/0
novasecgroup-list
novasecgroup-list-rulesdefault
#
#restartservices
forainrabbitmq-serverlibvirt-binnova-networknova-certnova-compute\
nova-apinova-objectstorenova-schedulernova-volume\
novncnova-consoleauth;doservice"$a"stop;done
forainrabbitmq-serverlibvirt-binnova-networknova-certnova-compute\
nova-apinova-objectstorenova-schedulernova-volume\
novncnova-consoleauth;doservice"$a"start;done
#
#done
#MakeByLDS!2012.12.09
#!/bin/bash
献花(0)
+1
(本文系LDS-壬申森...首藏)