diff options
author | Pavel Raiskup <praiskup@redhat.com> | 2014-10-03 13:53:22 +0200 |
---|---|---|
committer | Pavel Raiskup <praiskup@redhat.com> | 2014-10-03 14:24:26 +0200 |
commit | dd52a3df190ad677e23654dbba8bf553565a159b (patch) | |
tree | 50dc25d35110c45c05bbab6ec319dd4a92836a33 /get_machine | |
parent | 37c8dc6c89714e553bb5ce32a83910a1407d7067 (diff) | |
download | postgresql-setup-tests-dd52a3df190ad677e23654dbba8bf553565a159b.tar.gz postgresql-setup-tests-dd52a3df190ad677e23654dbba8bf553565a159b.tar.xz postgresql-setup-tests-dd52a3df190ad677e23654dbba8bf553565a159b.zip |
ansible: incorporate os1 triggers
* ansible/dummy-wrapper.yml: Helper playbook to directly invoke
"included" playbooks.
* ansible/fedora.yml: The "main" playbook (new file).
* ansible/include/beakerlib.yml: New file, install beakerlib
remotely.
* ansible/include/prepare-testenv.yml: Install the test
dependencies remotely.
* ansible/run_include: Helper script to run included playbooks.
* dist: Do not distribute ansible playbooks in tarball.
* get_machine: Helper script to obtain openstack machine, not
used currently.
* lib_pgsql.sh: Assert for PG_VERSION, not for datadir (as it by
default exists after postgresql-server installation.
* run_remote: Helper script invoking the main ansible playbook.
* ansible_helpers/wait-for-ssh: Helper script as 'wait_for' is
broken?
* README: Document.
* .gitignore: Ignore private files.
Diffstat (limited to 'get_machine')
-rwxr-xr-x | get_machine | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/get_machine b/get_machine new file mode 100755 index 0000000..963cc35 --- /dev/null +++ b/get_machine @@ -0,0 +1,85 @@ +#!/bin/bash + +. ./osrc.sh + +image_f20="db-f20_x86_64-cloud-0.0-2" +flavor="m1.small" + +info() { echo " * $@" ; } + +option_distro="" + +function show_help() +{ +cat <<EOHELP >&2 +Usage: $0 OPTION + +Script is aimed to help sysadmin. + +Options: + --distro Distro version, like fedora-20 +EOHELP +test -n "$1" && exit $1 +} + +ARGS=`getopt -o "" -l "help,distro:" -n "$0" -- "$@"` \ + || exit 1 + +eval set -- "$ARGS" + +while true; do + case "$1" in + --distro) + case "$2" in + fedora-*) + option_distro=$2 + ;; + *) + echo "bad distro option $2, use fedora-20, etc." + exit 1 + ;; + esac + shift 2 + ;; + --help) + show_help 0 + ;; + --) + shift + break; + esac +done + +image_var=image_f${option_distro##fedora-} +eval "image=\$$image_var" +test -z "$image" && echo "no such image $image_var" && exit 1 + + +boot() +{ + x=$( + nova boot "$1" --poll --image "$2" --flavor "$3" \ + --security-groups praiskup-dbt \ + --key-name praiskup-test \ + | grep "| id " | cut -d\| -f 3 + ) + echo $x +} + +get_ip() +{ + local id="$1" + ip=$( + nova show "$id" | grep ' network ' \ + | cut -d\| -f 3 | cut -d, -f2 + ) + echo $ip +} + +info "booting machine $option_distro from $image" + +machine=`boot "testing-$image_var" "$image" "$flavor"` +info "machine id: $machine" + +ip=`get_ip $machine` +info "ip: $ip" |