Last active
June 5, 2017 13:34
-
-
Save xsgordon/a0c81d7f8debac1a9b1864c16fdb0946 to your computer and use it in GitHub Desktop.
Playbook to enable nested virtualization for Intel CPUs on RHEL 7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# E.g. ansible-playbook nested-virt.yaml --extra-vars target=127.0.0.1 | |
--- | |
- hosts: "{{target}}" | |
tasks: | |
- name: Disable reverse path filtering (default) | |
sysctl: > | |
name=net.ipv4.conf.default.rp_filter | |
value=0 | |
state=present | |
- name: Disable reverse path filtering (all) | |
sysctl: > | |
name=net.ipv4.conf.all.rp_filter | |
value=0 | |
state=present | |
- name: Set remote file path | |
set_fact: remote_file_path=/etc/modprobe.d/kvm_intel.conf | |
- name: Create file | |
file: path="{{ remote_file_path }}" state=touch | |
- stat: path="{{ remote_file_path }}" | |
register: file_path | |
- set_fact: | |
file_content: | | |
options kvm-intel nested=1 | |
options kvm-intel enable_shadow_vmcs=1 | |
options kvm-intel enable_apicv=1 | |
options kvm-intel ept=1 | |
- copy: content="{{ file_content }}" dest="{{ remote_file_path }}" | |
when: file_path.stat.exists == true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment