add fabric simulation
diff --git a/cord-single-playbook.yml b/cord-single-playbook.yml
index f85ff6b..665cdad 100644
--- a/cord-single-playbook.yml
+++ b/cord-single-playbook.yml
@@ -45,6 +45,5 @@
- xos-vm-install
- onos-vm-install
- docker-compose-pull
- - simulate-fabric
-
+ - simulate-fabric
diff --git a/roles/docker-compose-pull/tasks/main.yml b/roles/docker-compose-pull/tasks/main.yml
index 8f97d86..49079a9 100644
--- a/roles/docker-compose-pull/tasks/main.yml
+++ b/roles/docker-compose-pull/tasks/main.yml
@@ -7,7 +7,7 @@
with_items: "{{ docker_compose_pull_list }}"
-- name: 'docker-compose up' where specified
+- name: Run "docker-compose up" where specified
command: ansible "{{ item.name }}" -b -u ubuntu -m command \
-a "docker up -d chdir={{ item.path }}"
with_items: "{{ docker_compose_pull_list | selectattr('up') }}"
diff --git a/roles/simulate-fabric/defaults/main.yml b/roles/simulate-fabric/defaults/main.yml
new file mode 100644
index 0000000..968f6d9
--- /dev/null
+++ b/roles/simulate-fabric/defaults/main.yml
@@ -0,0 +1,14 @@
+---
+# simulate-fabric/defaults/main.yml
+
+simfabric_bridges:
+ - name: databr
+ ipaddr: "10.168.0.1/24"
+ nat: True
+ interfaces:
+ - veth0
+
+simfabric_interfaces:
+ - veth0
+ - veth1
+
diff --git a/roles/simulate-fabric/files/simulate-fabric-playbook.yml b/roles/simulate-fabric/files/simulate-fabric-playbook.yml
new file mode 100644
index 0000000..60359a3
--- /dev/null
+++ b/roles/simulate-fabric/files/simulate-fabric-playbook.yml
@@ -0,0 +1,23 @@
+---
+- hosts: nova-compute-1
+ remote_user: ubuntu
+ become: yes
+
+ tasks:
+ - name: Include configuration vars
+ include_vars: simulate-fabric-vars.yml
+
+ - name: Install prerequisites
+ apt:
+ name={{ item }}
+ update_cache=yes
+ cache_valid_time=3600
+ become: yes
+ with_items:
+ - bridge-utils
+
+ - name: Create bridges
+ when: "ansible_interfaces[item.name] is not defined"
+ command: brctl addbr "{{ item.name }}"
+ with_items: "{{ simfabric_bridges }}"
+
diff --git a/roles/simulate-fabric/tasks/main.yml b/roles/simulate-fabric/tasks/main.yml
new file mode 100644
index 0000000..c9e834b
--- /dev/null
+++ b/roles/simulate-fabric/tasks/main.yml
@@ -0,0 +1,16 @@
+---
+# simulate-fabric/tasks/main.yml
+
+- name: Create a vars file from template
+ template:
+ src=simulate-fabric-vars.yml.j2
+ dest={{ ansible_user_dir }}/simulate-fabric-vars.yml
+
+- name: Copy over simulate-fabric ansible playbook
+ copy:
+ src=simulate-fabric-playbook.yml
+ dest={{ ansible_user_dir }}/simulate-fabric-playbook.yml
+
+- name: Setup simulated fabric on nova-compute-1 using playbook
+ command: ansible-playbook {{ ansible_user_dir }}/simulate-fabric-playbook.yml
+
diff --git a/roles/simulate-fabric/templates/simulate-fabric-vars.yml.j2 b/roles/simulate-fabric/templates/simulate-fabric-vars.yml.j2
new file mode 100644
index 0000000..d1a9926
--- /dev/null
+++ b/roles/simulate-fabric/templates/simulate-fabric-vars.yml.j2
@@ -0,0 +1,5 @@
+---
+
+simfabric_bridges: {{ simfabric_bridges }}
+simfabric_interfaces: {{ simfabric_interfaces }}
+