KVM provision role for Ansible
Go to file
Leander Hutton d0dad3fbc4 Initial commit 2023-12-08 19:01:12 -05:00
defaults Initial commit 2023-12-08 19:01:12 -05:00
meta Initial commit 2023-12-08 19:01:12 -05:00
tasks Initial commit 2023-12-08 19:01:12 -05:00
templates Initial commit 2023-12-08 19:01:12 -05:00
tests Initial commit 2023-12-08 19:01:12 -05:00
README.md Initial commit 2023-12-08 19:01:12 -05:00

README.md

kvm_provision Role

Deployes libvirt virtual machines from various template sources.

Requirements

Community libvirt:

ansible-galaxy collection install community.libvirt

Example Playbook

- name: Deploys VM based on template image
  hosts: localhost
  gather_facts: yes
  become: yes
  vars:
    pool_dir: "/var/lib/libvirt/images"
    vm: debian_12
    vcpus: 2
    ram_mb: 2048
    cleanup: no
    vm_user: beegyoshi
    vm_pass: stinky
    net: bridged-network

  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 }}"

Author Information

leander@one-button.org