blob: 346e2f34d6a1b4b2d6a19983759f5037e01d5db4 [file] [log] [blame]
---
#
# Configures networking and Linux brdiges
#
- name: Creating ONOS bridge
become: yes
template:
src: templates/create_bridge.j2
dest: "/etc/network/if-pre-up.d/create_bridge_{{ bridge.name }}"
owner: root
group: root
mode: 0755
- name: Adding second NIC to ONOS bridge
become: yes
template:
src: templates/add_iface.j2
dest: "/etc/network/if-pre-up.d/add_iface_{{ bridge.phy_interface }}"
owner: root
group: root
mode: 0755
- name: Activating ONOS bridge
become: yes
command: /etc/network/if-pre-up.d/create_bridge_{{ bridge.name }} report-changed
register: bridge_changed
changed_when: bridge_changed.stdout == 'true'
- name: Adding physical interface to the bridge
become: yes
command: /etc/network/if-pre-up.d/add_iface_{{ bridge.phy_interface }} report-changed
register: bridge_iface_changed
changed_when: bridge_iface_changed == 'true'
- name: Moving the IP and starting bridge automatically at startup
become: yes
template:
src: templates/post_ifup.j2
dest: "/etc/network/if-up.d/bring_up_{{ bridge.name }}"
owner: root
group: root
mode: 0755
- name: Removing IP from the second NIC
become: yes
command: "/sbin/ip addr flush {{ bridge.phy_interface }}"
- name: Configuring the IP on the bridge
become: yes
command: "/sbin/ifconfig {{ bridge.name }} inet {{ bridge.ip }}"
- name: Bringing up ONOS bridge
become: yes
command: "/sbin/ifconfig {{ bridge.name }} up"