github.com/erriapo/terraform@v0.6.12-0.20160203182612-0340ea72354f/builtin/providers/openstack/devstack/deploy.sh (about)

     1  #!/bin/bash
     2  
     3  sudo apt-get update
     4  sudo apt-get install -y git make mercurial
     5  
     6  GOPKG=go1.5.2.linux-amd64.tar.gz
     7  wget https://storage.googleapis.com/golang/$GOPKG
     8  sudo tar -xvf $GOPKG -C /usr/local/
     9  
    10  mkdir ~/go
    11  echo 'export GOPATH=$HOME/go' >> .bashrc
    12  echo 'export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin' >> .bashrc
    13  source .bashrc
    14  export GOPATH=$HOME/go
    15  export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
    16  
    17  go get github.com/hashicorp/terraform
    18  cd $GOPATH/src/github.com/hashicorp/terraform
    19  make updatedeps
    20  
    21  cd
    22  git clone https://git.openstack.org/openstack-dev/devstack -b stable/liberty
    23  cd devstack
    24  cat >local.conf <<EOF
    25  [[local|localrc]]
    26  # OpenStack version
    27  OPENSTACK_VERSION="liberty"
    28  
    29  # devstack password
    30  DEVSTACK_PASSWORD="password"
    31  
    32  # Configure passwords and the Swift Hash
    33  MYSQL_PASSWORD=\$DEVSTACK_PASSWORD
    34  RABBIT_PASSWORD=\$DEVSTACK_PASSWORD
    35  SERVICE_TOKEN=\$DEVSTACK_PASSWORD
    36  ADMIN_PASSWORD=\$DEVSTACK_PASSWORD
    37  SERVICE_PASSWORD=\$DEVSTACK_PASSWORD
    38  SWIFT_HASH=\$DEVSTACK_PASSWORD
    39  
    40  # Configure the stable OpenStack branches used by DevStack
    41  # For stable branches see
    42  # http://git.openstack.org/cgit/openstack-dev/devstack/refs/
    43  CINDER_BRANCH=stable/\$OPENSTACK_VERSION
    44  CEILOMETER_BRANCH=stable/\$OPENSTACK_VERSION
    45  GLANCE_BRANCH=stable/\$OPENSTACK_VERSION
    46  HEAT_BRANCH=stable/\$OPENSTACK_VERSION
    47  HORIZON_BRANCH=stable/\$OPENSTACK_VERSION
    48  KEYSTONE_BRANCH=stable/\$OPENSTACK_VERSION
    49  NEUTRON_BRANCH=stable/\$OPENSTACK_VERSION
    50  NOVA_BRANCH=stable/\$OPENSTACK_VERSION
    51  SWIFT_BRANCH=stable/\$OPENSTACK_VERSION
    52  ZAQAR_BRANCH=stable/\$OPENSTACK_VERSION
    53  
    54  # Enable Swift
    55  enable_service s-proxy
    56  enable_service s-object
    57  enable_service s-container
    58  enable_service s-account
    59  
    60  # Disable Nova Network and enable Neutron
    61  disable_service n-net
    62  enable_service q-svc
    63  enable_service q-agt
    64  enable_service q-dhcp
    65  enable_service q-l3
    66  enable_service q-meta
    67  enable_service q-metering
    68  enable_service q-lbaas
    69  enable_service q-fwaas
    70  
    71  # Disable Tempest
    72  disable_service tempest
    73  
    74  # Disable Horizon
    75  disable_service horizon
    76  
    77  # Enable Ceilometer
    78  #enable_service ceilometer-acompute
    79  #enable_service ceilometer-acentral
    80  #enable_service ceilometer-anotification
    81  #enable_service ceilometer-collector
    82  #enable_service ceilometer-alarm-evaluator
    83  #enable_service ceilometer-alarm-notifier
    84  #enable_service ceilometer-api
    85  
    86  # Enable Zaqar
    87  #enable_plugin zaqar https://github.com/openstack/zaqar
    88  #enable_service zaqar-server
    89  
    90  # Automatically download and register a VM image that Heat can launch
    91  # For more information on Heat and DevStack see
    92  # http://docs.openstack.org/developer/heat/getting_started/on_devstack.html
    93  #IMAGE_URLS+=",http://cloud.fedoraproject.org/fedora-20.x86_64.qcow2"
    94  
    95  # Logging
    96  LOGDAYS=1
    97  LOGFILE=/opt/stack/logs/stack.sh.log
    98  LOGDIR=/opt/stack/logs
    99  EOF
   100  ./stack.sh
   101  
   102  # Prep the testing environment by creating the required testing resources and environment variables
   103  source openrc admin
   104  wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
   105  glance image-create --name CirrOS --disk-format qcow2 --container-format bare < cirros-0.3.4-x86_64-disk.img
   106  nova flavor-create m1.tform 99 512 5 1 --ephemeral 10
   107  _NETWORK_ID=$(nova net-list | grep private | awk -F\| '{print $2}' | tr -d ' ')
   108  _IMAGE_ID=$(nova image-list | grep CirrOS | awk -F\| '{print $2}' | tr -d ' ' | head -1)
   109  echo export OS_IMAGE_NAME="cirros-0.3.4-x86_64-uec" >> openrc
   110  echo export OS_IMAGE_ID="$_IMAGE_ID" >> openrc
   111  echo export OS_NETWORK_ID=$_NETWORK_ID >> openrc
   112  echo export OS_POOL_NAME="public" >> openrc
   113  echo export OS_FLAVOR_ID=99 >> openrc
   114  source openrc demo
   115  
   116  cd $GOPATH/src/github.com/hashicorp/terraform
   117  make updatedeps
   118  
   119  # Replace the below lines with the repo/branch you want to test
   120  #git remote add jtopjian https://github.com/jtopjian/terraform
   121  #git fetch jtopjian
   122  #git checkout --track jtopjian/openstack-acctest-fixes
   123  #make testacc TEST=./builtin/providers/openstack TESTARGS='-run=AccBlockStorageV1'
   124  #make testacc TEST=./builtin/providers/openstack TESTARGS='-run=AccCompute'
   125  #make testacc TEST=./builtin/providers/openstack