blob: 92bf70b8668dc54e7c78ab4dc44517ffb6bd1fa6 [file] [log] [blame]
Andy Bavier8a7b8b62016-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"
Zack Williams35624562016-08-28 17:12:26 -07009 tags:
10 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040011
12- name: Pause 60 seconds (work around bug in synchronizer)
13 pause: seconds=60
14
15- name: Re-run 'make vtn' (work around bug in synchronizer)
16 command: ansible xos-1 -u ubuntu -m shell \
17 -a "cd ~/service-profile/cord-pod; make vtn"
Zack Williams35624562016-08-28 17:12:26 -070018 tags:
19 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040020
21- name: Wait for ExampleService VM to come up
22 shell: bash -c "source ~/admin-openrc.sh; nova list --all-tenants|grep 'exampleservice.*ACTIVE' > /dev/null"
23 register: result
24 until: result | success
25 retries: 10
26 delay: 60
Zack Williams35624562016-08-28 17:12:26 -070027 tags:
28 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040029
30- name: Get ID of VM
31 shell: bash -c "source ~/admin-openrc.sh; nova list --all-tenants|grep mysite_exampleservice|cut -d '|' -f 2"
32 register: nova_id
Zack Williams35624562016-08-28 17:12:26 -070033 tags:
34 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040035
36- name: Get mgmt IP of VM
37 shell: bash -c "source ~/admin-openrc.sh; nova interface-list {{ nova_id.stdout }}|grep -o -m 1 172.27.[[:digit:]]*.[[:digit:]]*"
38 register: mgmt_ip
Zack Williams35624562016-08-28 17:12:26 -070039 tags:
40 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040041
42- name: Get public IP of VM
43 shell: bash -c "source ~/admin-openrc.sh; nova interface-list {{ nova_id.stdout }}|grep -o -m 1 10.168.[[:digit:]]*.[[:digit:]]*"
44 register: public_ip
Zack Williams35624562016-08-28 17:12:26 -070045 tags:
46 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040047
48- name: Wait for Apache to come up inside VM
49 shell: ssh -o ProxyCommand="ssh -W %h:%p ubuntu@nova-compute-1" ubuntu@{{ mgmt_ip.stdout }} "ls /var/run/apache2/apache2.pid" > /dev/null
50 register: result
51 until: result | success
52 retries: 20
53 delay: 60
Zack Williams35624562016-08-28 17:12:26 -070054 tags:
55 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040056
57- name: Install curl in testclient
58 command: ansible nova-compute-1 -u ubuntu -m shell \
59 -s -a "lxc-attach -n testclient -- apt-get -y install curl"
Zack Williams35624562016-08-28 17:12:26 -070060 tags:
61 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040062
63- name: Test connectivity to ExampleService from test client
64 command: ansible nova-compute-1 -u ubuntu -m shell \
65 -s -a "lxc-attach -n testclient -- curl -s http://{{ public_ip.stdout }}"
66 register: curltest
Zack Williams35624562016-08-28 17:12:26 -070067 tags:
68 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040069
70- name: Output from curl test
71 debug: var=curltest.stdout_lines