Deploy SSH Key to fabric switches

Change-Id: Iccf24cb48b1d7ed5c62873008876937ce7739ccf
(cherry picked from commit 90c422a1e361d94c753eb20df990dbc8b9f663bc)
diff --git a/roles/fabric-switch/files/id_rsa.pub b/roles/fabric-switch/files/id_rsa.pub
new file mode 100644
index 0000000..36daa90
--- /dev/null
+++ b/roles/fabric-switch/files/id_rsa.pub
@@ -0,0 +1 @@
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDiLFqQhAWWlJd3c0n3xu1s7sO3Sj2KgOXRktlra/WDR1aJ+fRbmCSqj1VKRjZ8/BS2DGfKjJUWIRzUzIs3ECR3pQeX5jMXDh0MKsSm7lcMI8KS+TJ13Y/c6K7GaF4OqOmSU8xZ12xZIgDTrWpJ0FD6lib1Crm196S85VwA8+SgHbZ+0+uCc5Ki+9PAd+dkf+B+Ij4jFRxbAuSd6JR6fDmg77cmJ7UZuffIWp/emT5Uboz7xgeBkpjT9MFoUEcH5pwo3f/IiGedDN/BHItfm3GdjJoMjQeNUslCIUrRcqBMaGbhTsKalaQQfpYsX9w6z35yFAMNLA7FEP9UjDpbixcj cord@cord.lab
diff --git a/roles/fabric-switch/tasks/main.yml b/roles/fabric-switch/tasks/main.yml
index 6bbb9df..41251e7 100644
--- a/roles/fabric-switch/tasks/main.yml
+++ b/roles/fabric-switch/tasks/main.yml
@@ -38,7 +38,7 @@
     - reset
   register: utils
 
-- name: Mark Persistent
+- name: Mark Utilities Persistent
   command: persist {{ item }}
   with_items:
     - purge
@@ -47,7 +47,19 @@
     - reset
   when: utils.changed
 
+- name: Authorize SSH Key
+  become: yes
+  authorized_key:
+    key={{ pub_ssh_key }}
+    user=root
+    state=present
+  register: sshkey
+
+- name: Mark SSH Key Persistent
+  command: persist /root/.ssh/authorized_keys
+  when: sshkey.changed
+
 - name: Persist
   command: savepersist
-  when: utils.changed
+  when: utils.changed or sshkey.changed
   failed_when: false
diff --git a/roles/fabric-switch/vars/main.yml b/roles/fabric-switch/vars/main.yml
new file mode 100644
index 0000000..6d1a0cd
--- /dev/null
+++ b/roles/fabric-switch/vars/main.yml
@@ -0,0 +1 @@
+pub_ssh_key: "{{ lookup('file', 'files/id_rsa.pub') }}"