Compare commits
16 commits
5959d896e0
...
6b9b74b1e1
Author | SHA1 | Date | |
---|---|---|---|
6b9b74b1e1 | |||
1eafaf0d1c | |||
9159cd1eec | |||
15562df71f | |||
d59802ad92 | |||
29ac3d3dd7 | |||
76cee836b9 | |||
33d6888af4 | |||
6e5ce8581b | |||
53933957a4 | |||
8d941ebef4 | |||
800bd90778 | |||
df38fdb99e | |||
23947bd967 | |||
32ea52c8f4 | |||
d755267dd9 |
12 changed files with 74 additions and 94 deletions
3
bundles/ifupdown/items.py
Normal file
3
bundles/ifupdown/items.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
# svc_systemd = {
|
||||
# 'ifupdown.service': {},
|
||||
# }
|
|
@ -1,11 +0,0 @@
|
|||
% for section, options in sorted(conf.items()):
|
||||
[${section}]
|
||||
% for key, value in sorted(options.items()):
|
||||
% if value is None:
|
||||
${key}
|
||||
% else:
|
||||
${key} = ${value}
|
||||
% endif
|
||||
% endfor
|
||||
|
||||
% endfor
|
|
@ -10,8 +10,6 @@ directories = {
|
|||
'group': 'mysql',
|
||||
'needs': [
|
||||
'zfs_dataset:tank/mariadb',
|
||||
],
|
||||
'needs': [
|
||||
'pkg_apt:mariadb-server',
|
||||
'pkg_apt:mariadb-client',
|
||||
],
|
||||
|
@ -20,10 +18,8 @@ directories = {
|
|||
|
||||
files = {
|
||||
'/etc/mysql/conf.d/override.conf': {
|
||||
'context': {
|
||||
'conf': node.metadata.get('mariadb/conf'),
|
||||
},
|
||||
'content_type': 'mako',
|
||||
'content': repo.libs.ini.dumps(node.metadata.get('mariadb/conf')),
|
||||
'content_type': 'text',
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -3,12 +3,12 @@ defaults = {
|
|||
'packages': {
|
||||
'mariadb-server': {
|
||||
'needs': {
|
||||
#'zfs_dataset:tank/mariadb',
|
||||
'zfs_dataset:tank/mariadb',
|
||||
},
|
||||
},
|
||||
'mariadb-client': {
|
||||
'needs': {
|
||||
#'zfs_dataset:tank/mariadb',
|
||||
'zfs_dataset:tank/mariadb',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -36,61 +36,64 @@ def dhcp(metadata):
|
|||
'systemd/units',
|
||||
)
|
||||
def units(metadata):
|
||||
units = {}
|
||||
if node.has_bundle('systemd-networkd'):
|
||||
units = {}
|
||||
|
||||
for network_name, network_conf in metadata.get('network').items():
|
||||
interface_type = network_conf.get('type', None)
|
||||
for network_name, network_conf in metadata.get('network').items():
|
||||
interface_type = network_conf.get('type', None)
|
||||
|
||||
# network
|
||||
# network
|
||||
|
||||
units[f'{network_name}.network'] = {
|
||||
'Match': {
|
||||
'Name': network_name if interface_type == 'vlan' else network_conf['interface'],
|
||||
},
|
||||
'Network': {
|
||||
'DHCP': network_conf.get('dhcp', 'no'),
|
||||
'IPv6AcceptRA': network_conf.get('dhcp', 'no'),
|
||||
'VLAN': set(network_conf.get('vlans', set()))
|
||||
}
|
||||
}
|
||||
|
||||
# type
|
||||
|
||||
if interface_type:
|
||||
units[f'{network_name}.network']['Match']['Type'] = interface_type
|
||||
|
||||
# ips
|
||||
|
||||
for i in [4, 6]:
|
||||
if network_conf.get(f'ipv{i}', None):
|
||||
units[f'{network_name}.network'].update({
|
||||
f'Address#ipv{i}': {
|
||||
'Address': network_conf[f'ipv{i}'],
|
||||
},
|
||||
})
|
||||
if f'gateway{i}' in network_conf:
|
||||
units[f'{network_name}.network'].update({
|
||||
f'Route#ipv{i}': {
|
||||
'Gateway': network_conf[f'gateway{i}'],
|
||||
'GatewayOnlink': 'yes',
|
||||
}
|
||||
})
|
||||
|
||||
# as vlan
|
||||
|
||||
if interface_type == 'vlan':
|
||||
units[f"{network_name}.netdev"] = {
|
||||
'NetDev': {
|
||||
'Name': network_name,
|
||||
'Kind': 'vlan',
|
||||
units[f'{network_name}.network'] = {
|
||||
'Match': {
|
||||
'Name': network_name if interface_type == 'vlan' else network_conf['interface'],
|
||||
},
|
||||
'VLAN': {
|
||||
'Id': network_conf['id'],
|
||||
'Network': {
|
||||
'DHCP': network_conf.get('dhcp', 'no'),
|
||||
'IPv6AcceptRA': network_conf.get('dhcp', 'no'),
|
||||
'VLAN': set(network_conf.get('vlans', set()))
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
'systemd': {
|
||||
'units': units,
|
||||
# type
|
||||
|
||||
if interface_type:
|
||||
units[f'{network_name}.network']['Match']['Type'] = interface_type
|
||||
|
||||
# ips
|
||||
|
||||
for i in [4, 6]:
|
||||
if network_conf.get(f'ipv{i}', None):
|
||||
units[f'{network_name}.network'].update({
|
||||
f'Address#ipv{i}': {
|
||||
'Address': network_conf[f'ipv{i}'],
|
||||
},
|
||||
})
|
||||
if f'gateway{i}' in network_conf:
|
||||
units[f'{network_name}.network'].update({
|
||||
f'Route#ipv{i}': {
|
||||
'Gateway': network_conf[f'gateway{i}'],
|
||||
'GatewayOnlink': 'yes',
|
||||
}
|
||||
})
|
||||
|
||||
# as vlan
|
||||
|
||||
if interface_type == 'vlan':
|
||||
units[f"{network_name}.netdev"] = {
|
||||
'NetDev': {
|
||||
'Name': network_name,
|
||||
'Kind': 'vlan',
|
||||
},
|
||||
'VLAN': {
|
||||
'Id': network_conf['id'],
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
'systemd': {
|
||||
'units': units,
|
||||
}
|
||||
}
|
||||
}
|
||||
else:
|
||||
return {}
|
||||
|
|
|
@ -13,6 +13,7 @@ defaults = {
|
|||
'os-prober': {
|
||||
'installed': False,
|
||||
},
|
||||
'dnsmasq-base': {},
|
||||
},
|
||||
'sources': {
|
||||
'proxmox-ve': {
|
||||
|
|
|
@ -18,9 +18,3 @@ directories = {
|
|||
svc_systemd = {
|
||||
'systemd-networkd.service': {},
|
||||
}
|
||||
|
||||
|
||||
if not node.has_bundle('proxmox-ve'):
|
||||
files['/etc/network/interfaces'] = {
|
||||
'delete': True,
|
||||
}
|
||||
|
|
|
@ -5,5 +5,6 @@
|
|||
],
|
||||
'bundles': [
|
||||
'ifupdown',
|
||||
'proxmox-ve',
|
||||
],
|
||||
}
|
||||
|
|
|
@ -47,6 +47,14 @@
|
|||
'mtr-tiny': {},
|
||||
},
|
||||
},
|
||||
# iperf3
|
||||
'nftables': {
|
||||
'input': {
|
||||
'tcp dport 5201 accept',
|
||||
'udp dport 5201 accept',
|
||||
},
|
||||
},
|
||||
|
||||
},
|
||||
'os': 'debian',
|
||||
'pip_command': 'pip3',
|
||||
|
|
|
@ -14,7 +14,7 @@ class CaseSensitiveConfigParser(ConfigParser):
|
|||
return value
|
||||
|
||||
def parse(text):
|
||||
config = CaseSensitiveConfigParser()
|
||||
config = CaseSensitiveConfigParser(allow_no_value=True)
|
||||
config.read_string(text)
|
||||
|
||||
return {
|
||||
|
@ -24,8 +24,7 @@ def parse(text):
|
|||
|
||||
def dumps(dict):
|
||||
sorted_dict = json.loads(json.dumps(dict, sort_keys=True, cls=MetadataJSONEncoder))
|
||||
|
||||
parser = CaseSensitiveConfigParser()
|
||||
parser = CaseSensitiveConfigParser(allow_no_value=True)
|
||||
parser.read_dict(sorted_dict)
|
||||
|
||||
writable = Writable()
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
'id': '1d6a43e5-858c-42f9-9c40-ab63d61c787c',
|
||||
'network': {
|
||||
'external': {
|
||||
'interface': 'enx00e04c220682',
|
||||
'interface': 'enp2s0',
|
||||
'ipv4': '10.0.99.126/24',
|
||||
'gateway4': '10.0.99.1',
|
||||
'vlans': {'iot', 'internet', 'guest', 'rolf', 'internal', 'proxmox'},
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
'groups': [
|
||||
'autologin',
|
||||
'backup',
|
||||
'debian-12',
|
||||
'debian-12-pve',
|
||||
'home',
|
||||
'nextcloud',
|
||||
'monitored',
|
||||
|
@ -12,7 +12,6 @@
|
|||
'build-server',
|
||||
],
|
||||
'bundles': [
|
||||
'apcupsd',
|
||||
'build-agent',
|
||||
'crystal',
|
||||
'gitea',
|
||||
|
@ -32,7 +31,6 @@
|
|||
'systemd-swap',
|
||||
'twitch-clip-download',
|
||||
'raspberrymatic-cert',
|
||||
#'tasmota-charge',
|
||||
'wol-waker',
|
||||
'zfs',
|
||||
'proxmox-ve',
|
||||
|
@ -156,18 +154,6 @@
|
|||
},
|
||||
},
|
||||
'systemd-swap': 4_000_000_000,
|
||||
'tasmota-charge': {
|
||||
'phone': {
|
||||
'ip': '10.0.0.175',
|
||||
'user': 'u0_a233',
|
||||
'password': 'november',
|
||||
},
|
||||
'plug': {
|
||||
'ip': '10.0.2.115',
|
||||
'min': 45,
|
||||
'max': 70,
|
||||
},
|
||||
},
|
||||
'twitch-clip-download': {
|
||||
'channel_name': 'cronekorkn_',
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue