github.com/ottenhoff/terraform@v0.7.0-rc1.0.20160607213102-ac2d195cc560/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/tools/godep
    23  go get github.com/hashicorp/terraform
    24  cd $GOPATH/src/github.com/hashicorp/terraform
    25  godep restore
    26  
    27  cd
    28  git clone https://git.openstack.org/openstack-dev/devstack -b stable/mitaka
    29  cd devstack
    30  cat >local.conf <<EOF
    31  [[local|localrc]]
    32  # OpenStack version
    33  OPENSTACK_VERSION="mitaka"
    34  
    35  # devstack password
    36  DEVSTACK_PASSWORD="password"
    37  
    38  # Configure passwords and the Swift Hash
    39  MYSQL_PASSWORD=\$DEVSTACK_PASSWORD
    40  RABBIT_PASSWORD=\$DEVSTACK_PASSWORD
    41  SERVICE_TOKEN=\$DEVSTACK_PASSWORD
    42  ADMIN_PASSWORD=\$DEVSTACK_PASSWORD
    43  SERVICE_PASSWORD=\$DEVSTACK_PASSWORD
    44  SWIFT_HASH=\$DEVSTACK_PASSWORD
    45  
    46  # Configure the stable OpenStack branches used by DevStack
    47  # For stable branches see
    48  # http://git.openstack.org/cgit/openstack-dev/devstack/refs/
    49  CINDER_BRANCH=stable/\$OPENSTACK_VERSION
    50  CEILOMETER_BRANCH=stable/\$OPENSTACK_VERSION
    51  GLANCE_BRANCH=stable/\$OPENSTACK_VERSION
    52  HEAT_BRANCH=stable/\$OPENSTACK_VERSION
    53  HORIZON_BRANCH=stable/\$OPENSTACK_VERSION
    54  KEYSTONE_BRANCH=stable/\$OPENSTACK_VERSION
    55  NEUTRON_BRANCH=stable/\$OPENSTACK_VERSION
    56  NOVA_BRANCH=stable/\$OPENSTACK_VERSION
    57  SWIFT_BRANCH=stable/\$OPENSTACK_VERSION
    58  ZAQAR_BRANCH=stable/\$OPENSTACK_VERSION
    59  
    60  # Enable Swift
    61  enable_service s-proxy
    62  enable_service s-object
    63  enable_service s-container
    64  enable_service s-account
    65  
    66  # Disable Nova Network and enable Neutron
    67  disable_service n-net
    68  enable_service q-svc
    69  enable_service q-agt
    70  enable_service q-dhcp
    71  enable_service q-l3
    72  enable_service q-meta
    73  enable_service q-metering
    74  enable_service q-lbaas
    75  enable_service q-fwaas
    76  
    77  # Enable Trove
    78  enable_plugin trove git://git.openstack.org/openstack/trove.git stable/\$OPENSTACK_VERSION
    79  enable_service trove,tr-api,tr-tmgr,tr-cond
    80  
    81  # Disable Temptest
    82  disable_service tempest
    83  
    84  # Disable Horizon
    85  disable_service horizon
    86  
    87  # Enable Ceilometer
    88  #enable_service ceilometer-acompute
    89  #enable_service ceilometer-acentral
    90  #enable_service ceilometer-anotification
    91  #enable_service ceilometer-collector
    92  #enable_service ceilometer-alarm-evaluator
    93  #enable_service ceilometer-alarm-notifier
    94  #enable_service ceilometer-api
    95  
    96  # Enable Zaqar
    97  #enable_plugin zaqar https://github.com/openstack/zaqar
    98  #enable_service zaqar-server
    99  
   100  # Automatically download and register a VM image that Heat can launch
   101  # For more information on Heat and DevStack see
   102  # http://docs.openstack.org/developer/heat/getting_started/on_devstack.html
   103  #IMAGE_URLS+=",http://cloud.fedoraproject.org/fedora-20.x86_64.qcow2"
   104  #IMAGE_URLS+=",https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img"
   105  
   106  # Logging
   107  LOGDAYS=1
   108  LOGFILE=/opt/stack/logs/stack.sh.log
   109  LOGDIR=/opt/stack/logs
   110  EOF
   111  ./stack.sh
   112  
   113  # Prep the testing environment by creating the required testing resources and environment variables
   114  source openrc admin
   115  wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
   116  glance image-create --name CirrOS --disk-format qcow2 --container-format bare < cirros-0.3.4-x86_64-disk.img
   117  nova flavor-create m1.tform 99 512 5 1 --ephemeral 10
   118  _NETWORK_ID=$(nova net-list | grep private | awk -F\| '{print $2}' | tr -d ' ')
   119  _EXTGW_ID=$(nova net-list | grep public | awk -F\| '{print $2}' | tr -d ' ')
   120  _IMAGE_ID=$(nova image-list | grep CirrOS | awk -F\| '{print $2}' | tr -d ' ' | head -1)
   121  echo export OS_IMAGE_NAME="cirros-0.3.4-x86_64-uec" >> openrc
   122  echo export OS_IMAGE_ID="$_IMAGE_ID" >> openrc
   123  echo export OS_NETWORK_ID=$_NETWORK_ID >> openrc
   124  echo export OS_EXTGW_ID=$_EXTGW_ID >> openrc
   125  echo export OS_POOL_NAME="public" >> openrc
   126  echo export OS_FLAVOR_ID=99 >> openrc
   127  source openrc demo
   128  
   129  # Replace the below lines with the repo/branch you want to test
   130  #git remote add jtopjian https://github.com/jtopjian/terraform
   131  #git fetch jtopjian
   132  #git checkout --track jtopjian/openstack-secgroup-safe-delete
   133  #make testacc TEST=./builtin/providers/openstack TESTARGS='-run=AccBlockStorageV1'
   134  #make testacc TEST=./builtin/providers/openstack TESTARGS='-run=AccCompute'
   135  #make testacc TEST=./builtin/providers/openstack