blob: a8ef5162ae8d3250a7df33ad8630cb35f1d99b94 [file] [log] [blame]
---
- name: check if work should be done
stat: path=/tmp/init_completed
register: result
- name: get interface of private_ip
register: private_interface
shell: |
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
when: result.stat.exists == False
- name: run vnf-setup
shell: vnf-setup --controller-address {{controller_ip}} --controller-port 30500 --test-interface {{ private_interface.stdout }} --enable-single-test-mode
when: result.stat.exists == False
- name: rm dhcp cache
shell: rm /var/lib/dhcp/dhclient.leases
when: result.stat.exists == False
- name: rm test interface from /etc/network/interfaces
shell: |
sed -i '/{{ private_interface.stdout }}/d' /etc/network/interfaces
when: result.stat.exists == False
- name: reset test interface ip
shell: ifconfig {{ private_interface.stdout }} 0.0.0.0
when: result.stat.exists == False
- name: stop qt services
shell: /etc/init.d/vqt_startup stop
when: result.stat.exists == False
- name: start apache service
shell: /etc/init.d/apache2 start
when: result.stat.exists == False
- name: start qt services
shell: /etc/init.d/vqt_startup start
when: result.stat.exists == False
- name: record task completed
shell: echo "done" > /tmp/init_completed
#
# - name: run reflector
# command: python /root/fusion_controller.py --start-reflector --controller-ip "{{ controller_ip }}" --reflector-ip "{{ public_ip }}" --reflector-src-ip "{{ private_ip }}"
# when: is_reflector
#
# - name: run initiator
# 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 }}"
# when: is_initiator
#
# - name: stop reflector
# command: python /root/fusion_controller.py --stop-reflector --controller-ip "{{ controller_ip }}"
# when: is_reflector == False
#
# - name: stop initiator
# command: python /root/fusion_controller.py --stop-initiator --controller-ip "{{ controller_ip }}"
# when: is_initiator == False