
# Copyright 2017-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


- name: Bridge Support is Present
  apt:
    name: bridge-utils
    force: yes
  tags: [prod]

- name: Ensure Management Bridge
  copy:
    src: mgmtbr.cfg
    dest: /etc/network/interfaces.d/mgmtbr.cfg
    owner: root
    group: root
    mode: 0644

- name: Ensure Management Bridge Up
  command: ifup mgmtbr
  changed_when: true

- name: Ensure fabric bridge
  copy:
    src: fabric.cfg
    dest: /etc/network/interfaces.d/fabric.cfg
    owner: root
    group: root
    mode: 0644

- name: Ensure fabric bridge
  command: ifup {{ item }}
  changed_when: true
  with_items:
  - fabric
  - fabric:0
  - fabric:1
