2021-02-20 16:35:45 +00:00
|
|
|
defaults = {
|
|
|
|
'apt': {
|
|
|
|
'packages': {
|
|
|
|
'resolvconf': {
|
|
|
|
'installed': False,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-01-07 17:44:38 +00:00
|
|
|
@metadata_reactor.provides(
|
|
|
|
'interfaces',
|
|
|
|
)
|
2020-11-13 15:29:17 +00:00
|
|
|
def add_vlan_infos_to_interface(metadata):
|
|
|
|
interfaces = {}
|
|
|
|
|
2021-02-12 19:37:36 +00:00
|
|
|
for iface in metadata.get('interfaces', {}):
|
2020-11-13 15:29:17 +00:00
|
|
|
if not '.' in iface:
|
|
|
|
continue
|
|
|
|
|
|
|
|
interface,vlan = iface.split('.')
|
|
|
|
|
|
|
|
interfaces.setdefault(interface, {}).setdefault('vlans', set())
|
|
|
|
interfaces[interface]['vlans'].add(vlan)
|
|
|
|
|
|
|
|
return {
|
|
|
|
'interfaces': interfaces,
|
|
|
|
}
|
2021-04-23 17:31:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
@metadata_reactor.provides(
|
|
|
|
'telegraf/input_plugins/builtin/bond',
|
2021-04-24 10:38:51 +00:00
|
|
|
'telegraf/additional_capabilities',
|
2021-04-23 17:31:28 +00:00
|
|
|
)
|
|
|
|
def telegraf(metadata):
|
|
|
|
if not node.has_bundle('telegraf'):
|
|
|
|
raise DoNotRunAgain
|
|
|
|
|
|
|
|
if metadata.get('systemd-networkd/bonds', {}):
|
|
|
|
return {
|
|
|
|
'telegraf': {
|
|
|
|
'input_plugins': {
|
|
|
|
'builtin': {
|
|
|
|
'bond': [{
|
|
|
|
'bond_interfaces': list(sorted(metadata.get('systemd-networkd/bonds').keys())),
|
|
|
|
}],
|
|
|
|
},
|
|
|
|
},
|
2021-04-24 09:45:58 +00:00
|
|
|
'additional_capabilities': {
|
|
|
|
'CAP_NET_ADMIN',
|
|
|
|
},
|
2021-04-23 17:31:28 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
return {}
|