2020-08-18 13:27:55 +00:00
|
|
|
defaults = {
|
|
|
|
'apt': {
|
|
|
|
'packages': {
|
|
|
|
'libvirt-clients': {},
|
|
|
|
'libvirt-daemon-system': {},
|
2021-05-23 10:24:00 +00:00
|
|
|
'netcat-openbsd': {}, # for virt-manager
|
2020-11-13 13:47:40 +00:00
|
|
|
'qemu-utils': {},
|
|
|
|
'qemu-system-x86': {},
|
2020-04-11 09:25:24 +00:00
|
|
|
},
|
2020-08-18 13:27:55 +00:00
|
|
|
},
|
2020-11-21 19:58:55 +00:00
|
|
|
'icinga2_api': {
|
|
|
|
'vmhost': {
|
|
|
|
'services': {
|
2020-12-21 08:50:15 +00:00
|
|
|
'LIBVIRT PROCESS': {
|
|
|
|
'command_on_monitored_host': '/usr/lib/nagios/plugins/check_procs -C libvirtd -c 1:',
|
|
|
|
},
|
2020-11-21 19:58:55 +00:00
|
|
|
'QEMU VM STATUS': {
|
|
|
|
'command_on_monitored_host': 'sudo /usr/local/share/icinga/plugins/check_vm_status',
|
2020-11-22 07:24:44 +00:00
|
|
|
'vars.notification.mail': True,
|
2020-11-21 19:58:55 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2022-03-11 12:58:38 +00:00
|
|
|
'pacman': {
|
|
|
|
'packages': {
|
2022-03-11 13:03:24 +00:00
|
|
|
'edk2-ovmf': {},
|
2022-03-11 12:58:38 +00:00
|
|
|
'libvirt': {},
|
|
|
|
},
|
|
|
|
},
|
2020-08-18 13:27:55 +00:00
|
|
|
}
|
2021-05-23 10:24:00 +00:00
|
|
|
|
2021-05-23 12:54:47 +00:00
|
|
|
if node.os == 'debian' and node.os_version[0] < 11:
|
|
|
|
defaults['apt']['packages']['qemu-kvm'] = {}
|
|
|
|
|
2021-05-23 10:24:00 +00:00
|
|
|
if node.has_bundle('zfs'):
|
|
|
|
defaults['apt']['packages']['libvirt-daemon-driver-storage-zfs'] = {}
|
2021-06-03 11:59:15 +00:00
|
|
|
|
|
|
|
if node.has_bundle('nftables'):
|
|
|
|
defaults['apt']['packages']['firewalld'] = {
|
|
|
|
'needed_by': {
|
|
|
|
'pkg_apt:libvirt-daemon-system',
|
|
|
|
},
|
|
|
|
}
|
2021-08-22 05:25:46 +00:00
|
|
|
|
2022-03-11 12:58:38 +00:00
|
|
|
if node.has_bundle('arch-with-gui'):
|
|
|
|
defaults['pacman']['packages']['virt-manager'] = {}
|
|
|
|
|
2021-08-22 05:25:46 +00:00
|
|
|
|
|
|
|
@metadata_reactor.provides(
|
|
|
|
'users',
|
|
|
|
)
|
|
|
|
def libvirt_group_for_admins(metadata):
|
|
|
|
result = {}
|
|
|
|
for user, config in metadata.get('users', {}).items():
|
2024-02-25 14:29:10 +00:00
|
|
|
if 'ALL' in config.get('sudo_commands', set()):
|
2021-08-22 05:25:46 +00:00
|
|
|
result[user] = {
|
|
|
|
'groups': {
|
|
|
|
'libvirt',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
'users': result,
|
|
|
|
}
|