From dd52a3df190ad677e23654dbba8bf553565a159b Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Fri, 3 Oct 2014 13:53:22 +0200 Subject: 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. --- get_machine | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100755 get_machine (limited to 'get_machine') 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 <&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" -- cgit