bundlewrap/bundles/pppd/items.py

147 lines
3.7 KiB
Python

directories = {
'/etc/ppp/ip-up.d': {
'purge': True,
'needs': {
'pkg_apt:ppp',
},
},
'/etc/ppp/ip-down.d': {
'purge': True,
'needs': {
'pkg_apt:ppp',
},
},
'/etc/ppp/ipv6-up.d': {
'purge': True,
'needs': {
'pkg_apt:ppp',
},
},
'/etc/ppp/ipv6-down.d': {
'purge': True,
'needs': {
'pkg_apt:ppp',
},
},
'/etc/ppp/peers': {
'purge': True,
'needs': {
'pkg_apt:ppp',
},
},
}
files = {
'/etc/nftables-rules.d/90-pppd': {
'content_type': 'any',
},
'/etc/ppp/chap-secrets': {
'source': 'secrets',
'content_type': 'mako',
'context': node.metadata.get('pppd'),
'mode': '0400',
'triggers': {
'svc_systemd:pppoe:restart',
},
},
'/etc/ppp/pap-secrets': {
'source': 'secrets',
'content_type': 'mako',
'context': node.metadata.get('pppd'),
'mode': '0400',
'triggers': {
'svc_systemd:pppoe:restart',
},
},
'/etc/ppp/ip-down.d/nftables': {
'source': 'ip-down',
'mode': '0755',
},
'/etc/ppp/ip-up.d/nftables': {
'source': 'ip-up',
'content_type': 'mako',
'context': {
'nftables': node.metadata.get('pppd/nftables-rules.d', set()),
},
'mode': '0755',
},
'/etc/ppp/peers/provider': {
'content_type': 'mako',
'context': node.metadata.get('pppd'),
'triggers': {
'svc_systemd:pppoe:restart',
},
},
'/etc/ppp/wait-until-stopped': {
'content_type': 'mako',
'context': {
'services': node.metadata.get('pppd/wait-until-stopped', set()),
},
'mode': '0700',
},
'/etc/sysctl.d/90-pppd.conf': {
'content_type': 'any',
},
'/etc/systemd/system/pppoe.service': {
'triggers': {
'action:systemd-reload',
'svc_systemd:pppoe:restart',
},
},
'/usr/local/bin/restart-pppoe-if-no-public-ip': {
'mode': '0755',
},
}
svc_systemd = {
'pppoe': {
'needs': {
'file:/etc/ppp/chap-secrets',
'file:/etc/ppp/pap-secrets',
'file:/etc/ppp/peers/provider',
'file:/etc/systemd/system/pppoe.service',
},
},
}
if node.metadata.get('pppd/dyndns', {}):
files['/etc/ppp/ip-up.d/dyndns'] = {
'content_type': 'mako',
'context': node.metadata.get('pppd/dyndns'),
'mode': '0755',
}
files['/usr/local/bin/dyndns_periodic'] = {
'content_type': 'mako',
'context': node.metadata.get('pppd/dyndns'),
'mode': '0755',
}
files['/etc/systemd/system/dyndns_periodic.timer'] = {
'triggers': {
'action:systemd-reload',
'svc_systemd:dyndns_periodic.timer:restart',
},
}
files['/etc/systemd/system/dyndns_periodic.service'] = {
'triggers': {
'action:systemd-reload',
},
}
svc_systemd['dyndns_periodic.timer'] = {
'needs': {
'file:/etc/systemd/system/dyndns_periodic.timer',
'file:/etc/systemd/system/dyndns_periodic.service',
},
}
else:
files['/etc/systemd/system/dyndns_periodic.timer'] = {
'delete': True,
}
files['/etc/systemd/system/dyndns_periodic.service'] = {
'delete': True,
}
svc_systemd['dyndns_periodic.timer'] = {
'before': {
'file:/etc/systemd/system/dyndns_periodic.timer',
'file:/etc/systemd/system/dyndns_periodic.service',
},
}