Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 1 | --- |
| 2 | # test-examplservice/tasks/main.yml |
| 3 | # |
| 4 | # Run tests to check that the single-node deployment has worked |
| 5 | |
| 6 | - name: Onboard ExampleService and instantiate a VM |
Scott Baker | 995641b | 2016-11-15 17:09:26 -0800 | [diff] [blame] | 7 | make: |
| 8 | chdir: "{{ service_profile_repo_dest }}/{{ xos_configuration }}" |
| 9 | target: exampleservice |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 10 | |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 11 | - name: Re-run 'make vtn' (work around bug in synchronizer) |
Scott Baker | 995641b | 2016-11-15 17:09:26 -0800 | [diff] [blame] | 12 | make: |
| 13 | chdir: "{{ service_profile_repo_dest }}/{{ xos_configuration }}" |
| 14 | target: vtn |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 15 | |
| 16 | - name: Wait for ExampleService VM to come up |
| 17 | shell: bash -c "source ~/admin-openrc.sh; nova list --all-tenants|grep 'exampleservice.*ACTIVE' > /dev/null" |
| 18 | register: result |
| 19 | until: result | success |
| 20 | retries: 10 |
| 21 | delay: 60 |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 22 | tags: |
| 23 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 24 | |
| 25 | - name: Get ID of VM |
| 26 | shell: bash -c "source ~/admin-openrc.sh; nova list --all-tenants|grep mysite_exampleservice|cut -d '|' -f 2" |
| 27 | register: nova_id |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 28 | tags: |
| 29 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 30 | |
| 31 | - name: Get mgmt IP of VM |
| 32 | shell: bash -c "source ~/admin-openrc.sh; nova interface-list {{ nova_id.stdout }}|grep -o -m 1 172.27.[[:digit:]]*.[[:digit:]]*" |
| 33 | register: mgmt_ip |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 34 | tags: |
| 35 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 36 | |
| 37 | - name: Get public IP of VM |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 38 | shell: bash -c "source ~/admin-openrc.sh; nova interface-list {{ nova_id.stdout }}|grep -o -m 1 10.6.[[:digit:]]*.[[:digit:]]*" |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 39 | register: public_ip |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 40 | tags: |
| 41 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 42 | |
Andy Bavier | 30d27c9 | 2016-09-15 15:59:17 -0400 | [diff] [blame] | 43 | - name: Get name of compute node |
| 44 | shell: bash -c "source ~/admin-openrc.sh; nova service-list|grep nova-compute|cut -d '|' -f 3" |
| 45 | register: node_name |
| 46 | tags: |
| 47 | - skip_ansible_lint # running a sub job |
| 48 | |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 49 | - name: Wait for Apache to come up inside VM |
Andy Bavier | 30d27c9 | 2016-09-15 15:59:17 -0400 | [diff] [blame] | 50 | shell: ssh -o ProxyCommand="ssh -W %h:%p -l ubuntu {{ node_name.stdout }}" ubuntu@{{ mgmt_ip.stdout }} "ls /var/run/apache2/apache2.pid" > /dev/null |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 51 | register: result |
| 52 | until: result | success |
| 53 | retries: 20 |
| 54 | delay: 60 |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 55 | tags: |
| 56 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 57 | |
Andy Bavier | bef5628 | 2016-11-14 08:22:43 -0800 | [diff] [blame] | 58 | - name: start container |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 59 | become: yes |
Andy Bavier | bef5628 | 2016-11-14 08:22:43 -0800 | [diff] [blame] | 60 | lxd_container: |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 61 | name: testclient |
Andy Bavier | bef5628 | 2016-11-14 08:22:43 -0800 | [diff] [blame] | 62 | state: started |
| 63 | |
| 64 | - name: Make sure testclient has default route to vSG |
| 65 | become: yes |
| 66 | shell: lxc exec testclient -- route | grep default | grep "eth0.222.111" |
| 67 | register: result |
| 68 | until: result | success |
| 69 | retries: 3 |
| 70 | delay: 10 |
| 71 | tags: |
| 72 | - skip_ansible_lint # running a sub job |
| 73 | |
| 74 | - name: Download the curl package through the vSG |
| 75 | become: yes |
| 76 | command: lxc exec testclient -- apt-get install -y curl |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 77 | tags: |
| 78 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 79 | |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 80 | # Don't use lxc_container in order to get output |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 81 | - name: Test connectivity to ExampleService from test client |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 82 | become: yes |
Andy Bavier | bef5628 | 2016-11-14 08:22:43 -0800 | [diff] [blame] | 83 | command: lxc exec testclient -- curl -s http://{{ public_ip.stdout }} |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 84 | register: curltest |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 85 | tags: |
| 86 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 87 | |
| 88 | - name: Output from curl test |
| 89 | debug: var=curltest.stdout_lines |