{"id":50385079,"url":"https://github.com/stackhpc/ansible-role-libvirt-host","last_synced_at":"2026-05-30T14:30:56.940Z","repository":{"id":37966615,"uuid":"113179788","full_name":"stackhpc/ansible-role-libvirt-host","owner":"stackhpc","description":"This role configures a host as a Libvirt/KVM hypervisor. It can also configure storage pools and networks on the host.","archived":false,"fork":false,"pushed_at":"2025-11-13T09:11:05.000Z","size":115,"stargazers_count":38,"open_issues_count":20,"forks_count":33,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-11-13T11:17:56.745Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Jinja","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stackhpc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-12-05T12:32:39.000Z","updated_at":"2025-11-13T09:11:09.000Z","dependencies_parsed_at":"2024-12-17T15:28:26.206Z","dependency_job_id":"c5d1a2cb-cdc8-4364-b7a8-193d1ee25d8d","html_url":"https://github.com/stackhpc/ansible-role-libvirt-host","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/stackhpc/ansible-role-libvirt-host","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackhpc%2Fansible-role-libvirt-host","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackhpc%2Fansible-role-libvirt-host/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackhpc%2Fansible-role-libvirt-host/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackhpc%2Fansible-role-libvirt-host/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stackhpc","download_url":"https://codeload.github.com/stackhpc/ansible-role-libvirt-host/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stackhpc%2Fansible-role-libvirt-host/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33696681,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-30T02:00:06.278Z","response_time":92,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-05-30T14:30:56.830Z","updated_at":"2026-05-30T14:30:56.926Z","avatar_url":"https://github.com/stackhpc.png","language":"Jinja","funding_links":[],"categories":[],"sub_categories":[],"readme":"Libvirt Host\n============\n\nThis role configures a host as a Libvirt/KVM hypervisor. It can also configure\nstorage pools and networks on the host.\n\nRequirements\n------------\n\nThe host should have Virtualization Technology (VT) enabled.\n\nRole Variables\n--------------\n\n`libvirt_host_pools` is a list of pools to define and start. Each item\nshould be a dict containing the following items:\n- `name` The name of the pool.\n- `type` The type of the pool, currently only `dir`, `logical` and `rbd` are\n  supported. `lvm2` is supported as an alias for `logical`, but this alias is\n  deprecated and will be removed in a future release.\n- `capacity`  The capacity, in bytes, of the pool. (optional)\n- `path` The absolute path to the pool's backing directory.\n- `mode` The access mode of the pool. N.B.: This should be specified as an\n  integer **without** a leading zero; for example: `mode: 755`. (only `dir`)\n- `owner` The owner of the pool. (only `dir`)\n- `group` The group of the pool. (only `dir`)\n- `source` The name of the volume group (when type is `logical`) or RBD pool\n  (when type is `rbd`).\n- `pvs` A list of physical volumes the volume group consists of. (only when\n  type is `logical`)\n- `hosts` The list of the Ceph monitors IPs or hostnames. (only `rbd`)\n- `username` The username used for RADOS authentification. (only `rbd`)\n- `passphrase` The passphrase used for RADOS authentification. (only `rbd`)\n\n`libvirt_host_networks` is a list of networks to define and start. Each item\nshould be a dict containing the following items:\n- `name` The name of the network.\n- `mode` The forwarding mode of the network, `bridge`, `route`, `open` and `nat` are\n  supported. Leave empty for a isolated network mode.\n- `bridge` The name of the bridge interface for this network.\n- `ip` IP address of the virtual bridge, mandatory for `route`, `open` and `nat` mode.\n- `netmask` Netmask of the virtual bridge, mandatory for `route`, `open` and `nat` mode.\n- `domain` DNS domain name for `route`, `open` and `nat` mode, default to the network\n   name (optional).\n- `dhcp_start` First IP of the DHCP range in `route` , `open` or `nat` mode (optional).\n- `dhcp_end` Last IP of the DHCP range in `route`, `open` or `nat` mode (optional).\n- `routes` Optional list of additionals routes defined as following:\n  - `address` Address of the route, required.\n  - `prefix` Prefix of the route, required.\n  - `gateway` Gateway of the route, required.\n  - `metric` Metric of the route (optional).\n- `ipv6` IPv6 address of the virtual bridge (optional).\n- `ipv6_prefix` IPv6 prefix of the virtual bridge (optional).\n- `routesv6` Optional list of additionals IPv6 routes defined as following:\n  - `address` IPv6 address of the route, required.\n  - `prefix` IPv6 previx of the route, required.\n  - `gateway` gateway of the route, required.\n  - `metric` metric of the route (optional).\n\n`libvirt_host_require_vt` is whether to require that Intel Virtualisation\nTechnology (VT) is enabled in order to run this role. While this provides\nbetter VM performance, it may not be available in certain environments. The\ndefault value is `true`.\n\n`libvirt_host_arch`: Architecture of the libvirt host. This defaults to\n`ansible_facts.architecture`.\n\n`libvirt_host_qemu_emulators`: List of architectures for which to install QEMU\nsystem emulators, e.g.  `x86`. The default value is `['x86']` if\n\n`libvirt_host_require_vt` is `false`, otherwise the default value is an empty\nlist.\n\n`libvirt_host_enable_efi_support`: Whether to enable EFI support. This defaults\nto false as extra packages need to be installed.\n\n`libvirt_host_var_prefix`: This determines The directory under /var/run that libvirt\nuses to store state, e.g unix domain sockets, as well as the default name of the\nPID file. Override this if you have a conflict with the default socket e.g it\ncould be in use by the nova_libvirt container. Defaults to `\"\"`.\n\n`libvirt_host_socket_dir`: Where the libvirtd socket is created. Defaults to\n`/var/run/{{ libvirt_host_var_prefix }}` if `libvirt_host_var_prefix` is set,\notherwise `\"\"`.\n\n`libvirt_host_pid_path`: Path to PID file which prevents multiple instances of\nthe daemon from spawning. Defaults to `/var/run/{{ libvirt_host_var_prefix }}.pid`\nif `libvirt_host_var_prefix` is set, otherwise `\"\"`.\n\n`libvirt_host_libvirtd_args`: Command line arguments passed to libvirtd by the\ninit system when libvirtd is started - quotes will be added\n\n`libvirt_host_uri`: The libvirt connnection URI. Defaults to\n`qemu+unix:///system?socket={{ libvirt_host_socket_dir }}/libvirt-sock` if\n`libvirt_host_var_prefix` is set, otherwise `\"\"`. If set to a falsey value,\nan explicit connection URI will not be set when calling virsh or any of\nthe virt_ ansible modules.\n\n`libvirt_host_python3`: Whether the python3 version of the libvirt python\nbindings should be installed. If `false`, the python 2 bindings will be\ninstalled.\n\n`libvirt_host_install_daemon`: Whether to install and enable the libvirt\ndaemon. Default is `true`.\n\n`libvirt_host_install_client`: Whether to install and enable the libvirt\nclient. Default is `true`.\n\n`libvirt_host_extra_daemon_packages`: List of additional packages to install on\nlibvirt daemon hosts.\n\n`libvirt_host_extra_client_packages`: List of additional packages to install on\nlibvirt client hosts.\n\n`libvirt_host_libvirtd_conf_enabled`: Whether to configure `libvirtd.conf`.\nDefault is `true`.\n\n`libvirt_host_libvirtd_conf`: Configuration for `libvirtd.conf`. Dict mapping\noption names to values. Default is an empty dict.\n\n`libvirt_host_qemu_conf_enabled`: Whether to configure `qemu.conf`. Default is\n`true`.\n\n`libvirt_host_qemu_conf`: Configuration for `qemu.conf`. Dict mapping option\nnames to values. Default is an empty dict.\n\n`libvirt_host_enable_sasl_support`: Whether to enable SASL authentication\nsupport. Default is `false`.\n\n`libvirt_host_sasl_conf_enabled`: Whether to configure SASL authentication\n(`/etc/sasl2/libvirt.conf`). Default is the same as\n`libvirt_host_enable_sasl_support`.\n\n`libvirt_host_sasl_conf`: Configuration for SASL authentication\n(`/etc/sasl2/libvirt.conf`). String.\n\n`libvirt_host_sasl_mech_list`: List of enabled libvirt SASL authentication\nmechanisms. Default is `[\"SCRAM-SHA-256\"]` when `libvirt_host_tls_listen` is\n`true`, otherwise `[\"DIGEST-MD5\"]`.\n\n`libvirt_host_sasl_credentials`: List of SASL authentication credentials to\ncreate.  Each item is a dict containing `username` and `password` items.\nDefault is a single item list containing `libvirt_host_sasl_authname` and\n`libvirt_host_sasl_password`.\n\n`libvirt_host_sasl_authname`: Username for SASL authentication. Default is\n`libvirt`.\n\n`libvirt_host_sasl_password`: Password for SASL authentication. Default is\nunset.\n\n`libvirt_host_sasl_auth_conf_enabled`: Whether to configure SASL authentication\ncredentials (`/etc/libvirt/auth.conf`). Default is the same as\n`libvirt_host_enable_sasl_support`.\n\n`libvirt_host_sasl_auth_conf`: Configuration for SASL authentication\ncredentials (`/etc/libvirt/auth.conf`). String.\n\n`libvirt_host_sasl_auth_conf_filename`: Name of file to write SASL\nauthentication credentials to. Default is `\"/etc/libvirt/auth.conf\"`.\n\n`libvirt_host_sasl_auth_conf_owner`: Owner of file to write SASL\nauthentication credentials to. Default is `\"root\"`.\n\n`libvirt_host_sasl_auth_conf_group`: Group of file to write SASL\nauthentication credentials to. Default is `\"root\"`.\n\n`libvirt_host_sasl_auth_conf_mode`: Mode of file to write SASL\nauthentication credentials to. Default is `\"0600\"`.\n\n`libvirt_host_tcp_listen`: Whether to enable the systemd TCP socket unit.\nDefault is `false`.\n\n`libvirt_host_tcp_listen_address`: Systemd TCP socket ListenStream. See man\nsystemd.socket for format. Default is unset.\n\n`libvirt_host_tls_listen`: Whether to enable the systemd TLS socket unit.\nDefault is `false`.\n\n`libvirt_host_tls_listen_address`: Systemd TLS socket ListenStream. See man\nsystemd.socket for format. Default is unset.\n\n`libvirt_host_tls_server_cert`: TLS server certificate. Default is unset.\n\n`libvirt_host_tls_server_key`: TLS server key. Default is unset.\n\n`libvirt_host_tls_client_cert`: TLS client certificate. Default is unset.\n\n`libvirt_host_tls_client_key`: TLS client key. Default is unset.\n\n`libvirt_host_tls_cacert`: TLS CA certificate. Default is unset.\n\n`libvirt_host_qemu_tls_enabled`: Encrypt communication between QEMU instances using TLS.\nDefault is `false`.\n\n`libvirt_host_qemu_tls_server_cert`: TLS server certificate. Default is `libvirt_host_tls_server_cert`.\n\n`libvirt_host_qemu_tls_server_key`: TLS server key. Default is `libvirt_host_tls_server_key`.\n\n`libvirt_host_qemu_tls_client_cert`: TLS client certificate. Default is `libvirt_host_tls_client_cert`.\n\n`libvirt_host_qemu_tls_client_key`: TLS client key. Default is `libvirt_host_tls_client_key`.\n\n`libvirt_host_qemu_tls_cacert`:  TLS CA certificate. Default is `libvirt_host_tls_cacert`.\n\n`libvirt_host_qemu_user`: The user that QEMU runs as. This will be used for TLS file ownership\nDefault is `libvirt-qemu`.\n\n`libvirt_host_qemu_group`: The group that the QEMU user belongs to. This will be used for TLS file ownership.\nDefault is `libvirt-qemu`.\n\n`libvirt_host_vnc_tls_enabled`: Encrypt VNC traffic using TLS. Default is `false`.\n\n`libvirt_host_vnc_tls_server_cert`: TLS server certificate. Default is `libvirt_host_tls_server_cert`.\n\n`libvirt_host_vnc_tls_server_key`: TLS server key. Default is `libvirt_host_tls_server_key`.\n\n`libvirt_host_vnc_tls_cacert`: TLS CA certificate. Default is `libvirt_host_tls_cacert`.\n\n`libvirt_host_configure_apparmor`: Whether to configure AppArmor for directory\nstorage pools.\n\nDependencies\n------------\n\nNone\n\nExample Playbook\n----------------\n\n    ---\n    - name: Ensure that Libvirt is configured\n      hosts: all\n      roles:\n        - role: stackhpc.libvirt-host\n          libvirt_host_pools:\n            - name: my-pool\n              type: dir\n              capacity: 1024\n              path: /path/to/pool\n              mode: 755\n              owner: my-user\n              group: my-group\n            - name: lvm_pool\n              type: logical\n              source: vg1\n              target: /dev/vg1\n              pvs:\n                - /dev/sda3\n            - name: rbd-pool\n              type: rbd\n              source: rbd\n              hosts:\n                - 192.168.42.200\n                - 192.168.42.204\n                - 192.168.42.208\n              username: admin\n              passphrase: xxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n\n          libvirt_host_networks:\n            - name: br-example\n              mode: bridge\n              bridge: br-example\n            - name: brnat-example\n              mode: nat\n              bridge: brnat-example\n              domain: example.local\n              ip: 192.168.133.254\n              netmask: 255.255.255.0\n              dhcp_start: 192.168.133.100\n              dhcp_end: 192.168.133.200\n\nAuthor Information\n------------------\n\n- Mark Goddard (\u003cmark@stackhpc.com\u003e)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackhpc%2Fansible-role-libvirt-host","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstackhpc%2Fansible-role-libvirt-host","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackhpc%2Fansible-role-libvirt-host/lists"}