blob: 8a00676866059d9644535a834868e23e55fd8e02 [file] [log] [blame]
Gabe Black4c040b72016-11-17 22:35:04 +00001---
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: get interface of public_ip
14 register: public_interface
15 shell: |
16 ip addr | awk '/^[0-9]+:/ { sub(/:/,"",$2); iface=$2 } /^[[:space:]]*inet / { split($2, a, "/"); print iface" : "a[1] }' | grep "{{ public_ip }}" | cut -d " " -f 1
17 when: result.stat.exists == False
18
19- name: get gateway of private_ip
20 register: private_gateway
21 shell: |
22 echo {{ private_ip }} | cut -d '.' -f 1,2,3 | sed '/.*/ s/$/.1/'
23 when: result.stat.exists == False
24
25- name: setup vta
26 shell: |
27 vnf-setup --test-network {{private_interface.stdout}},{{private_ip}},255.255.255.0,{{private_gateway.stdout}} --management-interface {{public_interface.stdout}} --io-virtualization VIRTIO --test-speed 1G --tagging UNTAGGED --mtu-size 1450 --controller-address {{ controller_ip }}
28 when: result.stat.exists == False
29
30- name: record task completed
31 shell: echo "done" > /tmp/init_completed
32
33- name: restart vta
34 shell: reboot
35 when: result.stat.exists == False
36