initial commit
Change-Id: I5063800f2ddaf90a350325a9186479c25f90f8e1
diff --git a/roles/fabric-switch/tasks/main.yml b/roles/fabric-switch/tasks/main.yml
new file mode 100644
index 0000000..326219a
--- /dev/null
+++ b/roles/fabric-switch/tasks/main.yml
@@ -0,0 +1,45 @@
+---
+- name: Verify controller_ip Set
+ fail: msg="Please set variable 'controller_ip'. This can be set via a variable file or via the command line using the '--extra-vars' option."
+ when: controller_ip is not defined
+
+- name: Verify switch_id Set
+ fail: msg="Please set variable 'switch_id'. This can be set via a host specific variable file or via the command line using the '--extra-vars' option."
+ when: switch_id is not defined
+
+- name: Openflow Agent Version
+ shell: ofdpa --version
+ register: ofdpa_version
+ changed_when: false
+
+- name: Version I.12.1.1+1.1 Openflow Agent
+ include: ofdpa.yml
+ when: ofdpa_version.stdout.find('version I.12.1.1+1.1') == -1
+
+- name: Utilities Scripts
+ template:
+ src: files/{{ item }}
+ dest: /root
+ owner: root
+ group: root
+ mode: 0755
+ with_items:
+ - purge
+ - killit
+ - connect
+ - reset
+ register: utils
+
+- name: Mark Persistent
+ command: persist {{ item }}
+ with_items:
+ - purge
+ - killit
+ - connect
+ - reset
+ when: utils.changed
+
+- name: Persist
+ command: savepersist
+ when: utils.changed
+ failed_when: false
diff --git a/roles/fabric-switch/tasks/ofdpa.yml b/roles/fabric-switch/tasks/ofdpa.yml
new file mode 100644
index 0000000..2c643e8
--- /dev/null
+++ b/roles/fabric-switch/tasks/ofdpa.yml
@@ -0,0 +1,22 @@
+---
+- name: Openflow Agent Debian Archive
+ get_url:
+ url: http://github.com/ciena/ZeroTouchProvisioning/raw/master/ofdpa-i.12.1.1_12.1.1%2Baccton1.7-1_amd64.deb
+ validate_certs: false
+ dest: /mnt/flash2/ofdpa-i.12.1.1_12.1.1%2Baccton1.7-1_amd64.deb
+
+- name: OpenFlow Agent Stopped
+ service: name=ofdpa state=stopped
+
+- name: Openflow Agent
+ apt: deb="/mnt/flash2/ofdpa-i.12.1.1_12.1.1%2Baccton1.7-1_amd64.deb" force=true
+
+- name: OpenFlow Agent Started
+ service: name=ofdpa state=started
+
+- name: Mark Persist Openflow Agent
+ command: persist /etc/accton/ofdpa.conf
+
+- name: Persist Openflow Agent
+ command: savepersist
+ failed_when: false