blob: 2c54b10f1638d6c748dd3d4f34b4e88c6022a9ab [file] [log] [blame]
Dean Troyerf5633dd2012-03-28 11:21:40 -05001#!/usr/bin/env bash
2
3# Sample ``local.sh`` for user-configurable tasks to run automatically
4# at the sucessful conclusion of ``stack.sh``.
5
6# NOTE: Copy this file to the root ``devstack`` directory for it to
7# work properly.
8
9# This is a collection of some of the things we have found to be useful to run
10# after stack.sh to tweak the OpenStack configuration that DevStack produces.
11# These should be considered as samples and are unsupported DevStack code.
12
13# Keep track of the devstack directory
14TOP_DIR=$(cd $(dirname "$0") && pwd)
15
Dean Troyer05530ca2012-07-06 15:09:10 -050016# Import common functions
17source $TOP_DIR/functions
18
Dean Troyerf5633dd2012-03-28 11:21:40 -050019# Use openrc + stackrc + localrc for settings
20source $TOP_DIR/stackrc
21
22# Destination path for installation ``DEST``
23DEST=${DEST:-/opt/stack}
24
25
26# Import ssh keys
27# ---------------
28
29# Import keys from the current user into the default OpenStack user (usually
30# ``demo``)
31
32# Get OpenStack auth
33source $TOP_DIR/openrc
34
35# Add first keypair found in localhost:$HOME/.ssh
36for i in $HOME/.ssh/id_rsa.pub $HOME/.ssh/id_dsa.pub; do
37 if [[ -f $i ]]; then
38 nova keypair-add --pub_key=$i `hostname`
39 break
40 fi
41done
42
43
44# Create A Flavor
45# ---------------
46
47# Get OpenStack admin auth
48source $TOP_DIR/openrc admin admin
49
50# Name of new flavor
51# set in ``localrc`` with ``DEFAULT_INSTANCE_TYPE=m1.micro``
52MI_NAME=m1.micro
53
54# Create micro flavor if not present
55if [[ -z $(nova flavor-list | grep $MI_NAME) ]]; then
56 nova flavor-create $MI_NAME 6 128 0 1
57fi
58# Other Uses
59# ----------
60
61# Add tcp/22 to default security group
62