8000 GitHub - Gwerlas/libvirt: Install, configure and provision libvirt resources. · GitHub
[go: up one dir, main page]

Skip to content
GwerlasPublic

About

Install, configure and provision libvirt resources.

Resources

Contributing

Stars

1 star

Watchers

1 watching

Forks

Repository files navigation

Libvirt

pipeline status

Install, configure and provision libvirt resources.

GitLab project: yoanncolin/ansible/roles/libvirt

What it changes

With no variable set, the role installs libvirt with its QEMU backend and leaves the configuration your distribution ships as it is, but for what makes it usable right away:

  • the default NAT network is started and set to autostart, and the default storage pool is created on /var/lib/libvirt/images, so a domain gets a network and a disk without further setup;
  • where the distribution's packages do not work out of the box, the role fixes what stops them, and nothing more — on Debian 12, the system dnsmasq is bound to its own interfaces so that it leaves libvirt's networks alone.

One more change is made today and is on its way out, because nothing needs it: the QEMU security driver written in qemu.conf.

Everything else happens only when You describe it.

Requirements

The Linux base system configured with:

  • SSH
  • Python (for Ansible)
  • Sudo
  • Package manager ready to use

The gwerlas.system role can help You:

ansible-galaxy install gwerlas.system
- name: My playbook
  hosts: all
  roles:
    - role: gwerlas.system
    - role: gwerlas.libvirt

Tags

You can filter on some specific tasks using this tags:

  • provision: Provision resources only
  • users: Set users environment and permissions (groups, per-user resources and TLS credentials)
  • ca: Redeploy the CA certificate and restart the daemon to apply it
  • ssl: Redeploy the server/client certificates and restart the daemon to apply them

Role Variables

Installation

Variable Default Description
libvirt_backends [qemu] List of backends to install
libvirt_install [libvirtd, clients] Components to install (libvirtd, clients, virt-manager, gnome-boxes, qemu)
libvirt_users [] Users granted libvirt access (see users)
libvirt_retries 2 Number of retries for package installation
libvirt_dnsmasq_management_method auto DNSMasq management: auto, bind, disable, or none
libvirt_dnsmasq_interface_types [ether] Interface types for DNSMasq to listen on (when method is bind)

Configuration

Variable Default Description
libvirt_config {} Per-file directives, as { <file>: { directive: value } }, written to /etc/libvirt/<file>.conf

Enabling TLS on the daemon (certificates, socket, per-user access, rotation) is covered in the TLS guide, and the firewalld rules in the firewall one.

Provisioning

Variable Default Description
libvirt_pools [] List of storage pools to create (see pools)
libvirt_volumes [] List of storage volumes to create (see volumes)
libvirt_networks [] List of virtual networks to create (see networks)
libvirt_domains [] List of virtual machines to create (see domains)
libvirt_default_disk_format qcow2 Default disk image format for volumes and domains
libvirt_default_keymap en-us Default keymap for VNC graphics
libvirt_default_cpu {mode: host-model} Default CPU configuration for domains
libvirt_uri qemu:///system Default libvirt connection URI
libvirt_remove_default_network false Remove libvirt's default network
libvirt_active_default_network {{ not libvirt_remove_default_network }} Keep libvirt's default network active

Documentation

Changelog

What changed in each release, and what an upgrade asks of your inventory, is in the changelog.

Dependencies

Be sure to have the community.libvirt >= 2.0 installad on your system, or present in your requirements.yml.

Example Playbook

Install and configure libvirt on a node:

- name: Libvirt
  hosts: all
  roles:
    - name: gwerlas.libvirt

Provisioning resources, enabling TLS and live-migrating domains are covered in the documentation above.

Limitations

Add physical disk to domain

It's only possible to add physical disk to domain in qemu:///system connection

License

BSD 3-Clause License.

About

Install, configure and provision libvirt resources.

Resources

Contributing

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages

0