blob: 331dfcfdab892c469ec76302a80317ce92a71120 [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: 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 Williams35624562016-08-28 17:12:26 -070017 tags:
18 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040019
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 Williams35624562016-08-28 17:12:26 -070023 tags:
24 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040025
26- name: Get mgmt IP of VM
Zack Williams6e668992016-11-26 09:54:48 -070027 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 -040028 register: mgmt_ip
Zack Williams35624562016-08-28 17:12:26 -070029 tags:
30 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040031
32- name: Get public IP of VM
Zack Williams6e668992016-11-26 09:54:48 -070033 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 -040034 register: public_ip
Zack Williams35624562016-08-28 17:12:26 -070035 tags:
36 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040037
Andy Bavier30d27c92016-09-15 15:59:17 -040038- 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 Bavier8a7b8b62016-07-26 18:35:06 -040044- name: Wait for Apache to come up inside VM
Andy Bavier30d27c92016-09-15 15:59:17 -040045 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 -040046 register: result
47 until: result | success
48 retries: 20
49 delay: 60
Zack Williams35624562016-08-28 17:12:26 -070050 tags:
51 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040052
Andy Bavierbef56282016-11-14 08:22:43 -080053- name: start container
Andy Bavierb83beac2016-10-20 15:54:08 -040054 become: yes
Andy Bavierbef56282016-11-14 08:22:43 -080055 lxd_container:
Andy Bavierb83beac2016-10-20 15:54:08 -040056 name: testclient
Andy Bavierbef56282016-11-14 08:22:43 -080057 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 Williams35624562016-08-28 17:12:26 -070072 tags:
73 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040074
Andy Bavierb83beac2016-10-20 15:54:08 -040075# Don't use lxc_container in order to get output
Andy Bavier8a7b8b62016-07-26 18:35:06 -040076- name: Test connectivity to ExampleService from test client
Andy Bavierb83beac2016-10-20 15:54:08 -040077 become: yes
Andy Bavierbef56282016-11-14 08:22:43 -080078 command: lxc exec testclient -- curl -s http://{{ public_ip.stdout }}
Andy Bavier8a7b8b62016-07-26 18:35:06 -040079 register: curltest
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
83- name: Output from curl test
84 debug: var=curltest.stdout_lines