diff options
Diffstat (limited to 'deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-route.yml')
-rwxr-xr-x | deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-route.yml | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-route.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-route.yml new file mode 100755 index 00000000..edf829ec --- /dev/null +++ b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-route.yml @@ -0,0 +1,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 + |