From the course: Ansible: From Basics to Guru by Pearson

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Lesson 20 lab solution: Managing a KVM-based virtual classroom with Ansible

Lesson 20 lab solution: Managing a KVM-based virtual classroom with Ansible - Ansible Tutorial

From the course: Ansible: From Basics to Guru by Pearson

Lesson 20 lab solution: Managing a KVM-based virtual classroom with Ansible

All right, let's write a playbook to set up KVM. So let's call it KVM setup with YAML. And in that playbook, a play header, set up KVM host. And let's do that on the hosts, Rocky. I'm going to use the Ansible 1 and the Ansible 2 hosts that we have used before. And I have made sure that Ansible 2 has virtualization support enabled in BIOS, Ansible 1 does not. We are talking about the hypervisor extensions, and you need these hypervisor extensions to be present in the BIOS. Once they are, you can find either the SVM or the VMX flag in the file proc CPU info as a CPU property. And that's exactly what we are going to do first. So I'm using fill if KVM support is not enabled. So what am I going to do? Well, just command grab minus E. That's an extended regular expression that I'm I'm going to use, which allows me to search for either or. So SVM or VMX, and it needs to be present in the file slash proc slash CPU info. So what is the thing? The thing is, if this flag is not available, our…

Contents