From 83edd3a996c506b6a1988d0c68214e9a849397d8 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Thu, 23 Oct 2014 15:13:36 +0200 Subject: controller: autoconfiscate First part of converting controller to autoconf/automake solution. * .gitignore: New gitignore; autotools ignores. * Makefile.am: New file. * get_machine: Renamed to template bin/dtf-get-machine.in. * bin/dtf-get-machine.in: New template based on get_machine. * run_remote: Renamed to template bin/dtf-run-remote.in. * bin/dtf-run-remote.in: New binary template from run_remote. * build: New bootstrap like helper script (git-only). * configure.ac: New file. * etc/dtf.sh.in: Likewise. * ansible_helpers/wait-for-ssh: Renamed to libexec/dtf-wait-for-ssh. * share/dtf-controller/parse_credsfile: Reworked script for parsing OS credentials. * parse_credsfile: Moved to share/dtf-controller. * libexec/dtf-wait-for-ssh: Renamed from wait-for-ssh. * ansible/*: Moved into share/dtf-controller/ansible/*. * share/dtf-controller/ansible/vars/generated-vars.yml.in: New template file exporting configure-time variables into playbooks. --- .../dtf-controller/ansible/playbooks/fedora.yml | 68 ++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 controller/share/dtf-controller/ansible/playbooks/fedora.yml (limited to 'controller/share/dtf-controller/ansible/playbooks/fedora.yml') diff --git a/controller/share/dtf-controller/ansible/playbooks/fedora.yml b/controller/share/dtf-controller/ansible/playbooks/fedora.yml new file mode 100644 index 0000000..215e048 --- /dev/null +++ b/controller/share/dtf-controller/ansible/playbooks/fedora.yml @@ -0,0 +1,68 @@ +- name: self-standing testsuite + remote_user: root + gather_facts: False + hosts: localhost + vars_files: + - "{{ opt_credsfile }}" + - "{{ opt_generated_vars }}" + + tasks: + - name: generate builder name + local_action: shell echo `dd if=/dev/urandom bs=1k count=10 | md5sum ; echo DBTESTS` + register: vm_name + + - debug: msg="osusername={{ os_username }}" + + - name: spin it up + local_action: nova_compute auth_url={{os_auth_url}} + flavor_id={{os_flavor_id}} image_id="{{ os_image_id }}" key_name={{ os_keypair }} + login_password={{os_nova_password}} login_tenant_name="{{os_tenant_name}}" + login_username={{os_username}} security_groups={{os_security_group}} + wait=yes name="{{vm_name.stdout}}" wait_for=600 + register: nova + + - debug: msg="{{ nova.info.addresses }}" + + # This is ugly as hell... Hopefully nothing will be changing. + - local_action: command echo "{{ nova.info.addresses[os_network_dev][1].addr }}" + register: machine_ip + + - debug: msg="{{ machine_ip.stdout }}" + + - name: wait for the host to be hot + local_action: wait_for host={{ machine_ip.stdout }} port=22 delay=5 timeout=600 + + - local_action: shell {{ config_libexecdir }}/dtf-wait-for-ssh "root@{{ machine_ip.stdout }}" + + - name: add it to the special group + local_action: add_host hostname={{ machine_ip.stdout }} + groupname=temp_group + +- hosts: temp_group + user: root + gather_facts: False + vars_files: + - "{{ opt_credsfile }}" + - "{{ opt_generated_vars }}" + tasks: + - 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 + + - shell: cd /root && tar -xf {{ opt_testsuite_name }}.tar.gz + + - shell: cd /root/{{ opt_testsuite_name }}&& ./run &>/var/tmp/dtf-run.overview + register: test_result + ignore_errors: yes + + - include: "{{ config_ansibleplaybooksdir }}/include/download-results.yml" + + - name: stop the vm + shell: echo "not implemented yet" + when: test_result.rc == 0 -- cgit