changed the playbook to enable virtualization in Dell R410 BIOS into a role
diff --git a/enable-virt-dell.yml b/enable-virt-dell.yml
deleted file mode 100644
index 2e84c05..0000000
--- a/enable-virt-dell.yml
+++ /dev/null
@@ -1,21 +0,0 @@
-# Enable virtualization on Dell R410s
----
-- hosts: onlab-compute
- sudo: yes
- tasks:
- - name: Update files
- copy: src=files/etc/apt/sources.list.d/linux.dell.com.sources.list
- dest=/etc/apt/sources.list.d/linux.dell.com.sources.list
-
- - shell: gpg --keyserver pool.sks-keyservers.net --recv-key 1285491434D8786F
-
- - shell: gpg -a --export 1285491434D8786F | sudo apt-key add -
-
- - name: Update apt cache
- apt: upgrade=yes update_cache=yes
-
- - name: Install packages
- apt: name=dtk-scripts state=present
-
- - name: Enable virtualization in BIOS
- shell: /opt/dell/toolkit/bin/syscfg --virtualization=enable
diff --git a/roles/dell-virt/tasks/main.yml b/roles/dell-virt/tasks/main.yml
new file mode 100644
index 0000000..f421bf6
--- /dev/null
+++ b/roles/dell-virt/tasks/main.yml
@@ -0,0 +1,27 @@
+---
+# file: roles/dell-virt/prep/tasks/main.yml
+
+- name: Trust the Dell apt repository
+ apt_key:
+ keyserver=pool.sks-keyservers.net
+ id=1285491434D8786F
+
+- name: Add Dell apt repo
+ apt_repository:
+ repo="deb http://linux.dell.com/repo/community/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} openmanage"
+
+- name: Install BIOS configuration scripts
+ apt:
+ update_cache=yes
+ name=dtk-scripts
+
+# KVM virtualization is either "kvm_intel" or "kvm_amd" on amd64
+- name: Check to see if processor KVM virtualization module loaded in kernel
+ shell: lsmod | grep kvm_
+ ignore_errors: true
+ register: virtualization_enabled
+
+- name: Enable virtualization in BIOS
+ command: /opt/dell/toolkit/bin/syscfg --virtualization=enable
+ when: virtualization_enabled|failed
+