blob: f7fe9853a76f073a0d321decbac2a5f3a3b6f687 [file] [log] [blame]
Srikanth Vavilapallia3993152016-11-17 03:19:00 +00001---
2- hosts: {{ instance_name }}
3 #gather_facts: False
4 connection: ssh
5 user: ubuntu
Sapan Bhatiab4b24392017-02-07 11:32:55 -08006 become: yes
Srikanth Vavilapallia3993152016-11-17 03:19:00 +00007 vars:
8 target_subnet : {{ target_subnet }}
9 src_intf_ip : {{ src_intf_ip }}
10
11
12 tasks:
13 - name: Find the interface that has specified src ip
14 shell: ifconfig | grep -B1 {{ src_intf_ip }} | head -n1 | awk '{print $1}'
15 register: src_intf
16
17 - name: debug
18 debug: var=src_intf.stdout
19
20 - name: set up the network
21 shell: "{{ '{{' }} item {{ '}}' }}"
22 with_items:
23 - sudo ip route add {{ target_subnet }} dev {{ '{{' }} src_intf.stdout {{ '}}' }}
24