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: Wait for ExampleService VM to come up |
| 12 | shell: bash -c "source ~/admin-openrc.sh; nova list --all-tenants|grep 'exampleservice.*ACTIVE' > /dev/null" |
| 13 | register: result |
| 14 | until: result | success |
| 15 | retries: 10 |
| 16 | delay: 60 |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 17 | tags: |
| 18 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 19 | |
| 20 | - name: Get ID of VM |
| 21 | shell: bash -c "source ~/admin-openrc.sh; nova list --all-tenants|grep mysite_exampleservice|cut -d '|' -f 2" |
| 22 | register: nova_id |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 23 | tags: |
| 24 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 25 | |
| 26 | - name: Get mgmt IP of VM |
Zack Williams | 6e66899 | 2016-11-26 09:54:48 -0700 | [diff] [blame] | 27 | shell: bash -c "source ~/admin-openrc.sh; nova interface-list {{ nova_id.stdout }}|grep -o -m 1 '172\.27\.[[:digit:]]*\.[[:digit:]]*'" |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 28 | register: mgmt_ip |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 29 | tags: |
| 30 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 31 | |
| 32 | - name: Get public IP of VM |
Zack Williams | 6e66899 | 2016-11-26 09:54:48 -0700 | [diff] [blame] | 33 | 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] | 34 | register: public_ip |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 35 | tags: |
| 36 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 37 | |
Andy Bavier | 30d27c9 | 2016-09-15 15:59:17 -0400 | [diff] [blame] | 38 | - name: Get name of compute node |
| 39 | shell: bash -c "source ~/admin-openrc.sh; nova service-list|grep nova-compute|cut -d '|' -f 3" |
| 40 | register: node_name |
| 41 | tags: |
| 42 | - skip_ansible_lint # running a sub job |
| 43 | |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 44 | - name: Wait for Apache to come up inside VM |
Andy Bavier | 30d27c9 | 2016-09-15 15:59:17 -0400 | [diff] [blame] | 45 | 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] | 46 | register: result |
| 47 | until: result | success |
| 48 | retries: 20 |
| 49 | delay: 60 |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 50 | tags: |
| 51 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 52 | |
Andy Bavier | bef5628 | 2016-11-14 08:22:43 -0800 | [diff] [blame] | 53 | - name: start container |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 54 | become: yes |
Andy Bavier | bef5628 | 2016-11-14 08:22:43 -0800 | [diff] [blame] | 55 | lxd_container: |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 56 | name: testclient |
Andy Bavier | bef5628 | 2016-11-14 08:22:43 -0800 | [diff] [blame] | 57 | state: started |
| 58 | |
| 59 | - name: Make sure testclient has default route to vSG |
| 60 | become: yes |
| 61 | shell: lxc exec testclient -- route | grep default | grep "eth0.222.111" |
| 62 | register: result |
| 63 | until: result | success |
| 64 | retries: 3 |
| 65 | delay: 10 |
| 66 | tags: |
| 67 | - skip_ansible_lint # running a sub job |
| 68 | |
| 69 | - name: Download the curl package through the vSG |
| 70 | become: yes |
| 71 | command: lxc exec testclient -- apt-get install -y curl |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 72 | tags: |
| 73 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 74 | |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 75 | # Don't use lxc_container in order to get output |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 76 | - name: Test connectivity to ExampleService from test client |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 77 | become: yes |
Andy Bavier | bef5628 | 2016-11-14 08:22:43 -0800 | [diff] [blame] | 78 | command: lxc exec testclient -- curl -s http://{{ public_ip.stdout }} |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 79 | register: curltest |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 80 | tags: |
| 81 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 82 | |
| 83 | - name: Output from curl test |
| 84 | debug: var=curltest.stdout_lines |