.. | ||
defaults | ||
handlers | ||
meta | ||
tasks | ||
templates | ||
tests | ||
vars | ||
README.md |
KVM Provision
Provision virtual machines to local libvirt
Related to:
- https://www.redhat.com/sysadmin/build-VM-fast-ansible
- https://www.redhat.com/sysadmin/developing-ansible-role
Requirements
Recommend:
- Pre install and configure libvirt
- Create your ssh key
- Check permissions/security apparmor on qemu:///system or qemu:///session
Example Playbook
-
name: Deploys VM based on cloud image hosts: localhost gather_facts: yes vars: pool_dir: "/home/user/kvm" vm: vm_name vcpus: 1 ram_mb: 512 cleanup: no net: default ssh_pub_key: "/home/user/.ssh/id_ed25519.pub"
tasks:
- name: KVM Provision role include_role: name: kvm_provision vars: libvirt_pool_dir: "{{ pool_dir }}" vm_name: "{{ vm }}" vm_vcpus: "{{ vcpus }}" vm_ram_mb: "{{ ram_mb }}" vm_net: "{{ net }}" cleanup_tmp: "{{ cleanup }}" ssh_key: "{{ ssh_pub_key }}"
License
BSD