debops.libvirtd default variables
Sections
libvirt features
- libvirtd__kvm_support
Enable or disable support for KVM-based virtual machines.
libvirtd__kvm_support: '{{ True if (ansible_virtualization_type == "kvm" and (ansible_virtualization_role == "host" or libvirtd__register_hw_virt.stdout | d())) else False }}'
libvirtd packages
- libvirtd__base_packages
List of libvirtd packages which will be installed on all distribution releases, unless overridden.
libvirtd__base_packages: - 'libvirt-daemon-system' - 'libvirt-clients' - 'libnss-libvirt'
- libvirtd__base_packages_map
Override list of base packages for specific distribution releases.
libvirtd__base_packages_map: 'trusty': [ 'libvirt-bin' ] 'xenial': [ 'libvirt-bin' ]
- libvirtd__kvm_packages
List of QEMU KVM packages to install. They will be installed on all hosts apart from KVM guests, to not create redundant support.
libvirtd__kvm_packages: '{{ ["qemu-system-x86", "qemu-utils"] + (["qemu-kvm"] if ansible_distribution_release in ["stretch", "buster", "bionic", "focal"] else []) }}'
- libvirtd__network_packages
List of network-related packages to install with libvirtd.
libvirtd__network_packages: - 'dnsmasq-base' - 'bridge-utils' - 'ebtables'
- libvirtd__misc_packages
List of APT packages related to different subsystems not specified in other package lists, or packages which are required by libvirtd for correct operation.
libvirtd__misc_packages: - 'gawk' - 'netcat-openbsd' - 'ovmf' # UEFI firmware for amd64 VMs - 'pm-utils' - 'sysfsutils' - '{{ [] if (ansible_distribution_release in ["bullseye", "bookworm"]) else "virt-top" }}'
- libvirtd__packages
List of custom packages to install.
libvirtd__packages: []
- libvirtd__version
The version of the libvirtd daemon exposed as a convenient variable for conditional checks.
libvirtd__version: '{{ ansible_local.libvirtd.version | d("0.0.0") }}'
Access control
- libvirtd__deployment_mode
Specify the type of the environment a given libvirtd operates in. Possible choices:
libvirt,opennebula.libvirtd__deployment_mode: '{{ "opennebula" if ("debops_service_opennebula_node" in group_names) else "libvirt" }}'
- libvirtd__admins
List of administrator accounts which should have access to libvirtd.
libvirtd__admins: '{{ [ansible_user | d(lookup("env", "USER"))] if ansible_user | d(lookup("env", "USER")) != "root" else [] }}'
- libvirtd__unix_sock_group
Name of the UNIX system group which is allowed to access libvirtd service through its UNIX sockets.
libvirtd__unix_sock_group: '{{ ansible_local.libvirtd.unix_sock_group | d("libvirt") }}'
libvirtd connection URI
- libvirtd__system_uri
Connection URI for the local libvirtd instance.
libvirtd__system_uri: 'qemu:///system'
- libvirtd__uri_aliases
YAML dictionary with system-wide connection aliases configured in the
/etc/libvirt/libvirt.confconfiguration file.Each key is an alias for a connection, each value should be a valid libvirt URI connection string.
libvirtd__uri_aliases: 'localhost': '{{ libvirtd__system_uri }}'
- libvirtd__default_uri
Name of the alias from the
libvirtd__uri_aliasesvariable configured as default libvirt connection system-wide.libvirtd__default_uri: 'localhost'
libvirtd master configuration
These lists define configuration options present in the
/etc/libvirt/libvirtd.conf configuration file.
See libvirtd__configuration for more details.
- libvirtd__original_configuration
List of original libvirtd configuration options defined by the installed software package.
libvirtd__original_configuration: - name: 'listen_tls' comment: | Flag listening for secure TLS connections on the public TCP/IP port. NB, must pass the --listen flag to the libvirtd process for this to have any effect. It is necessary to setup a CA and issue server certificates before using this capability. This is enabled by default, uncomment this to disable it value: False section: 'network' state: 'comment' weight: 1 - name: 'listen_tcp' comment: | Listen for unencrypted TCP connections on the public TCP/IP port. NB, must pass the --listen flag to the libvirtd process for this to have any effect. Using the TCP socket requires SASL authentication by default. Only SASL mechanisms which support data encryption are allowed. This is DIGEST_MD5 and GSSAPI (Kerberos5) This is disabled by default, uncomment this to enable it. value: True section: 'network' state: 'comment' weight: 2 - name: 'tls_port' comment: | Override the port for accepting secure TLS connections This can be a port number, or service name value: '16514' section: 'network' state: 'comment' weight: 3 - name: 'tcp_port' comment: | Override the port for accepting insecure TCP connections This can be a port number, or service name value: '16509' section: 'network' state: 'comment' weight: 4 - name: 'listen_addr' comment: | Override the default configuration which binds to all network interfaces. This can be a numeric IPv4/6 address, or hostname If the libvirtd service is started in parallel with network startup (e. g. with systemd), binding to addresses other than the wildcards (0.0.0.0/::) might not be available yet. value: '192.168.0.1' section: 'network' state: 'comment' weight: 5 - name: 'mdns_adv' comment: | Flag toggling mDNS advertisement of the libvirt service. Alternatively can disable for all services on a host by stopping the Avahi daemon This is disabled by default, uncomment this to enable it value: True section: 'network' state: 'comment' weight: 6 - name: 'mdns_name' comment: | Override the default mDNS advertisement name. This must be unique on the immediate broadcast network. The default is "Virtualization Host HOSTNAME", where HOSTNAME is substituted for the short hostname of the machine (without domain) value: 'Virtualization Host Joe Demo' section: 'network' state: 'comment' weight: 7 - name: 'unix_sock_group' comment: | Set the UNIX domain socket group ownership. This can be used to allow a 'trusted' set of users access to management capabilities without becoming root. This is restricted to 'root' by default. value: 'libvirt' section: 'unix-socket' state: 'comment' weight: 1 - name: 'unix_sock_ro_perms' comment: | Set the UNIX socket permissions for the R/O socket. This is used for monitoring VM status only Default allows any user. If setting group ownership, you may want to restrict this too. value: '0777' section: 'unix-socket' state: 'comment' weight: 2 - name: 'unix_sock_rw_perms' comment: | Set the UNIX socket permissions for the R/W socket. This is used for full management of VMs Default allows only root. If PolicyKit is enabled on the socket, the default will change to allow everyone (eg, 0777) If not using PolicyKit and setting group ownership for access control, then you may want to relax this too. value: '0770' section: 'unix-socket' state: 'comment' weight: 3 - name: 'unix_sock_admin_perms' comment: | Set the UNIX socket permissions for the admin interface socket. Default allows only owner (root), do not change it unless you are sure to whom you are exposing the access to. value: '0700' section: 'unix-socket' state: 'comment' weight: 4 - name: 'unix_sock_dir' comment: | Set the name of the directory in which sockets will be found/created. value: '/var/run/libvirt' section: 'unix-socket' state: 'comment' weight: 5 - name: 'auth_unix_ro' comment: | Set an authentication scheme for UNIX read-only sockets By default socket permissions allow anyone to connect To restrict monitoring of domains you may wish to enable an authentication mechanism here value: 'none' section: 'authn' state: 'comment' weight: 1 - name: 'auth_unix_rw' comment: | Set an authentication scheme for UNIX read-write sockets By default socket permissions only allow root. If PolicyKit support was compiled into libvirt, the default will be to use 'polkit' auth. If the unix_sock_rw_perms are changed you may wish to enable an authentication mechanism here value: 'none' section: 'authn' state: 'comment' weight: 2 - name: 'auth_tcp' comment: | Change the authentication scheme for TCP sockets. If you don't enable SASL, then all TCP traffic is cleartext. Don't do this outside of a dev/test scenario. For real world use, always enable SASL and use the GSSAPI or DIGEST-MD5 mechanism in /etc/sasl2/libvirt.conf value: 'sasl' section: 'authn' state: 'comment' weight: 3 - name: 'auth_tls' comment: | Change the authentication scheme for TLS sockets. TLS sockets already have encryption provided by the TLS layer, and limited authentication is done by certificates It is possible to make use of any SASL authentication mechanism as well, by using 'sasl' for this option value: 'none' section: 'authn' state: 'comment' weight: 4 - name: 'access_drivers' comment: | Change the API access control scheme By default an authenticated user is allowed access to all APIs. Access drivers can place restrictions on this. By default the 'nop' driver is enabled, meaning no access control checks are done once a client has authenticated with libvirtd value: [ 'polkit' ] section: 'authn' state: 'comment' weight: 5 - name: 'key_file' comment: | Override the default server key file path value: '/etc/pki/libvirt/private/serverkey.pem' section: 'tls-cert' state: 'comment' weight: 1 - name: 'cert_file' comment: | Override the default server certificate file path value: '/etc/pki/libvirt/servercert.pem' section: 'tls-cert' state: 'comment' weight: 2 - name: 'ca_file' comment: | Override the default CA certificate path value: '/etc/pki/CA/cacert.pem' section: 'tls-cert' state: 'comment' weight: 3 - name: 'crl_file' comment: | Specify a certificate revocation list. Defaults to not using a CRL, uncomment to enable it value: '/etc/pki/CA/crl.pem' section: 'tls-cert' state: 'comment' weight: 4 - name: 'tls_no_sanity_certificate' comment: | Flag to disable verification of our own server certificates When libvirtd starts it performs some sanity checks against its own certificates. Default is to always run sanity checks. Uncommenting this will disable sanity checks which is not a good idea value: True section: 'authz' state: 'comment' weight: 1 - name: 'tls_no_verify_certificate' comment: | Flag to disable verification of client certificates Client certificate verification is the primary authentication mechanism. Any client which does not present a certificate signed by the CA will be rejected. Default is to always verify. Uncommenting this will disable verification - make sure an IP whitelist is set value: True section: 'authz' state: 'comment' weight: 2 - name: 'tls_allowed_dn_list' comment: | A whitelist of allowed x509 Distinguished Names This list may contain wildcards such as "C=GB,ST=London,L=London,O=Red Hat,CN=*" See the POSIX fnmatch function for the format of the wildcards. NB If this is an empty list, no client can connect, so comment out entirely rather than using empty list to disable these checks By default, no DNs are checked value: [ 'DN1', 'DN2' ] section: 'authz' state: 'comment' weight: 3 - name: 'sasl_allowed_username_list' comment: | A whitelist of allowed SASL usernames. The format for username depends on the SASL authentication mechanism. Kerberos usernames look like username@REALM This list may contain wildcards such as "*@EXAMPLE.COM" See the POSIX fnmatch function for the format of the wildcards. NB If this is an empty list, no client can connect, so comment out entirely rather than using empty list to disable these checks By default, no Usernames are checked value: [ 'joe@EXAMPLE.COM', 'fred@EXAMPLE.COM' ] section: 'authz' state: 'comment' weight: 4 - name: 'tls_priority' comment: | Override the compile time default TLS priority string. The default is usually "NORMAL" unless overridden at build time. Only set this is it is desired for libvirt to deviate from the global default settings. value: 'NORMAL' section: 'authz' state: 'comment' weight: 5 - name: 'max_clients' comment: | The maximum number of concurrent client connections to allow over all sockets combined. value: 5000 section: 'proc' state: 'comment' weight: 1 - name: 'max_queued_clients' comment: | The maximum length of queue of connections waiting to be accepted by the daemon. Note, that some protocols supporting retransmission may obey this so that a later reattempt at connection succeeds. value: 1000 section: 'proc' state: 'comment' weight: 2 - name: 'max_anonymous_clients' comment: | The maximum length of queue of accepted but not yet authenticated clients. The default value is 20. Set this to zero to turn this feature off. value: 20 section: 'proc' state: 'comment' weight: 3 - name: 'min_workers' comment: | The minimum limit sets the number of workers to start up initially. If the number of active clients exceeds this, then more threads are spawned, up to max_workers limit. Typically you would want max_workers to equal maximum number of clients allowed. value: 5 section: 'proc' state: 'comment' weight: 4 - name: 'max_workers' value: 20 section: 'proc' state: 'comment' weight: 5 - name: 'prio_workers' comment: | The number of priority workers. If all workers from above pool are stuck, some calls marked as high priority (notably domainDestroy) can be executed in this pool. value: 5 section: 'proc' state: 'comment' weight: 6 - name: 'max_requests' comment: | Total global limit on concurrent RPC calls. Should be at least as large as max_workers. Beyond this, RPC requests will be read into memory and queued. This directly impacts memory usage, currently each request requires 256 KB of memory. So by default up to 5 MB of memory is used XXX this is not actually enforced yet, only the per-client limit is used so far value: 20 section: 'proc' state: 'comment' weight: 7 - name: 'max_client_requests' comment: | Limit on concurrent requests from a single client connection. To avoid one client monopolizing the server this should be a small fraction of the global max_requests and max_workers parameter value: 5 section: 'proc' state: 'comment' weight: 8 - name: 'admin_min_workers' comment: | Same processing controls, but this time for the admin interface. For description of each option, be so kind to scroll few lines upwards. value: 1 section: 'proc' state: 'comment' weight: 9 - name: 'admin_max_workers' value: 5 section: 'proc' state: 'comment' weight: 10 - name: 'admin_max_clients' value: 5 section: 'proc' state: 'comment' weight: 11 - name: 'admin_max_queued_clients' value: 5 section: 'proc' state: 'comment' weight: 12 - name: 'admin_max_client_requests' value: 5 section: 'proc' state: 'comment' weight: 13 - name: 'log_level' comment: | Logging level: 4 errors, 3 warnings, 2 information, 1 debug basically 1 will log everything possible Note: Journald may employ rate limiting of the messages logged and thus lock up the libvirt daemon. To use the debug level with journald you have to specify it explicitly in 'log_outputs', otherwise only information level messages will be logged. value: 3 section: 'log' state: 'comment' weight: 1 - name: 'log_filters' comment: | Logging filters: A filter allows to select a different logging level for a given category of logs The format for a filter is one of: x:name x:+name where name is a string which is matched against the category given in the VIR_LOG_INIT() at the top of each libvirt source file, e. g., "remote", "qemu", or "util.json" (the name in the filter can be a substring of the full category name, in order to match multiple similar categories), the optional "+" prefix tells libvirt to log stack trace for each message matching name, and x is the minimal level where matching messages should be logged: 1: DEBUG 2: INFO 3: WARNING 4: ERROR Multiple filters can be defined in a single @filters, they just need to be separated by spaces. e. g. to only get warning or errors from the remote layer and only errors from the event layer: value: '3:remote 4:event' section: 'log' state: 'comment' weight: 2 - name: 'log_outputs' comment: | Logging outputs: An output is one of the places to save logging information The format for an output can be: x:stderr output goes to stderr x:syslog:name use syslog for the output and use the given name as the ident x:file:file_path output to a file, with the given filepath x:journald output to journald logging system In all case the x prefix is the minimal level, acting as a filter 1: DEBUG 2: INFO 3: WARNING 4: ERROR Multiple outputs can be defined, they just need to be separated by spaces. e. g. to log all warnings and errors to syslog under the libvirtd ident: value: '3:syslog:libvirtd' section: 'log' state: 'comment' weight: 3 - name: 'log_buffer_size' comment: | Log debug buffer size: This configuration option is no longer used, since the global log buffer functionality has been removed. Please configure suitable log_outputs/log_filters settings to obtain logs. value: 64 section: 'log' state: 'comment' weight: 4 - name: 'audit_level' comment: | This setting allows usage of the auditing subsystem to be altered: audit_level == 0 -> disable all auditing audit_level == 1 -> enable auditing, only if enabled on host (default) audit_level == 2 -> enable auditing, and exit if disabled on host value: 2 section: 'audit' state: 'comment' weight: 1 - name: 'audit_logging' comment: | If set to 1, then audit messages will also be sent via libvirt logging infrastructure. Defaults to 0 value: True section: 'audit' state: 'comment' weight: 2 - name: 'host_uuid' comment: | Host UUID is read from one of the sources specified in host_uuid_source. - 'smbios': fetch the UUID from 'dmidecode -s system-uuid' - 'machine-id': fetch the UUID from /etc/machine-id The host_uuid_source default is 'smbios'. If 'dmidecode' does not provide a valid UUID a temporary UUID will be generated. Another option is to specify host UUID in host_uuid. Keep the format of the example UUID below. UUID must not have all digits be the same. NB This default all-zeros UUID will not work. Replace it with the output of the 'uuidgen' command and then uncomment this entry value: '00000000-0000-0000-0000-000000000000' section: 'uuid' state: 'comment' weight: 1 - name: 'host_uuid_source' value: 'smbios' section: 'uuid' state: 'comment' weight: 2 - name: 'keepalive_interval' comment: | This allows libvirtd to detect broken client connections or even dead clients. A keepalive message is sent to a client after keepalive_interval seconds of inactivity to check if the client is still responding; keepalive_count is a maximum number of keepalive messages that are allowed to be sent to the client without getting any response before the connection is considered broken. In other words, the connection is automatically closed approximately after keepalive_interval * (keepalive_count + 1) seconds since the last message received from the client. If keepalive_interval is set to -1, libvirtd will never send keepalive requests; however clients can still send them and the daemon will send responses. When keepalive_count is set to 0, connections will be automatically closed after keepalive_interval seconds of inactivity without sending any keepalive messages. value: 5 section: 'keepalive' state: 'comment' weight: 1 - name: 'keepalive_count' value: 5 section: 'keepalive' state: 'comment' weight: 2 - name: 'keepalive_required' comment: | These configuration options are no longer used. There is no way to restrict such clients from connecting since they first need to connect in order to ask for keepalive. value: True section: 'keepalive' state: 'comment' weight: 3 - name: 'admin_keepalive_required' value: True section: 'keepalive' state: 'comment' weight: 4 - name: 'admin_keepalive_interval' comment: | Keepalive settings for the admin interface value: 5 section: 'keepalive' state: 'comment' weight: 5 - name: 'admin_keepalive_count' value: 5 section: 'keepalive' state: 'comment' weight: 6
- libvirtd__default_configuration
List of libvirtd configuration options which are changed from their original values by the role.
libvirtd__default_configuration: - 'unix_sock_group': '{{ libvirtd__unix_sock_group }}' 'unix_sock_ro_perms': '0770' 'unix_sock_rw_perms': '0770' # Ref: https://forum.opennebula.org/t/polkitd-traps-general-protection-ip-in-libmozjs-17-0-so/399/3 - name: 'auth_unix_ro' value: 'none' state: '{{ "present" if (libvirtd__deployment_mode == "opennebula") else "ignore" }}' # Ref: https://forum.opennebula.org/t/polkitd-traps-general-protection-ip-in-libmozjs-17-0-so/399/3 - name: 'auth_unix_rw' value: 'none' state: '{{ "present" if (libvirtd__deployment_mode == "opennebula") else "ignore" }}'
- libvirtd__configuration
List of libvirtd configuration options which should be set on all hosts in the Ansible inventory.
libvirtd__configuration: []
- libvirtd__group_configuration
List of libvirtd configuration options which should be set on hosts in specific Ansible inventory group.
libvirtd__group_configuration: []
- libvirtd__host_configuration
List of libvirtd configuration options which should be set on specific hosts in the Ansible inventory.
libvirtd__host_configuration: []
- libvirtd__combined_configuration
Variable which combines all of the configuration lists and passes them to the configuration file template for processing.
libvirtd__combined_configuration: '{{ libvirtd__original_configuration + libvirtd__default_configuration + libvirtd__configuration + libvirtd__group_configuration + libvirtd__host_configuration }}'
- libvirtd__configuration_sections
List which defines what sections are present in the
/etc/libvirt/libvirtd.confconfiguration file. See libvirtd__configuration_sections for more details.libvirtd__configuration_sections: - name: 'network' title: 'Network connectivity controls' - name: 'unix-socket' title: 'UNIX socket access controls' - name: 'authn' title: 'Authentication' comment: | - none: do not perform auth checks. If you can connect to the socket you are allowed. This is suitable if there are restrictions on connecting to the socket (eg, UNIX socket permissions), or if there is a lower layer in the network providing auth (eg, TLS/x509 certificates) - sasl: use SASL infrastructure. The actual auth scheme is then controlled from /etc/sasl2/libvirt.conf. For the TCP socket only GSSAPI & DIGEST-MD5 mechanisms will be used. For non-TCP or TLS sockets, any scheme is allowed. - polkit: use PolicyKit to authenticate. This is only suitable for use on the UNIX sockets. The default policy will require a user to supply their own password to gain full read/write access (aka sudo like), while anyone is allowed read/only access. - name: 'tls-cert' title: 'TLS X.509 certificate configuration' - name: 'authz' title: 'Authorization controls' - name: 'proc' title: 'Processing controls' - name: 'log' title: 'Logging controls' - name: 'audit' title: 'Auditing controls' - name: 'uuid' title: 'UUID of the host' - name: 'keepalive' title: 'Keepalive protocol' - name: 'unknown' title: 'Other parameters'
KSM (Kernel Samepage Merging) configuration
- libvirtd__ksm_enabled
Whether to enable KSM.
libvirtd__ksm_enabled: False
- libvirtd__ksm_sleep_milisecs
How long to sleep in between page scans.
libvirtd__ksm_sleep_milisecs: 20
- libvirtd__ksm_pages_to_scan
How many pages to scan in one run.
libvirtd__ksm_pages_to_scan: 100
Firewall configuration
- libvirtd__ferm_post_hook
Enable or disable installation of the ferm post hook.
libvirtd__ferm_post_hook: '{{ True if (ansible_local | d() and ansible_local.ferm | d() and (ansible_local.ferm.enabled | d()) | bool) else False }}'
Configuration for other Ansible roles
- libvirtd__ferm__dependent_rules
Configuration for
debops.fermfirewall.libvirtd__ferm__dependent_rules: - type: 'custom' filename: 'bootpc_checksum' weight: '30' rules: | # Add checksums to BOOTP packets from virtual machines and containers. # https://www.redhat.com/archives/libvir-list/2010-August/msg00035.html @hook post "iptables -A POSTROUTING -t mangle -p udp --dport bootpc -j CHECKSUM --checksum-fill"; - type: 'custom' filename: 'reload_libvirt' weight: 'zz' rules: '@hook post "type libvirtd > /dev/null && (systemctl reload libvirtd || true)";' state: 'absent'
- libvirtd__python__dependent_packages3
Configuration for the debops.python Ansible role.
libvirtd__python__dependent_packages3: - 'python3-libvirt'
- libvirtd__python__dependent_packages2
Configuration for the debops.python Ansible role.
libvirtd__python__dependent_packages2: - 'python-libvirt'
- libvirtd__nsswitch__dependent_services
Configuration for the debops.nsswitch Ansible role.
libvirtd__nsswitch__dependent_services: [ 'libvirt', 'libvirt_guest' ]