CORD-433 Add virtual fabric to CiaB

Change-Id: I8fbea8c85f309a4c226951e0cde96a9b7394d6eb
diff --git a/ansible/roles/spineswitch/tasks/bridge.yml b/ansible/roles/spineswitch/tasks/bridge.yml
new file mode 100644
index 0000000..3e2cbfc
--- /dev/null
+++ b/ansible/roles/spineswitch/tasks/bridge.yml
@@ -0,0 +1,14 @@
+- name: Ensure brctl
+  apt:
+    name: bridge-utils
+    state: present
+
+- name: Ensure bridge
+  template:
+    src: templates/spinebr.cfg.j2
+    dest: /etc/network/interfaces.d/spinebr.cfg
+
+- name: Ensure bridge is up
+  command: ifup spinebr
+  tags:
+    - skip_ansible_lint # running a sub job
diff --git a/ansible/roles/spineswitch/tasks/fabric.yml b/ansible/roles/spineswitch/tasks/fabric.yml
new file mode 100644
index 0000000..02f2737
--- /dev/null
+++ b/ansible/roles/spineswitch/tasks/fabric.yml
@@ -0,0 +1,10 @@
+- name: Start ofdatapath
+  command: pgrep ofdatapath || ofdatapath -i eth2,eth3 -d {{ ansible_eth1.macaddress | hwaddr('bare') }} --no-slicing -D punix:/var/run/cpqd.sock
+  tags:
+    - skip_ansible_lint # running a sub job
+
+# /etc/resolv.conf not set up correctly in switches, use controller IP addr instead
+- name: Start ofprotocol
+  command: pgrep ofprotocol || ofprotocol -D --log-file=/var/log/ofprotocol.log unix:/var/run/cpqd.sock tcp:10.1.0.1:6653
+  tags:
+    - skip_ansible_lint # running a sub job
diff --git a/ansible/roles/spineswitch/tasks/main.yml b/ansible/roles/spineswitch/tasks/main.yml
new file mode 100644
index 0000000..ea25a5a
--- /dev/null
+++ b/ansible/roles/spineswitch/tasks/main.yml
@@ -0,0 +1,24 @@
+- name: Ensure interface config files
+  template:
+    src: templates/ethX.cfg.j2
+    dest: /etc/network/interfaces.d/{{ item }}.cfg
+  with_items:
+  - eth2
+  - eth3
+
+- name: Ensure interfaces are up
+  command: ifup {{ item }}
+  with_items:
+  - eth2
+  - eth3
+  tags:
+    - skip_ansible_lint # running a sub job
+
+- name: Ensure fabric configuration
+  include: fabric.yml
+  when: fabric
+
+- name: Ensure bridge configuration
+  include: bridge.yml
+  when: not fabric
+