blob: 83637f983b6a632bf3ca57db5cef1752544a25f9 [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
16# Use openrc + stackrc + localrc for settings
17source $TOP_DIR/stackrc
18
19# Destination path for installation ``DEST``
20DEST=${DEST:-/opt/stack}
21
22
23# Import ssh keys
24# ---------------
25
26# Import keys from the current user into the default OpenStack user (usually
27# ``demo``)
28
29# Get OpenStack auth
30source $TOP_DIR/openrc
31
32# Add first keypair found in localhost:$HOME/.ssh
33for i in $HOME/.ssh/id_rsa.pub $HOME/.ssh/id_dsa.pub; do
34 if [[ -f $i ]]; then
35 nova keypair-add --pub_key=$i `hostname`
36 break
37 fi
38done
39
40
41# Create A Flavor
42# ---------------
43
44# Get OpenStack admin auth
45source $TOP_DIR/openrc admin admin
46
47# Name of new flavor
48# set in ``localrc`` with ``DEFAULT_INSTANCE_TYPE=m1.micro``
49MI_NAME=m1.micro
50
51# Create micro flavor if not present
52if [[ -z $(nova flavor-list | grep $MI_NAME) ]]; then
53 nova flavor-create $MI_NAME 6 128 0 1
54fi
55# Other Uses
56# ----------
57
58# Add tcp/22 to default security group
59