blob: 7462e7541422caba4c0fcdd64a84e9f2e58095b8 [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
Scott Baker995641b2016-11-15 17:09:26 -08007 make:
8 chdir: "{{ service_profile_repo_dest }}/{{ xos_configuration }}"
9 target: exampleservice
Andy Bavier8a7b8b62016-07-26 18:35:06 -040010
Andy Bavier8a7b8b62016-07-26 18:35:06 -040011- name: Re-run 'make vtn' (work around bug in synchronizer)
Scott Baker995641b2016-11-15 17:09:26 -080012 make:
13 chdir: "{{ service_profile_repo_dest }}/{{ xos_configuration }}"
14 target: vtn
Andy Bavier8a7b8b62016-07-26 18:35:06 -040015
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 Williams35624562016-08-28 17:12:26 -070022 tags:
23 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040024
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 Williams35624562016-08-28 17:12:26 -070028 tags:
29 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040030
31- name: Get mgmt IP of VM
Zack Williams6e668992016-11-26 09:54:48 -070032 shell: bash -c "source ~/admin-openrc.sh; nova interface-list {{ nova_id.stdout }}|grep -o -m 1 '172\.27\.[[:digit:]]*\.[[:digit:]]*'"
Andy Bavier8a7b8b62016-07-26 18:35:06 -040033 register: mgmt_ip
Zack Williams35624562016-08-28 17:12:26 -070034 tags:
35 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040036
37- name: Get public IP of VM
Zack Williams6e668992016-11-26 09:54:48 -070038 shell: bash -c "source ~/admin-openrc.sh; nova interface-list {{ nova_id.stdout }}|grep -o -m 1 '10\.6\.[[:digit:]]*\.[[:digit:]]*'"
Andy Bavier8a7b8b62016-07-26 18:35:06 -040039 register: public_ip
Zack Williams35624562016-08-28 17:12:26 -070040 tags:
41 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040042
Andy Bavier30d27c92016-09-15 15:59:17 -040043- 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 Bavier8a7b8b62016-07-26 18:35:06 -040049- name: Wait for Apache to come up inside VM
Andy Bavier30d27c92016-09-15 15:59:17 -040050 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 Bavier8a7b8b62016-07-26 18:35:06 -040051 register: result
52 until: result | success
53 retries: 20
54 delay: 60
Zack Williams35624562016-08-28 17:12:26 -070055 tags:
56 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040057
Andy Bavierbef56282016-11-14 08:22:43 -080058- name: start container
Andy Bavierb83beac2016-10-20 15:54:08 -040059 become: yes
Andy Bavierbef56282016-11-14 08:22:43 -080060 lxd_container:
Andy Bavierb83beac2016-10-20 15:54:08 -040061 name: testclient
Andy Bavierbef56282016-11-14 08:22:43 -080062 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 Williams35624562016-08-28 17:12:26 -070077 tags:
78 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040079
Andy Bavierb83beac2016-10-20 15:54:08 -040080# Don't use lxc_container in order to get output
Andy Bavier8a7b8b62016-07-26 18:35:06 -040081- name: Test connectivity to ExampleService from test client
Andy Bavierb83beac2016-10-20 15:54:08 -040082 become: yes
Andy Bavierbef56282016-11-14 08:22:43 -080083 command: lxc exec testclient -- curl -s http://{{ public_ip.stdout }}
Andy Bavier8a7b8b62016-07-26 18:35:06 -040084 register: curltest
Zack Williams35624562016-08-28 17:12:26 -070085 tags:
86 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040087
88- name: Output from curl test
89 debug: var=curltest.stdout_lines