[3392] | 1 | #Copyright (c) 2015 Raytheon BBN Technologies |
---|
| 2 | # |
---|
| 3 | #Permission is hereby granted, free of charge, to any person obtaining |
---|
| 4 | #a copy of this software and/or hardware specification (the "Work") to |
---|
| 5 | #deal in the Work without restriction, including without limitation the |
---|
| 6 | #rights to use, copy, modify, merge, publish, distribute, sublicense, |
---|
| 7 | #and/or sell copies of the Work, and to permit persons to whom the Work |
---|
| 8 | #is furnished to do so, subject to the following conditions: |
---|
| 9 | # |
---|
| 10 | #The above copyright notice and this permission notice shall be |
---|
| 11 | #included in all copies or substantial portions of the Work. |
---|
| 12 | # |
---|
| 13 | #THE WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
---|
| 14 | #OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
---|
| 15 | #MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
---|
| 16 | #NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
---|
| 17 | #HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
---|
| 18 | #WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
---|
| 19 | #OUT OF OR IN CONNECTION WITH THE WORK OR THE USE OR OTHER DEALINGS |
---|
| 20 | #IN THE WORK. |
---|
| 21 | |
---|
| 22 | --- |
---|
| 23 | - name: test server and client |
---|
| 24 | hosts: all |
---|
| 25 | sudo: True |
---|
| 26 | tasks: |
---|
| 27 | - name: test installation |
---|
| 28 | shell: if [ -f /local/installed.txt ] ; then echo "yes" ; else echo "no" ; fi |
---|
| 29 | register: installation_test |
---|
| 30 | failed_when: "'no' in installation_test.stdout_lines" |
---|
| 31 | - debug: var=installation_test.stdout_lines |
---|
| 32 | - name: test whether files have been copied to /var/www |
---|
| 33 | shell: if [ -f /var/www/index.html ] ; then echo "yes" ; else echo "no" ; fi |
---|
| 34 | register: file_test |
---|
| 35 | failed_when: "'no' in file_test.stdout_lines" |
---|
| 36 | - debug: var=file_test.stdout_lines |
---|
| 37 | - name: check apache server running |
---|
| 38 | command: service apache2 status |
---|
| 39 | register: apache_running |
---|
| 40 | - debug: var=apache_running.stdout_lines |
---|
| 41 | - name: test server |
---|
| 42 | hosts: server |
---|
| 43 | sudo: True |
---|
| 44 | tasks: |
---|
| 45 | - name: check iperf running |
---|
| 46 | shell: ps aux | grep iperf |
---|
| 47 | register: iperf_running |
---|
| 48 | failed_when: "'iperf -s -i 10 &> /var/www/iperflogs/iperf-server.log' not in iperf_running.stdout" |
---|
| 49 | - debug: var=iperf_running.stdout_lines |
---|
| 50 | - name: test client |
---|
| 51 | hosts: client |
---|
| 52 | sudo: True |
---|
| 53 | tasks: |
---|
| 54 | - name: ping test |
---|
| 55 | command: ping -c 5 server |
---|
| 56 | register: ping_test |
---|
| 57 | - debug: var=ping_test.stdout_lines |
---|
| 58 | - name: iperf test |
---|
| 59 | command: iperf -c server -P 2 |
---|
| 60 | register: iperf_test |
---|
| 61 | failed_when: "'failed' in iperf_test.stderr" |
---|
| 62 | async: 30 |
---|
| 63 | poll: 10 |
---|
| 64 | - debug: var=iperf_test.stdout_lines |
---|
| 65 | - name: wget test |
---|
| 66 | command: wget -q http://10.10.10.1/graphics/hellogeni-banner.png -O /tmp/banner_test.png |
---|
| 67 | register: wget_test |
---|
| 68 | async: 60 |
---|
| 69 | poll: 10 |
---|
| 70 | - debug: var=wget_test |
---|
| 71 | |
---|