summaryrefslogtreecommitdiffstats
path: root/controller/ansible/fedora.yml
blob: cc64eaccbf3a3ae87f82922ce5952e5e324c9e64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
- name: self-standing testsuite
  remote_user: root
  gather_facts: False
  hosts: localhost
  vars_files:
  - "{{ opt_credsfile }}"

  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 ../ansible_helpers/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
  tasks:
  - copy: src={{ opt_workdir }}/{{ opt_testsuite_name }}.tar.gz
        dest=/root/{{ opt_testsuite_name }}.tar.gz

  - include: include/beakerlib.yml

  - include: include/prepare-testenv.yml

  - include: 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: include/download-results.yml

  - name: stop the vm
    shell: echo "not implemented yet"
    when: test_result.rc == 0