Gabe Black | 4c040b7 | 2016-11-17 22:35:04 +0000 | [diff] [blame] | 1 | --- |
| 2 | |
| 3 | - name: check if work should be done |
| 4 | stat: path=/tmp/init_completed |
| 5 | register: result |
| 6 | |
| 7 | - name: get interface of private_ip |
| 8 | register: private_interface |
| 9 | shell: | |
| 10 | ip addr | awk '/^[0-9]+:/ { sub(/:/,"",$2); iface=$2 } /^[[:space:]]*inet / { split($2, a, "/"); print iface" : "a[1] }' | grep "{{ private_ip }}" | cut -d " " -f 1 |
| 11 | when: result.stat.exists == False |
| 12 | |
| 13 | - name: run vnf-setup |
| 14 | shell: vnf-setup --controller-address {{controller_ip}} --controller-port 30500 --test-interface {{ private_interface.stdout }} --enable-single-test-mode |
| 15 | when: result.stat.exists == False |
| 16 | |
| 17 | - name: rm dhcp cache |
| 18 | shell: rm /var/lib/dhcp/dhclient.leases |
| 19 | when: result.stat.exists == False |
| 20 | |
| 21 | - name: rm test interface from /etc/network/interfaces |
| 22 | shell: | |
| 23 | sed -i '/{{ private_interface.stdout }}/d' /etc/network/interfaces |
| 24 | when: result.stat.exists == False |
| 25 | |
| 26 | - name: reset test interface ip |
| 27 | shell: ifconfig {{ private_interface.stdout }} 0.0.0.0 |
| 28 | when: result.stat.exists == False |
| 29 | |
| 30 | - name: stop qt services |
| 31 | shell: /etc/init.d/vqt_startup stop |
| 32 | when: result.stat.exists == False |
| 33 | |
| 34 | - name: start apache service |
| 35 | shell: /etc/init.d/apache2 start |
| 36 | when: result.stat.exists == False |
| 37 | |
| 38 | - name: start qt services |
| 39 | shell: /etc/init.d/vqt_startup start |
| 40 | when: result.stat.exists == False |
| 41 | |
| 42 | - name: record task completed |
| 43 | shell: echo "done" > /tmp/init_completed |
| 44 | # |
| 45 | # - name: run reflector |
| 46 | # command: python /root/fusion_controller.py --start-reflector --controller-ip "{{ controller_ip }}" --reflector-ip "{{ public_ip }}" --reflector-src-ip "{{ private_ip }}" |
| 47 | # when: is_reflector |
| 48 | # |
| 49 | # - name: run initiator |
| 50 | # command: python /root/fusion_controller.py --start-initiator --controller-ip "{{ controller_ip }}" --initiator-ip "{{ public_ip }}" --initiator-src-ip "{{ private_ip }}" --reflector-ip "{{ reflector_public_ip }}" --reflector-src-ip "{{ reflector_ip }}" |
| 51 | # when: is_initiator |
| 52 | # |
| 53 | # - name: stop reflector |
| 54 | # command: python /root/fusion_controller.py --stop-reflector --controller-ip "{{ controller_ip }}" |
| 55 | # when: is_reflector == False |
| 56 | # |
| 57 | # - name: stop initiator |
| 58 | # command: python /root/fusion_controller.py --stop-initiator --controller-ip "{{ controller_ip }}" |
| 59 | # when: is_initiator == False |