local.sh

Sample local.sh for user-configurable tasks to run automatically at the successful conclusion of stack.sh.

# DIVIDER #!/usr/bin/env bash # DIVIDER # DIVIDER # DIVIDER TOP_DIR=$(cd $(dirname "$0") && pwd) # DIVIDER source $TOP_DIR/functions # DIVIDER source $TOP_DIR/stackrc # DIVIDER DEST=${DEST:-/opt/stack} if is_service_enabled nova; then # DIVIDER # DIVIDER # DIVIDER source $TOP_DIR/openrc # DIVIDER for i in $HOME/.ssh/id_rsa.pub $HOME/.ssh/id_dsa.pub; do if [[ -r $i ]]; then nova keypair-add --pub_key=$i `hostname` break fi done # DIVIDER # DIVIDER source $TOP_DIR/openrc admin admin # DIVIDER MI_NAME=m1.micro # DIVIDER if [[ -z $(nova flavor-list | grep $MI_NAME) ]]; then nova flavor-create $MI_NAME 6 128 0 1 fi # DIVIDER # DIVIDER nova secgroup-add-rule default tcp 22 22 0.0.0.0/0 nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0 fi # DIVIDER

NOTE: Copy this file to the root DevStack directory for it to work properly.

This is a collection of some of the things we have found to be useful to run after stack.sh to tweak the OpenStack configuration that DevStack produces. These should be considered as samples and are unsupported DevStack code.

Keep track of the DevStack directory

Import common functions

Use openrc + stackrc + localrc for settings

Destination path for installation DEST

Import ssh keys

Import keys from the current user into the default OpenStack user (usually demo)

Get OpenStack user auth

Add first keypair found in localhost:$HOME/.ssh

Create A Flavor

Get OpenStack admin auth

Name of new flavor set in local.conf with DEFAULT_INSTANCE_TYPE=m1.micro

Create micro flavor if not present

Other Uses

Add tcp/22 and icmp to default security group