forked from openstack/devstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlocal.sh
More file actions
executable file
·59 lines (41 loc) · 1.43 KB
/
local.sh
File metadata and controls
executable file
·59 lines (41 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env bash
# Sample ``local.sh`` for user-configurable tasks to run automatically
# at the sucessful conclusion of ``stack.sh``.
# 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
TOP_DIR=$(cd $(dirname "$0") && pwd)
# Use openrc + stackrc + localrc for settings
source $TOP_DIR/stackrc
# Destination path for installation ``DEST``
DEST=${DEST:-/opt/stack}
# Import ssh keys
# ---------------
# Import keys from the current user into the default OpenStack user (usually
# ``demo``)
# Get OpenStack auth
source $TOP_DIR/openrc
# Add first keypair found in localhost:$HOME/.ssh
for i in $HOME/.ssh/id_rsa.pub $HOME/.ssh/id_dsa.pub; do
if [[ -f $i ]]; then
nova keypair-add --pub_key=$i `hostname`
break
fi
done
# Create A Flavor
# ---------------
# Get OpenStack admin auth
source $TOP_DIR/openrc admin admin
# Name of new flavor
# set in ``localrc`` with ``DEFAULT_INSTANCE_TYPE=m1.micro``
MI_NAME=m1.micro
# Create micro flavor if not present
if [[ -z $(nova flavor-list | grep $MI_NAME) ]]; then
nova flavor-create $MI_NAME 6 128 0 1
fi
# Other Uses
# ----------
# Add tcp/22 to default security group