2023-04-09 10:09:28 +00:00
|
|
|
ratelimit_exempt_hosts = set()
|
2022-10-19 13:24:39 +00:00
|
|
|
|
2023-04-09 10:09:28 +00:00
|
|
|
for identifier in node.metadata.get('ntfy/ratelimit-exempt-hosts', set()):
|
|
|
|
ips = repo.libs.tools.resolve_identifier(repo, identifier)
|
|
|
|
ratelimit_exempt_hosts |= {str(ip) for ip in ips['ipv4']}
|
|
|
|
ratelimit_exempt_hosts |= {str(ip) for ip in ips['ipv6']}
|
|
|
|
|
|
|
|
|
|
|
|
files['/etc/ntfy/server.yml'] = {
|
|
|
|
'content_type': 'mako',
|
|
|
|
'context': {
|
|
|
|
'ratelimit_exempt_hosts': ratelimit_exempt_hosts,
|
|
|
|
},
|
|
|
|
'after': {
|
|
|
|
'pkg_apt:ntfy',
|
|
|
|
},
|
|
|
|
'triggers': {
|
|
|
|
'svc_systemd:ntfy:restart',
|
2022-10-19 13:24:39 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2023-04-09 10:09:28 +00:00
|
|
|
directories['/var/lib/ntfy'] = {
|
|
|
|
'owner': 'ntfy',
|
|
|
|
'group': 'ntfy',
|
|
|
|
'before': {
|
|
|
|
'pkg_apt:ntfy',
|
2022-10-19 13:24:39 +00:00
|
|
|
},
|
2023-04-09 10:09:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
directories['/var/cache/ntfy'] = {
|
|
|
|
'owner': 'ntfy',
|
|
|
|
'group': 'ntfy',
|
|
|
|
'before': {
|
|
|
|
'pkg_apt:ntfy',
|
2022-10-19 13:24:39 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2023-04-09 10:09:28 +00:00
|
|
|
directories['/var/opt/ntfy'] = {
|
|
|
|
'owner': 'ntfy',
|
|
|
|
'group': 'ntfy',
|
|
|
|
'before': {
|
|
|
|
'pkg_apt:ntfy',
|
2022-10-19 13:24:39 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2023-04-09 10:09:28 +00:00
|
|
|
svc_systemd['ntfy'] = {
|
|
|
|
'needs': {
|
|
|
|
'file:/etc/ntfy/server.yml',
|
|
|
|
'pkg_apt:ntfy',
|
2022-10-19 13:24:39 +00:00
|
|
|
},
|
|
|
|
}
|
2023-04-09 10:09:28 +00:00
|
|
|
|
|
|
|
users['ntfy'] = {
|
|
|
|
'home': '/var/lib/ntfy',
|
|
|
|
}
|