blob: 2ae38135356b05ab5a0d4c9fae8865305b266e34 [file] [log] [blame]
Andy Baviere9f03332016-07-26 18:35:06 -04001---
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
7 command: ansible xos-1 -u ubuntu -m shell \
8 -a "cd ~/service-profile/cord-pod; make exampleservice"
9
10- name: Pause 60 seconds (work around bug in synchronizer)
11 pause: seconds=60
12
13- name: Re-run 'make vtn' (work around bug in synchronizer)
14 command: ansible xos-1 -u ubuntu -m shell \
15 -a "cd ~/service-profile/cord-pod; make vtn"
16
17- name: Wait for ExampleService VM to come up
18 shell: bash -c "source ~/admin-openrc.sh; nova list --all-tenants|grep 'exampleservice.*ACTIVE' > /dev/null"
19 register: result
20 until: result | success
21 retries: 10
22 delay: 60
23
24- name: Get ID of VM
25 shell: bash -c "source ~/admin-openrc.sh; nova list --all-tenants|grep mysite_exampleservice|cut -d '|' -f 2"
26 register: nova_id
27
28- name: Get mgmt IP of VM
29 shell: bash -c "source ~/admin-openrc.sh; nova interface-list {{ nova_id.stdout }}|grep -o -m 1 172.27.[[:digit:]]*.[[:digit:]]*"
30 register: mgmt_ip
31
32- name: Get public IP of VM
33 shell: bash -c "source ~/admin-openrc.sh; nova interface-list {{ nova_id.stdout }}|grep -o -m 1 10.168.[[:digit:]]*.[[:digit:]]*"
34 register: public_ip
35
36- name: Wait for Apache to come up inside VM
37 shell: ssh -o ProxyCommand="ssh -W %h:%p ubuntu@nova-compute-1" ubuntu@{{ mgmt_ip.stdout }} "ls /var/run/apache2/apache2.pid" > /dev/null
38 register: result
39 until: result | success
40 retries: 20
41 delay: 60
42
43- name: Install curl in testclient
44 command: ansible nova-compute-1 -u ubuntu -m shell \
45 -s -a "lxc-attach -n testclient -- apt-get -y install curl"
46
47- name: Test connectivity to ExampleService from test client
48 command: ansible nova-compute-1 -u ubuntu -m shell \
49 -s -a "lxc-attach -n testclient -- curl -s http://{{ public_ip.stdout }}"
50 register: curltest
51
52- name: Output from curl test
53 debug: var=curltest.stdout_lines