aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-route.yml
blob: edf829ece85bb3ae1e405b4b7e6dc74bf4d74cf4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
---
#- hosts: all
#  sudo: yes
#  tasks:
- name: "delete existing route file"
#  sudo: True
  file:
    path: "/etc/network/if-up.d/routes"
    state: absent
  when: contrail_route

- name: "create route file"
#  sudo: True
  file:
    path: "/etc/network/if-up.d/routes"
    owner: "root"
    mode: 0755
    state: touch 
  when: contrail_route


- name: "add template"
#  sudo: True
  lineinfile:
    dest: "/etc/network/if-up.d/routes"
    line: "{{ item }}"
  with_items:
    - "#!/bin/bash" 
    - "[ \"$IFACE\" != {{ contrail_route[0].device }} ] && exit 0" 
  when: contrail_route

  
- name: "add static route"
#  sudo: True
  lineinfile:
    dest: "/etc/network/if-up.d/routes"
    line: "ip route add {{ item.ip }} via {{ item.gw }} dev {{ item.device }}"
    state: "present"
  with_items:
    - "{{ contrail_route }}"
  when: contrail_route