64 lines
1.7 KiB
Python
64 lines
1.7 KiB
Python
defaults = {
|
|
'apt': {
|
|
'packages': {
|
|
'libvirt-clients': {},
|
|
'libvirt-daemon-system': {},
|
|
'netcat-openbsd': {}, # for virt-manager
|
|
'qemu-utils': {},
|
|
'qemu-system-x86': {},
|
|
},
|
|
},
|
|
'icinga2_api': {
|
|
'vmhost': {
|
|
'services': {
|
|
'LIBVIRT PROCESS': {
|
|
'command_on_monitored_host': '/usr/lib/nagios/plugins/check_procs -C libvirtd -c 1:',
|
|
},
|
|
'QEMU VM STATUS': {
|
|
'command_on_monitored_host': 'sudo /usr/local/share/icinga/plugins/check_vm_status',
|
|
'vars.notification.mail': True,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
'pacman': {
|
|
'packages': {
|
|
'edk2-ovmf': {},
|
|
'libvirt': {},
|
|
},
|
|
},
|
|
}
|
|
|
|
if node.os == 'debian' and node.os_version[0] < 11:
|
|
defaults['apt']['packages']['qemu-kvm'] = {}
|
|
|
|
if node.has_bundle('zfs'):
|
|
defaults['apt']['packages']['libvirt-daemon-driver-storage-zfs'] = {}
|
|
|
|
if node.has_bundle('nftables'):
|
|
defaults['apt']['packages']['firewalld'] = {
|
|
'needed_by': {
|
|
'pkg_apt:libvirt-daemon-system',
|
|
},
|
|
}
|
|
|
|
if node.has_bundle('arch-with-gui'):
|
|
defaults['pacman']['packages']['virt-manager'] = {}
|
|
|
|
|
|
@metadata_reactor.provides(
|
|
'users',
|
|
)
|
|
def libvirt_group_for_admins(metadata):
|
|
result = {}
|
|
for user, config in metadata.get('users', {}).items():
|
|
if 'ALL' in config.get('sudo_commands', set()):
|
|
result[user] = {
|
|
'groups': {
|
|
'libvirt',
|
|
},
|
|
}
|
|
|
|
return {
|
|
'users': result,
|
|
}
|