Skip to content

nephelaiio/ansible-collection-libvirt

Repository files navigation

Ansible Collection - nephelaiio.libvirt

Build Status Ansible Galaxy

An ansible collection to create local Libvirt vm guests

Collection hostgroups

Hostgroup Default Description
libvirt_hosts 'localhos' Libvirt virtualization hosts
libvirt_guests 'all' Libvirt guests

Collection variables

The following is the list of parameters intended for end-user manipulation:

Parameter Default Description Required
libvirt_platforms [<platform_object>] Libvirt guest list true
libvirt_address '172.31.252.1/24' Libvirt host address false
libvirt_network 'molecule' Libvirt network name false
libvirt_user 'molecule' OS user for guest access false
libvirt_pass 'molecule' OS password for guest access false
libvirt_pool '{{ libvirt_network }}' Libvirt storage pool name false
libvirt_path '/var/lib/libvirt/{{ libvirt_network }}' Libvirt storage pool directory false
libvirt_conn_timeout '30' Libvirt guest conn tiemout false

The following environment variables are also supported

Variable Default Description Required
LIBVIRT_PURGE False Purge libvirt storage pool false
LIBVIRT_LOGDIR '/var/lib/libvirt/{{ libvirt_network }}/logs' Libvirt log directory false

where <node_object> follows the following json schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "array",
  "items": [
    {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "image": {
          "type": "url"
          "default": ""
        },
        "dhcp": {
          "type": "boolean",
          "default": False
        },
        "mem": {
          "type": "number"
          "default": 2
        },
        "cpu": {
          "type": "number",
          "default": 2
        },
        "size": {
          "type": "string",
          "default": "20G"
        }
      },
      "required": [
        "name",
        "image"
      ]
    }
  ]
}

Collection playbooks

  • nephelaiio.libvirt.create: Deploy network, storage pool and guests
  • nephelaiio.libvirt.destroy: Destroy guests, network and storage pool

Testing

Please make sure your environment has docker installed in order to run role validation tests.

Collection is tested against the following host OS:

  • Ubuntu Jammy

Collection is tested against the following guest OS:

  • Ubuntu Noble
  • Ubuntu Jammy
  • Ubuntu Focal
  • Debian Bookworm
  • Alma Linux 8
  • Alma Linux 9
  • Rocky Linux 8
  • Rocky Linux 9

You can test the collection directly from sources using command make test

License

This project is licensed under the terms of the MIT License

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published