Skip to content

Commit 85f8c1e

Browse files
author
Matthew Fisher
committed
make small improvements to the rackspace script
knife-rackspace does not respect the --ssh-identity option, so we have to deal with the default SSH key i.e. id_rsa.pub. The server name is also randomized so duplicate controllers can exist. The default user is root.
1 parent 36a55b9 commit 85f8c1e

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

contrib/rackspace/provision-rackspace-controller.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fi
3030
#################
3131
# chef settings #
3232
#################
33-
node_name=deis-controller
33+
node_name="deis-controller-$(LC_CTYPE=C tr -dc A-Za-z0-9 < /dev/urandom | head -c 5 | xargs)"
3434
run_list="recipe[deis::controller]"
3535
chef_version=11.8.2
3636

@@ -57,21 +57,25 @@ fi
5757
################
5858
# SSH settings #
5959
################
60-
key_name=deis-controller
60+
key_name=id_rsa
6161
ssh_key_path=~/.ssh/$key_name
62-
ssh_user="ubuntu" # doesn't work?
62+
ssh_user="root"
6363

6464
# create ssh keypair and store it
6565
if ! test -e $ssh_key_path; then
6666
echo_color "Creating new SSH key: $key_name"
6767
set -x
68-
ssh-keygen -f $ssh_key_path -t rsa -N '' -C "deis-controller" >/dev/null
68+
ssh-keygen -f $ssh_key_path -t rsa -N '' -C "$USER" >/dev/null
6969
set +x
7070
echo_color "Saved to $ssh_key_path"
7171
else
7272
echo_color "WARNING: SSH key $ssh_key_path exists"
7373
fi
7474

75+
# upload the user's SSH key to Rackspace.
76+
# if it fails, that means that it's already been uploaded.
77+
nova keypair-add --pub-key $ssh_key_path.pub deis > /dev/null 2>&1
78+
7579
# create data bags
7680
knife data bag create deis-formations 2>/dev/null
7781
knife data bag create deis-apps 2>/dev/null
@@ -86,7 +90,6 @@ knife rackspace server create \
8690
--flavor $flavor \
8791
--rackspace-metadata "{\"Name\": \"$node_name\"}" \
8892
--rackspace-disk-config MANUAL \
89-
--identity-file $ssh_key_path \
9093
--server-name $node_name \
9194
--node-name $node_name \
9295
--run-list $run_list

0 commit comments

Comments
 (0)