
# Copyright 2017-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


---
# file: roles/dell-virt/prep/tasks/main.yml

- name: Trust the Dell apt repository
  apt_key:
    data: "{{ lookup('file', 'dell_apt_key.gpg') }}"

- name: Add Dell apt repo
  apt_repository:
    repo="{{ dell_apt_repo | default('deb http://linux.dell.com/repo/community/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} openmanage') }}"

- name: Install BIOS configuration scripts
  apt:
    update_cache=yes
    cache_valid_time=3600
    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
  tags:
    - skip_ansible_lint # just used to register result

- name: Enable virtualization in BIOS
  command: /opt/dell/toolkit/bin/syscfg --virtualization=enable
  when: virtualization_enabled|failed

