diff options
-rw-r--r-- | controller/Makefile.am | 5 | ||||
-rw-r--r-- | controller/bin/dtf-controller.in | 1 | ||||
-rw-r--r-- | controller/bin/dtf-run-remote.in | 72 | ||||
-rw-r--r-- | controller/share/dtf-controller/ansible/playbooks/default.yml (renamed from controller/share/dtf-controller/ansible/playbooks/fedora.yml) | 5 | ||||
-rw-r--r-- | controller/share/dtf-controller/ansible/playbooks/include/prepare-testenv.yml | 3 |
5 files changed, 55 insertions, 31 deletions
diff --git a/controller/Makefile.am b/controller/Makefile.am index e271af9..b35357c 100644 --- a/controller/Makefile.am +++ b/controller/Makefile.am @@ -26,7 +26,7 @@ ansibleplaybooksdir = $(pkgdatadir)/ansible/playbooks ansiblevars_DATA = share/dtf-controller/ansible/vars/generated-vars.yml dtfplaybookdir = $(pkgdatadir)/ansible/playbooks -ansibleplaybooks_DATA = $(srcdir)/share/dtf-controller/ansible/playbooks/fedora.yml +ansibleplaybooks_DATA = $(srcdir)/share/dtf-controller/ansible/playbooks/default.yml resulttemplatedir = $(pkgdatadir)/results-stats-templates resulttemplate_DATA = $(srcdir)/share/dtf-controller/results-stats-templates/html.tmpl @@ -83,9 +83,8 @@ CONTROLLERDATA = \ $(srcdir)/share/dtf-controller/ansible/run_include \ $(srcdir)/share/dtf-controller/ansible/playbooks/include/beakerlib.yml \ $(srcdir)/share/dtf-controller/ansible/playbooks/include/additional-packages.yml \ - $(srcdir)/share/dtf-controller/ansible/playbooks/include/prepare-testenv.yml \ $(srcdir)/share/dtf-controller/ansible/playbooks/include/download-results.yml \ - $(srcdir)/share/dtf-controller/ansible/playbooks/fedora.yml \ + $(srcdir)/share/dtf-controller/ansible/playbooks/default.yml \ $(srcdir)/share/dtf-controller/ansible/dummy-wrapper.yml diff --git a/controller/bin/dtf-controller.in b/controller/bin/dtf-controller.in index 0c80ef5..a231270 100644 --- a/controller/bin/dtf-controller.in +++ b/controller/bin/dtf-controller.in @@ -71,6 +71,7 @@ sub child_task '--workdir', $dir, '--distro', $run->{distro}, '--distro-version', $run->{distro_version}, + '--setup-playbook', $run->{setup_playbook}, ], "$dir/dtf-run-remote.out", "$dir/dtf-run-remote.err"; diff --git a/controller/bin/dtf-run-remote.in b/controller/bin/dtf-run-remote.in index b83b79c..14f81a4 100644 --- a/controller/bin/dtf-run-remote.in +++ b/controller/bin/dtf-run-remote.in @@ -2,9 +2,7 @@ . "@sysconfdir@/dtf.sh" || exit 1 -longopts="verbose,help,force,testid:,listonly" - -run_playbook=${run_playbook-@ansibleplaybooksdir@/fedora.yml} +run_playbook=${run_playbook-@ansibleplaybooksdir@/default.yml} opt_workdir= opt_distro=fedora @@ -12,26 +10,31 @@ opt_openstack_instance="$DTF_OPENSTACK_DEFAULT_ID" opt_distro_ver=20 opt_extra_rpms= opt_taskdir= +opt_setup_playbook= +opt_help=false -die() { echo >&2 "$@" ; exit 1 ; } +die() { echo >&2 "$*" ; exit 1 ; } +error() { echo >&2 "$*" ; } -longopts="distro:,distro-version:,workdir:,openstack-instance:,extra-rpms-file:" -longopts+=",taskdir:" +longopts="help" +longopts+=",distro:,distro-version:,workdir:,openstack-instance:,extra-rpms-file:" +longopts+=",taskdir:,setup-playbook:" ARGS=$(getopt -o "v" -l "$longopts" -n "getopt" -- "$@") \ || exit 1 eval set -- "$ARGS" while true; do case "$1" in - --taskdir) + --taskdir|--setup-playbook|--distro|--openstack-instance|--workdir) opt=$(sed -e 's/^--//' -e 's/[^[a-zA-Z0-9]/_/g'<<<"$1") eval "opt_$opt=\"${2,,}\"" shift 2 ;; - --distro) - opt_distro="$2" - shift 2 + --help) + opt=$(sed -e 's/^--//' -e 's/[^[a-zA-Z0-9]/_/g'<<<"$1") + eval "opt_$opt=true" + shift ;; --distro-version) @@ -39,17 +42,6 @@ while true; do shift 2 ;; - --openstack-instance) - opt_openstack_instance="$2" - shift 2 - ;; - - --workdir) - # where the remote results are fetched into - opt_workdir="$2" - shift 2 - ;; - --extra-rpms-file) opt_extra_rpms="$(readlink -f "$2")" shift 2 @@ -68,8 +60,41 @@ while true; do esac done -test -z "$opt_openstack_instance" && die "option --openstack-instance=ID not used" -test -z "$opt_taskdir" && die "you must specify --taskdir" +$opt_help && { +cat <<EOF +Usage: $0 OPTIONS + +Script which runs the dtf testsuite remotely. For that purpose, it starts fresh +VM (currently in OpenStack), runs the testsuite and collects results. + +Options: + --taskdir=DIR The root-directory of dtf testsuite + --distro=DISTRO Linux distribution name (e.g. fedora) + --distro-version=VER Version of DISTRO, e.g. 20 + --workdir=DIR Do not create temporary directory for results and + rather use pre-created DIR + +Global options: + --openstack-instance=OID The OS identifier matching with configuration + --help Shows this help +EOF +exit 0 +} + +optparse_error=false +test -z "$opt_openstack_instance" \ + && error "option --openstack-instance=ID not" \ + && optparse_error=true + +test -z "$opt_taskdir" \ + && error "you must specify '--taskdir DIR'" \ + && optparse_error=true + +test -z "$opt_setup_playbook" \ + && error "you must specify '--setup-playbook PLAYBOOK'" \ + && optparse_error=true + +$optparse_error && exit 1 credsfile="$HOME/.dtf/private/os/$opt_openstack_instance.yml" test ! -f "$credsfile" && die "creds file '$credsfile' not found" @@ -105,6 +130,7 @@ testsuite_name="$(tarball)" || die "can not create dist tarball" export ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -v "$run_playbook" \ --extra-vars "opt_generated_vars=@ansiblevarsdir@/generated-vars.yml" \ + --extra-vars "opt_setup_playbook='$opt_setup_playbook'" \ --extra-vars "opt_distro=$opt_distro" \ --extra-vars "opt_distro_ver=$opt_distro_ver" \ --extra-vars "opt_workdir=$opt_workdir" \ diff --git a/controller/share/dtf-controller/ansible/playbooks/fedora.yml b/controller/share/dtf-controller/ansible/playbooks/default.yml index ea39e70..825ee46 100644 --- a/controller/share/dtf-controller/ansible/playbooks/fedora.yml +++ b/controller/share/dtf-controller/ansible/playbooks/default.yml @@ -32,13 +32,14 @@ vars_files: - "{{ opt_generated_vars }}" tasks: + - include: "{{ opt_setup_playbook }}" + when: opt_setup_playbook is defined + - copy: src={{ opt_workdir }}/{{ opt_testsuite_name }}.tar.gz dest=/root/{{ opt_testsuite_name }}.tar.gz - include: "{{ config_ansibleplaybooksdir }}/include/beakerlib.yml" - - include: "{{ config_ansibleplaybooksdir }}/include/prepare-testenv.yml" - - include: "{{ config_ansibleplaybooksdir }}/include/additional-packages.yml" when: dtf_rpm_files_list is defined diff --git a/controller/share/dtf-controller/ansible/playbooks/include/prepare-testenv.yml b/controller/share/dtf-controller/ansible/playbooks/include/prepare-testenv.yml deleted file mode 100644 index a63e51a..0000000 --- a/controller/share/dtf-controller/ansible/playbooks/include/prepare-testenv.yml +++ /dev/null @@ -1,3 +0,0 @@ -- yum: state=present name=postgresql-server - -- yum: state=present name=postgresql-upgrade |