github.com/minamijoyo/terraform@v0.7.8-0.20161029001309-18b3736ba44b/builtin/providers/openstack/devstack/deploy.sh (about) 1 #!/bin/bash 2 3 set -e 4 5 cd 6 sudo apt-get update 7 sudo apt-get install -y git make mercurial 8 9 sudo wget -O /usr/local/bin/gimme https://raw.githubusercontent.com/travis-ci/gimme/master/gimme 10 sudo chmod +x /usr/local/bin/gimme 11 gimme 1.6 >> .bashrc 12 13 mkdir ~/go 14 eval "$(/usr/local/bin/gimme 1.6)" 15 echo 'export GOPATH=$HOME/go' >> .bashrc 16 export GOPATH=$HOME/go 17 18 export PATH=$PATH:$HOME/terraform:$HOME/go/bin 19 echo 'export PATH=$PATH:$HOME/terraform:$HOME/go/bin' >> .bashrc 20 source .bashrc 21 22 go get github.com/hashicorp/terraform 23 24 git clone https://git.openstack.org/openstack-dev/devstack -b stable/mitaka 25 cd devstack 26 cat >local.conf <<EOF 27 [[local|localrc]] 28 # OpenStack version 29 OPENSTACK_VERSION="mitaka" 30 31 # devstack password 32 DEVSTACK_PASSWORD="password" 33 34 # Configure passwords and the Swift Hash 35 MYSQL_PASSWORD=\$DEVSTACK_PASSWORD 36 RABBIT_PASSWORD=\$DEVSTACK_PASSWORD 37 SERVICE_TOKEN=\$DEVSTACK_PASSWORD 38 ADMIN_PASSWORD=\$DEVSTACK_PASSWORD 39 SERVICE_PASSWORD=\$DEVSTACK_PASSWORD 40 SWIFT_HASH=\$DEVSTACK_PASSWORD 41 42 # Configure the stable OpenStack branches used by DevStack 43 # For stable branches see 44 # http://git.openstack.org/cgit/openstack-dev/devstack/refs/ 45 CINDER_BRANCH=stable/\$OPENSTACK_VERSION 46 CEILOMETER_BRANCH=stable/\$OPENSTACK_VERSION 47 GLANCE_BRANCH=stable/\$OPENSTACK_VERSION 48 HEAT_BRANCH=stable/\$OPENSTACK_VERSION 49 HORIZON_BRANCH=stable/\$OPENSTACK_VERSION 50 KEYSTONE_BRANCH=stable/\$OPENSTACK_VERSION 51 NEUTRON_BRANCH=stable/\$OPENSTACK_VERSION 52 NOVA_BRANCH=stable/\$OPENSTACK_VERSION 53 SWIFT_BRANCH=stable/\$OPENSTACK_VERSION 54 ZAQAR_BRANCH=stable/\$OPENSTACK_VERSION 55 56 # Enable Swift 57 enable_service s-proxy 58 enable_service s-object 59 enable_service s-container 60 enable_service s-account 61 62 # Disable Nova Network and enable Neutron 63 disable_service n-net 64 enable_service q-svc 65 enable_service q-agt 66 enable_service q-dhcp 67 enable_service q-l3 68 enable_service q-meta 69 enable_service q-flavors 70 71 # Disable Neutron metering 72 disable_service q-metering 73 74 # Enable LBaaS V1 75 #enable_service q-lbaas 76 77 # Enable FWaaS 78 enable_service q-fwaas 79 80 # Enable LBaaS v2 81 enable_plugin neutron-lbaas https://git.openstack.org/openstack/neutron-lbaas stable/\$OPENSTACK_VERSION 82 enable_plugin octavia https://git.openstack.org/openstack/octavia stable/\$OPENSTACK_VERSION 83 enable_service q-lbaasv2 84 enable_service octavia 85 enable_service o-cw 86 enable_service o-hk 87 enable_service o-hm 88 enable_service o-api 89 90 # Enable Trove 91 enable_plugin trove git://git.openstack.org/openstack/trove.git stable/\$OPENSTACK_VERSION 92 enable_service trove,tr-api,tr-tmgr,tr-cond 93 94 # Disable Temptest 95 disable_service tempest 96 97 # Disable Horizon 98 disable_service horizon 99 100 # Disable Keystone v2 101 #ENABLE_IDENTITY_V2=False 102 103 # Enable SSL/tls 104 #enable_service tls-proxy 105 #USE_SSL=True 106 107 # Enable Ceilometer 108 #enable_service ceilometer-acompute 109 #enable_service ceilometer-acentral 110 #enable_service ceilometer-anotification 111 #enable_service ceilometer-collector 112 #enable_service ceilometer-alarm-evaluator 113 #enable_service ceilometer-alarm-notifier 114 #enable_service ceilometer-api 115 116 # Enable Zaqar 117 #enable_plugin zaqar https://github.com/openstack/zaqar 118 #enable_service zaqar-server 119 120 # Automatically download and register a VM image that Heat can launch 121 # For more information on Heat and DevStack see 122 # http://docs.openstack.org/developer/heat/getting_started/on_devstack.html 123 #IMAGE_URLS+=",http://cloud.fedoraproject.org/fedora-20.x86_64.qcow2" 124 #IMAGE_URLS+=",https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img" 125 126 # Logging 127 LOGDAYS=1 128 LOGFILE=/opt/stack/logs/stack.sh.log 129 LOGDIR=/opt/stack/logs 130 EOF 131 ./stack.sh 132 133 # Patch openrc 134 #cat >> openrc <<EOF 135 # 136 # Currently, in order to use openstackclient with Identity API v3, 137 # we need to set the domain which the user and project belong to. 138 #if [ "$OS_IDENTITY_API_VERSION" = "3" ]; then 139 # export OS_USER_DOMAIN_ID=${OS_USER_DOMAIN_ID:-"default"} 140 # export OS_PROJECT_DOMAIN_ID=${OS_PROJECT_DOMAIN_ID:-"default"} 141 #fi 142 #EOF 143 144 # Prep the testing environment by creating the required testing resources and environment variables 145 source openrc admin 146 wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img 147 glance image-create --name CirrOS --disk-format qcow2 --container-format bare < cirros-0.3.4-x86_64-disk.img 148 nova flavor-create m1.tform 99 512 5 1 --ephemeral 10 149 _NETWORK_ID=$(nova net-list | grep private | awk -F\| '{print $2}' | tr -d ' ') 150 _EXTGW_ID=$(nova net-list | grep public | awk -F\| '{print $2}' | tr -d ' ') 151 _IMAGE_ID=$(nova image-list | grep CirrOS | awk -F\| '{print $2}' | tr -d ' ' | head -1) 152 echo export OS_IMAGE_NAME="cirros-0.3.4-x86_64-uec" >> openrc 153 echo export OS_IMAGE_ID="$_IMAGE_ID" >> openrc 154 echo export OS_NETWORK_ID=$_NETWORK_ID >> openrc 155 echo export OS_EXTGW_ID=$_EXTGW_ID >> openrc 156 echo export OS_POOL_NAME="public" >> openrc 157 echo export OS_FLAVOR_ID=99 >> openrc 158 source openrc demo 159 160 # Replace the below lines with the repo/branch you want to test 161 #git remote add jtopjian https://github.com/jtopjian/terraform 162 #git fetch jtopjian 163 #git checkout --track jtopjian/openstack-secgroup-safe-delete 164 #make testacc TEST=./builtin/providers/openstack TESTARGS='-run=AccBlockStorageV1' 165 #make testacc TEST=./builtin/providers/openstack TESTARGS='-run=AccCompute' 166 #make testacc TEST=./builtin/providers/openstack