aboutsummaryrefslogtreecommitdiffstats
path: root/api/apidoc/functest.opnfv_tests.vnf.router.test_controller.function_test_exec.rst
Path not found
a id='n13' href='#n13'>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 43 44 45 46 47 48 49 50
##############################################################################
# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
---
#- 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