blob: 60c9f29cf8badc70e7cab7bb5c97f7c57960e810 [file] [log] [blame]
Andy Bavier8a7b8b62016-07-26 18:35:06 -04001---
2# test-examplservice/tasks/main.yml
Andy Bavier8a7b8b62016-07-26 18:35:06 -04003# Run tests to check that the single-node deployment has worked
4
Zack Williamsa2763112017-01-03 11:38:38 -07005- name: Load TOSCA to apply test config for ExampleService, over REST
6 xostosca:
7 url: "http://xos.{{ site_suffix }}:{{ xos_ui_port }}/api/utility/tosca/run/"
8 user: "{{ xos_admin_user }}"
9 password: "{{ xos_admin_pass }}"
10 recipe: "{{ lookup('file', cord_profile_dir + '/test-exampleservice.yaml' ) }}"
Andy Bavier8a7b8b62016-07-26 18:35:06 -040011
Andy Bavier8a7b8b62016-07-26 18:35:06 -040012- name: Wait for ExampleService VM to come up
13 shell: bash -c "source ~/admin-openrc.sh; nova list --all-tenants|grep 'exampleservice.*ACTIVE' > /dev/null"
14 register: result
15 until: result | success
16 retries: 10
17 delay: 60
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: Get ID of VM
22 shell: bash -c "source ~/admin-openrc.sh; nova list --all-tenants|grep mysite_exampleservice|cut -d '|' -f 2"
23 register: nova_id
Zack Williams35624562016-08-28 17:12:26 -070024 tags:
25 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040026
27- name: Get mgmt IP of VM
Zack Williams6e668992016-11-26 09:54:48 -070028 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 -040029 register: mgmt_ip
Zack Williams35624562016-08-28 17:12:26 -070030 tags:
31 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040032
33- name: Get public IP of VM
Zack Williams6e668992016-11-26 09:54:48 -070034 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 -040035 register: public_ip
Zack Williams35624562016-08-28 17:12:26 -070036 tags:
37 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040038
Andy Bavier30d27c92016-09-15 15:59:17 -040039- name: Get name of compute node
Moshe Levi7d5da542017-07-17 03:52:42 +030040 shell: bash -c "source ~/admin-openrc.sh; nova show {{ nova_id.stdout }}|grep hypervisor_hostname|cut -d '|' -f 3"
Andy Bavier30d27c92016-09-15 15:59:17 -040041 register: node_name
42 tags:
43 - skip_ansible_lint # running a sub job
44
Andy Bavier8a7b8b62016-07-26 18:35:06 -040045- name: Wait for Apache to come up inside VM
Andy Bavier30d27c92016-09-15 15:59:17 -040046 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 -040047 register: result
48 until: result | success
49 retries: 20
50 delay: 60
Zack Williams35624562016-08-28 17:12:26 -070051 tags:
52 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040053
Andy Bavierbef56282016-11-14 08:22:43 -080054- name: start container
Andy Bavierb83beac2016-10-20 15:54:08 -040055 become: yes
Andy Bavierbef56282016-11-14 08:22:43 -080056 lxd_container:
Andy Bavierb83beac2016-10-20 15:54:08 -040057 name: testclient
Andy Bavierbef56282016-11-14 08:22:43 -080058 state: started
59
60- name: Make sure testclient has default route to vSG
61 become: yes
62 shell: lxc exec testclient -- route | grep default | grep "eth0.222.111"
63 register: result
64 until: result | success
Zack Williams904e87f2017-03-02 14:35:28 -070065 retries: 20
66 delay: 30
Andy Bavierbef56282016-11-14 08:22:43 -080067 tags:
68 - skip_ansible_lint # running a sub job
69
70- name: Download the curl package through the vSG
71 become: yes
72 command: lxc exec testclient -- apt-get install -y curl
Zack Williams35624562016-08-28 17:12:26 -070073 tags:
74 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040075
Andy Bavierb83beac2016-10-20 15:54:08 -040076# Don't use lxc_container in order to get output
Andy Bavier8a7b8b62016-07-26 18:35:06 -040077- name: Test connectivity to ExampleService from test client
Andy Bavierb83beac2016-10-20 15:54:08 -040078 become: yes
Andy Bavierbef56282016-11-14 08:22:43 -080079 command: lxc exec testclient -- curl -s http://{{ public_ip.stdout }}
Andy Bavier8a7b8b62016-07-26 18:35:06 -040080 register: curltest
Zack Williams35624562016-08-28 17:12:26 -070081 tags:
82 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040083
84- name: Output from curl test
85 debug: var=curltest.stdout_lines
Zack Williamsa2763112017-01-03 11:38:38 -070086