blob: 4df5ea89b0b323c60b93a98ef9c462a286473988 [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 Bakerdb5c8c72016-11-08 08:40:06 -08007 command: chdir="{{ service_profile_repo_dest }}/{{ xos_configuration }}" bash -c "make exampleservice |& tee xos-make-exampleservice.out"
Zack Williams35624562016-08-28 17:12:26 -07008 tags:
Scott Bakerdb5c8c72016-11-08 08:40:06 -08009 - skip_ansible_lint
Andy Bavier8a7b8b62016-07-26 18:35:06 -040010
11- name: Pause 60 seconds (work around bug in synchronizer)
12 pause: seconds=60
13
14- name: Re-run 'make vtn' (work around bug in synchronizer)
Scott Bakerdb5c8c72016-11-08 08:40:06 -080015 command: chdir="{{ service_profile_repo_dest }}/{{ xos_configuration }}" bash -c "make vtn |& tee xos-makevtn3.out"
Zack Williams35624562016-08-28 17:12:26 -070016 tags:
Scott Bakerdb5c8c72016-11-08 08:40:06 -080017 - skip_ansible_lint
Andy Bavier8a7b8b62016-07-26 18:35:06 -040018
19- name: Wait for ExampleService VM to come up
20 shell: bash -c "source ~/admin-openrc.sh; nova list --all-tenants|grep 'exampleservice.*ACTIVE' > /dev/null"
21 register: result
22 until: result | success
23 retries: 10
24 delay: 60
Zack Williams35624562016-08-28 17:12:26 -070025 tags:
26 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040027
28- name: Get ID of VM
29 shell: bash -c "source ~/admin-openrc.sh; nova list --all-tenants|grep mysite_exampleservice|cut -d '|' -f 2"
30 register: nova_id
Zack Williams35624562016-08-28 17:12:26 -070031 tags:
32 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040033
34- name: Get mgmt IP of VM
35 shell: bash -c "source ~/admin-openrc.sh; nova interface-list {{ nova_id.stdout }}|grep -o -m 1 172.27.[[:digit:]]*.[[:digit:]]*"
36 register: mgmt_ip
Zack Williams35624562016-08-28 17:12:26 -070037 tags:
38 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040039
40- name: Get public IP of VM
Andy Bavierb83beac2016-10-20 15:54:08 -040041 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 -040042 register: public_ip
Zack Williams35624562016-08-28 17:12:26 -070043 tags:
44 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040045
Andy Bavier30d27c92016-09-15 15:59:17 -040046- name: Get name of compute node
47 shell: bash -c "source ~/admin-openrc.sh; nova service-list|grep nova-compute|cut -d '|' -f 3"
48 register: node_name
49 tags:
50 - skip_ansible_lint # running a sub job
51
Andy Bavier8a7b8b62016-07-26 18:35:06 -040052- name: Wait for Apache to come up inside VM
Andy Bavier30d27c92016-09-15 15:59:17 -040053 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 -040054 register: result
55 until: result | success
56 retries: 20
57 delay: 60
Zack Williams35624562016-08-28 17:12:26 -070058 tags:
59 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040060
Andy Bavierbef56282016-11-14 08:22:43 -080061- name: start container
Andy Bavierb83beac2016-10-20 15:54:08 -040062 become: yes
Andy Bavierbef56282016-11-14 08:22:43 -080063 lxd_container:
Andy Bavierb83beac2016-10-20 15:54:08 -040064 name: testclient
Andy Bavierbef56282016-11-14 08:22:43 -080065 state: started
66
67- name: Make sure testclient has default route to vSG
68 become: yes
69 shell: lxc exec testclient -- route | grep default | grep "eth0.222.111"
70 register: result
71 until: result | success
72 retries: 3
73 delay: 10
74 tags:
75 - skip_ansible_lint # running a sub job
76
77- name: Download the curl package through the vSG
78 become: yes
79 command: lxc exec testclient -- apt-get install -y curl
Zack Williams35624562016-08-28 17:12:26 -070080 tags:
81 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040082
Andy Bavierb83beac2016-10-20 15:54:08 -040083# Don't use lxc_container in order to get output
Andy Bavier8a7b8b62016-07-26 18:35:06 -040084- name: Test connectivity to ExampleService from test client
Andy Bavierb83beac2016-10-20 15:54:08 -040085 become: yes
Andy Bavierbef56282016-11-14 08:22:43 -080086 command: lxc exec testclient -- curl -s http://{{ public_ip.stdout }}
Andy Bavier8a7b8b62016-07-26 18:35:06 -040087 register: curltest
Zack Williams35624562016-08-28 17:12:26 -070088 tags:
89 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040090
91- name: Output from curl test
92 debug: var=curltest.stdout_lines