An Ansible Role to install and configure a kvm host.
KVM in combination with libvirt is the major Linux hypervisor. Installing and configuring KVM is a very common task for most operators and engineers.
This role configures a KVM hypervisor:
- install qemu-kvm
- install libvirt
- install ksm support and service
- install kvm nesting support
Used Modules:
- Ansible Package Module
- Ansible Service Module
- Ansible Template Module
- Ansible Command Module
- Ansible Reboot Module
Install from Ansible Galaxy
ansible-galaxy install while_true_do.srv_kvm
Install from Github
git clone https://github.com/while-true-do/ansible-role-srv_kvm.git while_true_do.srv_kvm
---
# defaults file for while_true_do.srv_kvm
## Package Management
wtd_srv_kvm_package:
- qemu-kvm
- libvirt
# State can be present|latest|absent
wtd_srv_kvm_package_state: "present"
wtd_srv_kvm_ksm_package:
- ksmtuned
# State can be present|latest|absent
wtd_srv_kvm_ksm_package_state: "present"
## Service Management
wtd_srv_kvm_service: "libvirtd"
# State can be started|stopped
wtd_srv_kvm_service_state: "started"
wtd_srv_kvm_service_enabled: true
wtd_srv_kvm_ksm_service:
- ksm
- ksmtuned
# State can be started|stopped
wtd_srv_kvm_ksm_service_state: "started"
wtd_srv_kvm_ksm_service_enabled: true
## Configuration Management
wtd_srv_kvm_conf_nested_enabled: true
# State can be started|stopped
wtd_srv_kvm_conf_ksm:
# MONITOR_INTERVAL: 60
# SLEEP_MSEC: 10
# NPAGES_BOOST: 300
# NPAGES_DECAY: -50
# NPAGES_MIN: 64
# NPAGES_MAX: 1250
# THRES_COEF: 20
# THRES_CONST: 2048
## Host Management
wtd_srv_kvm_reboot_enabled: true
wtd_srv_kvm_reboot_msg: "System is going down to apply kvm configuration."
wtd_srv_kvm_reboot_timeout: 3600
Running Ansible Roles can be done in a playbook.
---
- hosts: all
roles:
- role: while_true_do.srv_kvm
Don't install ksm support and don't reboot after kvm installation.
- hosts: all
roles:
- role: while_true_do.srv_kvm
wtd_srv_kvm_ksm_package_state: "absent"
wtd_srv_kvm_reboot_enabled: false
- RedHat Testing is currently not possible in public, due to limitations in subscriptions.
- Some services and features cannot be tested properly, due to limitations in docker.
Most of the "generic" tests are located in the Test Library.
Ansible specific testing is done with Molecule.
Infrastructure testing is done with testinfra.
Automated testing is done with Travis CI.
Thank you so much for considering to contribute. We are very happy, when somebody is joining the hard work. Please fell free to open Bugs, Feature Requests or Pull Requests after reading the Contribution Guideline.
See who has contributed already in the kudos.txt.
This work is licensed under a BSD-3-Clause License.
- Site https://while-true-do.io
- Twitter https://twitter.com/wtd_news
- Code https://github.com/while-true-do
- Mail hello@while-true-do.io
- IRC freenode, #while-true-do
- Telegram https://t.me/while_true_do